• 站点地图
  • 加入收藏
  • 设为首页
  • 中国网管、站长学习园地hspace="5"
    当前位置:IT加速度>>服务器>>Dns服务器>>内容阅读
    一个疑问:为何某些门户网站直接输入IP地址却无法访问
    作者:  来源:  时间:2008-08-21
      导读:

    为什么我直接在浏览器中输入http://www.sina.com.cn就可以打开新浪,而输入

    http://218.30.108.59就显示如下错误信息呢
    ERROR
    The requested URL could not be retrieved

    --------------------------------------------------------------------------------

    While trying to retrieve the URL: http://218.30.108.59/ 

    The following error was encountered: 

    Access Denied. 
    Access control configuration prevents your request from being allowed at this 

    time. Please contact your service provider if you feel this is incorrect. 

    Your cache administrator is webmaster. 

     

    --------------------------------------------------------------------------------

    Generated Wed, 20 Oct 2004 00:35:04 GMT by 108-59.sina.com.cn (squid/2.5.STABLE5) 

    218.30.108.59是我执行ping www.sina.com.cn得到的一个对应IP地址,我试了试其他的一些

    门户网站,结果都是这样。请问这是什么原因?

     ricky7849 回复于:2004-10-20 08:50:49 
    其实可能和sina的网络架构有关,我ping www.sina.com.cn 后61.172.201.233,我估计可能有转NAT地址映射的问题,不过具体怎么做我也不是很清楚,也可能是sina.com做的小技巧来防止别人通过ip直接访问,还是希望有高手来指点 :)

     
     tjyihui 回复于:2004-10-20 09:18:56 
    不只sina,向sohu,163等等都是如此,这些网站的共同点就是采用了集群技术,就是有许多web服务器同时提供web服务,一个服务器对应一个IP地址,不管是218.30.108.59还是61.172.201.233都只是其中的一台服务器而已。但具体网站是如何设置的还真不清楚。

     
     abel 回复于:2004-10-20 10:49:35 
    可以猜測是反向代理(R-Proxy) ..
    由 R-Proxy (你寫的那個 IP) ,看到 www 時,根據 Request URI
    導到適當位置.

     
     coolgg 回复于:2004-10-20 12:37:30 
    这个应该还与web服务器设置有关,web服务器如果运行在虚拟主机状态下,看到请求的url里面域名的位置是ip地址而不是域名时就不知道用户到底请求的内容是什么了。

    关于集群,曾经有一家门户网站来和我们推荐过他们一种技术,就是把本来应该是根据用户请求动态生成的网页先抓成静态页面然后放在多台服务器上,用Layer4-7层交换机根据url的特征来进行负载均衡。每台服务器只负责其中一部分网页的服务(实际上就象cache一样)。

    在这种架构下,更加不可能靠输入ip地址来打开网页了。

     
     abel 回复于:2004-10-20 13:05:26 
    嗯~商業版有商業版的 Solution ..但價值有待商確...
    Open Source 的東西基本上就可以解決了

    sina.com.cn 跑的是 Squid 反向代理,根據我的經驗
    及樓主的訊息來看
    [quote:17abc3e7c8]Generated Wed, 20 Oct 2004 00:35:04 GMT by 108-59.sina.com.cn (squid/2.5.STABLE5) [/quote:17abc3e7c8]

    可以用下面來測試:
    [code:1:17abc3e7c8]
    telnet 218.30.108.59 80
    Trying 218.30.108.59...
    Connected to 218.30.108.59.
    Escape character is '^]'.
    GET http://www.sina.com.cn HTTP/1.1[/code:1:17abc3e7c8]
    你就會看到 sina 的網頁.但這個command 是一般代理的命令

    [code:1:17abc3e7c8]
    telnet 218.30.108.59 80
    Trying 218.30.108.59...
    Connected to 218.30.108.59.
    Escape character is '^]'.
    GET / HTTP/1.0
    Host: www.sina.com.cn[/code:1:17abc3e7c8]
    這個 command 則是一般 HTTP Request
    他也會導出相同頁面,但這個業面根據上一個例子,我們可以猜測
    是運行反向代理 (也就是 www.sina.com.cn 的 A 記錄指向是 Proxy Server, 非 Web Server)


    至於樓主的例子會變成這樣的 command
    (不懂的話要先研究 HTTP Protocol)
    [code:1:17abc3e7c8]
    telnet 218.30.108.59 80
    Trying 218.30.108.59...
    Connected to 218.30.108.59.
    Escape character is '^]'.
    GET / HTTP/1.0
    Host: 218.30.108.59[/code:1:17abc3e7c8]

    不同的 Http Request 有不同的回應
    我們再試一個代理測試:

    [code:1:17abc3e7c8]telnet 218.30.108.59 80
    Trying 218.30.108.59...
    Connected to 218.30.108.59.
    Escape character is '^]'.
    GET http://www.kimo.com.tw HTTP/1.0[/code:1:17abc3e7c8]
    上述是 HTTP/1.0 會出現 Access Deny

    下面是 HTTP/1.1
    Squid 回應 302  (就是要你自己去找目的,他不代理)

    [code:1:17abc3e7c8]telnet 218.30.108.59 80
    Trying 218.30.108.59...
    Connected to 218.30.108.59.
    Escape character is '^]'.
    GET http://www.kimo.com.tw HTTP/1.1[/code:1:17abc3e7c8]

    同樣的功能 Apache 本身也有,就在 mod_proxy* 這個 DSO 中
    不然也可以找 Pound: http://www.apsis.ch/pound

    原理都一樣,用 Layer 4+ Switch 技術的話,也有 L4 以上的做法
    但價錢恐怕就不便宜了

     
     coolgg 回复于:2004-10-20 14:05:19 
    新浪也真够节约的,用squid来做,不错不错。
    自己有技术能力可以省下很多成本呀。

    估计论坛里面也有sina的技术人员出没,不知道他们会不会看到这个帖子。

     
     wingger 回复于:2004-10-20 16:57:25 
    这个和WEB服务器的设置有关,和DNS没有关系

    一个IP可以对应N个虚拟主机

    可以IP没有作为主机名,就不能用IP访问,而只能用域名访问啦

    前提是你的域名已注册,并正确解析了

     
     abel 回复于:2004-10-20 17:16:12 
    這是用 新網 DNS 解到的 www.sina.com.cn 資料:
    [code:1:c02d5b1585]
    www.sina.com.cn.        60      IN      CNAME   jupiter.sina.com.cn.
    jupiter.sina.com.cn.    60      IN      CNAME   pavo.sina.com.cn.
    pavo.sina.com.cn.       60      IN      A       210.51.179.88
    pavo.sina.com.cn.       60      IN      A       210.51.179.89
    pavo.sina.com.cn.       60      IN      A       210.51.179.90
    pavo.sina.com.cn.       60      IN      A       210.51.179.91
    [/code:1:c02d5b1585]

    這個是用 台灣的DNS 解到的 www.sina.com.cn 資料:
    [code:1:c02d5b1585]
    ;; ANSWER SECTION:
    www.sina.com.cn.        43      IN      CNAME   jupiter.sina.com.cn.
    jupiter.sina.com.cn.    43      IN      CNAME   libra.sina.com.cn.
    libra.sina.com.cn.      44      IN      A       61.135.153.184
    libra.sina.com.cn.      44      IN      A       61.135.152.65
    libra.sina.com.cn.      44      IN      A       61.135.152.66
    libra.sina.com.cn.      44      IN      A       61.135.152.67
    libra.sina.com.cn.      44      IN      A       61.135.152.68
    libra.sina.com.cn.      44      IN      A       61.135.152.69
    libra.sina.com.cn.      44      IN      A       61.135.152.70
    libra.sina.com.cn.      44      IN      A       61.135.152.71
    libra.sina.com.cn.      44      IN      A       61.135.152.72
    libra.sina.com.cn.      44      IN      A       61.135.152.73
    libra.sina.com.cn.      44      IN      A       61.135.153.178
    libra.sina.com.cn.      44      IN      A       61.135.153.179
    libra.sina.com.cn.      44      IN      A       61.135.153.180
    libra.sina.com.cn.      44      IN      A       61.135.153.181
    libra.sina.com.cn.      44      IN      A       61.135.153.182
    libra.sina.com.cn.      44      IN      A       61.135.153.183
    [/code:1:c02d5b1585]

    很顯然的, sina.com.cn 使用 view 來分流...
    另外,上述 IP 我都測了幾個,都是 squid , 所以它還用了反向代理功能
    反向代理通常也會有 Load Balance/redundancy 的效果在

    至於有沒有用 L4+ Switch 從這邊我們無法知道.
    但若我們看 sina.com.cn 的 MX ,我估計是有的,因為把那些 MX 的IP
    ,各加幾碼或減幾碼拿來試 ,跑的都是 qmail

    所以,Web 有沒有用L4 我們不知道, MX 估計是有的

     
     coolgg 回复于:2004-10-20 20:07:06 
    我记得缓存服务器间好像还有一个ICP协议,可以用来定位请求的object在什么位置,可以帮助负载均衡.
    squid好像实现了ICP的.

     
     wingger 回复于:2004-10-20 20:10:09 
    大的门户网站一般都有分流

     
     tjyihui 回复于:2004-10-20 20:39:35 
    真是开眼界呀,看来要学的东西还不少呀。

     
     abel 回复于:2004-10-20 20:51:15 
    您可以多看看,
    不懂可以來問,
    這些東西或概念有時都是  點-線-面,慢慢累積的,不太可能一下就能到了
    另外,就 HTTP Request Command 或 proxy 或 ICP 等
    這些有時候除了看教學外,最重要的是要看懂 "標準"
    不是看懂使用

     
     tjyihui 回复于:2004-10-20 22:29:22 
    晚上在一个BLOG上看到一篇好文章,分析的很棒

    中国顶级门户网站架构分析1、2
    http://blog.csdn.net/marcolu/archive/2004/07/27/53890.aspx
    http://blog.csdn.net/marcolu/archive/2004/07/30/56461.aspx

     
     abel 回复于:2004-10-21 03:11:38 
    [quote:fbdfdec936]
    HTTP/1.0 200 OK
    Date: Fri, 30 Jul 2004 05:49:47 GMT
    Server: Apache/2.0.49 (Unix)
    Last-Modified: Fri, 30 Jul 2004 05:48:16 GMT
    Accept-Ranges: bytes
    Vary: Accept-Encoding
    Cache-Control: max-age=60
    Expires: Fri, 30 Jul 2004 05:50:47 GMT
    Content-Length: 180747
    Content-Type: text/html
    Age: 37
    X-Cache: HIT from sqsh-230.sina.com.cn
    Connection: close
    [/quote:fbdfdec936]
    嗯,上面的 Link 感覺沒有交特清楚,或不太對的觀念,原作者的說明:
    [quote:fbdfdec936]
    上面是sina的http头的反馈信息。里面有很多有价值的东东哦:)譬如,它后面的apache是用2.0.49,还设了过期时间为2分钟。最后修改时间。这些都是要在编译apache的时候载入的,特别是Last-Modified还需要小小的改一把源码--至少我是这样做的。
    [/quote:fbdfdec936]

    HTTP/1.0 200 OK 這大家都知道
    Date: 代表 Web 的 Response 時間,若這個時間不變,基本上可以猜測是 Proxy Server 回應的,也就是 Proxy Server 真正去 sina 後台抓這一頁的時間點
    Server: 後台被代理的 Web 版本
    Last-Modified: Request 的檔案最後修改時間,也就是你 ls -l 看到的時間,不懂該篇所提的含意
    Vary: 這個欄位我不懂,沒有特別研究,但覺得 RFC 2616 有交待不明確的感覺
    Cache-Control: max-age=60 每60秒後的 Request 檢查後面的 Web 本頁有無更新,會和 Age: 有關
    Expires: 本頁過期時間. Expires 和 Cache-Control 同時存在時,將以 Cache-Control 為運作機制)
    Content-Length: 180747
    Content-Type: text/html 這兩個大家都知道,但有時要多注意 1.1 中的 Transfer-Encoding: chunked 狀況 Ex: http://bbs.chinaunix.net/forum/viewtopic.php?t=417548
    Age: 現在 Cache 的秒數,依本例若超過 60 頁面更新查詢,若 Last-Modified 有異則更新頁面的 Cache,並從0起記
    X-Cache: 表示是由 Cache 回應,有 Age 值即有此欄為 HIT,不然為 MISS xxxx.....
    Connection: close 由於這是 Proxy 回的,所以通常為 Close,也就是 Server 丟出 Response 後就會 Close Connection.
            每一次 HTTP 的請求及回應都會一個新的 Connection.
    另外一種狀況為 Keep-Alive,通常會由 Keep-Alive: Header 說明其連線時間,ex: timeout=20, max=99 ,IDLE timeout 為20秒
            最多使用 99 秒在同一個 http connection 中

    其他欄位...有看到再說囉,當然,我的認知也可能有錯,若有錯希望您能告訴我.
    熟知原理,標準,你就可以知道作法,只是外面的套子有點不同而以.
    至於原貼提到的 Raid 或 NFS,這個重遠端並無法知道,只能用猜.
    是不是二層反向代理,我個人猜測是沒有的,原因是你對 www.sina.com.cn 做 HTTP Protocol 實驗即知:
    [code:1:fbdfdec936]
    for ip in `dig @168.95.1.1 www.sina.com.cn|grep '^libra' | awk '{print $5}'`
    do 
    echo $ip;echo -e "GET / HTTP/1.1\nHost: www.sina.com.cn\n\n"| nc $ip 80 | sed -n '1,20p'|grep -E 'Date|Last-|Expire'
    done
    [/code:1:fbdfdec936]

    結果:
    [code:1:fbdfdec936]
    61.135.153.183
    Date: Wed, 20 Oct 2004 18:42:30 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:30 GMT
    61.135.153.184
    Date: Wed, 20 Oct 2004 18:42:54 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:54 GMT
    61.135.152.65
    Date: Wed, 20 Oct 2004 18:42:04 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:04 GMT
    61.135.152.66
    Date: Wed, 20 Oct 2004 18:42:12 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:12 GMT
    61.135.152.67
    Date: Wed, 20 Oct 2004 18:43:54 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:44:54 GMT
    61.135.152.68
    Date: Wed, 20 Oct 2004 18:42:15 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:15 GMT
    61.135.152.69
    Date: Wed, 20 Oct 2004 18:42:05 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:05 GMT
    61.135.152.70
    Date: Wed, 20 Oct 2004 18:44:41 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:45:41 GMT
    61.135.152.71
    Date: Wed, 20 Oct 2004 18:42:41 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:41 GMT
    61.135.152.72
    Date: Wed, 20 Oct 2004 18:42:34 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:34 GMT
    61.135.152.73
    Date: Wed, 20 Oct 2004 18:43:50 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:44:50 GMT
    61.135.152.74
    Date: Wed, 20 Oct 2004 18:42:34 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:34 GMT
    61.135.152.75
    Date: Wed, 20 Oct 2004 18:44:49 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:45:49 GMT
    61.135.153.180
    Date: Wed, 20 Oct 2004 18:42:53 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:53 GMT
    61.135.153.181
    Date: Wed, 20 Oct 2004 18:42:10 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:10 GMT
    61.135.153.182
    Date: Wed, 20 Oct 2004 18:42:06 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Expires: Wed, 20 Oct 2004 18:43:06 GMT
    [/code:1:fbdfdec936]
    這個 IP List (www.sina.com.cn) 不見得和你一樣,但你可以發現 Date 多不同,若有兩次反向代理,應該會分成幾個群才是
    Last-Modified 可以看出大概是同一來源,所以理論上,用戶最多全 touch 到最 Fresh 的最新的首頁(後台),一天最多不過 1440 次(MISS),
    就算跑個 100 台 squid,144000 次對一般的 Apache Server 而言,並不算什麼,尤其又平均拆到一分鐘去算
    至於動態頁面的 Cache 估計也是有做(如搜尋功能),且 Cache 時間應會遠比首頁來的長很多,主要即是看頁面更新頻率,來決定 Cache-Control 時間
     

    用新網來試的例子:
    [code:1:fbdfdec936]
    for ip in `dig @210.51.170.66 www.sina.com.cn|grep '^pavo' | awk '{print $5}'`
    do 
    echo $ip;echo -e "GET / HTTP/1.1\nHost: www.sina.com.cn\n\n"| nc $ip 80 | sed -n '1,20p'|grep -E 'Date|Last-|Expire|Age|Cache-';
    done
    [/code:1:fbdfdec936]
    [code:1:fbdfdec936]
    210.51.179.89
    Date: Wed, 20 Oct 2004 19:04:15 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Cache-Control: max-age=60
    Expires: Wed, 20 Oct 2004 19:07:21 GMT
    Age: 89
    210.51.179.90
    Age: 125
    Date: Wed, 20 Oct 2004 19:05:23 GMT
    Expires: Wed, 20 Oct 2004 19:06:23 GMT
    Cache-Control: max-age=60
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    210.51.179.91
    Date: Wed, 20 Oct 2004 18:53:55 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    Cache-Control: max-age=60
    Expires: Wed, 20 Oct 2004 18:57:09 GMT
    Age: 9
    210.51.179.88
    Date: Wed, 20 Oct 2004 19:04:43 GMT
    Last-Modified: Wed, 20 Oct 2004 18:41:47 GMT
    [/code:1:fbdfdec936]
    發現有什麼狀況嗎 ?

    责任编辑:IT415

    上一篇:[原创]AIX的域名服务
    下一篇:没有文章
    相关内容