ICMP 重定向的一些问题

前端时间跟朋友遇到一个问题,一部分PC能上外网,另一部分不能上外网。

经检查,发现能上网的PC都是定制的windows xp,不能上网的都是定制的windows server。

而且在xp上ping外网测试,在route print中竟然出现了明细路由(32位),server上却没有。

后来测试发现,这是由于ICMP重定向引起的明细路由自动添加,至于为什么server访问不了外网,没有查到问题,改成3层互联后(switch与router),所以不建议下面这种部署方案。

Topology:

 vlan2: 10.1.1.254
 Default: 10.1.1.2                               ----
                                              ///    \\\
      +--------+ vlan2    +--------+         |          |
      | Switch |----------| Router |--------|  Internet  |
      +---+----+          +--------+         |          |
          |vlan2          10.1.1.2            \\\    ///
          |                                      ----
          |
        +-+-+
        |PC1|
        +---+
  IP: 10.1.1.1
  GW: 10.1.1.254

1. PC1访问外网,例如10.1.1.1,此时PC1会发现目的不是同一网段,发送到网管(switch的vlan2)

2. switch收到后,查找路由表,没有精确路由,走默认路由,把数据包发送到10.1.1.253

3. 此时switch发现路由器的下一跳跟请求数据包的源地址在同一个网段,所以向PC发送ICMP重定向

下面是ICMP重定向的数据包:

No.  Time       Source      Destination  Protocol  Info
1    0.000000   10.1.1.254  10.1.1.1     ICMP      Redirect (Redirect for network)
================================================================
+ Frame 1 (70 bytes on wire, 70 bytes captured)
- Ethernet II, Src: cc:00:17:b0:00:00 (cc:00:17:b0:00:00), Dst: 02:00:4c:4f:4f:50 (02:00:4c:4f:4f:50)
  + Destination: 02:00:4c:4f:4f:50 (02:00:4c:4f:4f:50)
  + Source: cc:00:17:b0:00:00 (cc:00:17:b0:00:00)
    Type: IP (0x0800)
-Internet Protocol, Src: 10.1.1.254 (10.1.1.254), Dst: 10.1.1.1 (10.1.1.1)
    Version: 4
  + Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
    Total Length: 56
    Identification: 0x001e (30)
  + Flags: 0x00
    Fragment offset: 0
    Time to live: 255
    Protocol: ICMP (0x01)
  + Header checksum: 0xa4a6 [correct]
    Source: 10.1.1.254 (10.1.1.254)
    Destination: 10.1.1.1 (10.1.1.1)
- Internet Control Message Protocol
    Type: 5 (Redirect)
    Code: 0 (Redirect for network)
    Checksum: 0x7b60 [correct]
    Gateway address: 10.1.1.2 (10.1.1.2)
  - Internet Protocol, Src: 10.1.1.1 (10.1.1.1), Dst: 221.4.159.233 (221.4.159.233)
        Version: 4
        Header length: 20 bytes
      + Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
        Total Length: 104
        Identification: 0x026d (621)
      + Flags: 0x00
        Fragment offset: 0
        Time to live: 127
        Protocol: UDP (0x11)
      + Header checksum: 0xb128 [correct]
        Source: 10.1.1.1 (10.1.1.1)
        Destination: 221.4.159.233 (221.4.159.233)
   - User Datagram Protocol, Src Port: trap (4020), Dst Port: 8805 (8805)
        Source port: trap (4020)
        Destination port: 8805 (8805)
        Length: 84
      + Checksum: 0x422f [unchecked, not all data available]

4. PC收到后,如果可以识别ICMP重定向,他会在本地路由表中加一条32位主机路由,源是60.1.1.1,下一跳不是254,而是253,可以通过“route print”来查看,根据网上的资料,此路由会在本地路由表中存放10分钟,超时后会自动清除。

不过对于现在的系统来说(winxp sp3和win7),都做了相应的保护,一般不会识别ICMP重定向的数据包,因为ICMP重定向与ARP一样可以达到“中间人”攻击,具体的细节我就不说了,可以参考网上的资料。

2011年2月14日更新,更新文章《Layer 3 层网络中的重定向

相关资料:

http://www.godupgod.com/post/92.html

When Are ICMP Redirects Sent?

本文出自 Frank's Blog

版权声明:


本文链接:ICMP 重定向的一些问题
版权声明:本文为原创文章,仅代表个人观点,版权归 Frank Zhao 所有,转载时请注明本文出处及文章链接
你可以留言,或者trackback 从你的网站

No Responses to “ICMP 重定向的一些问题”

  1. […] Peak。关于ICMP重定向的问题,可以参考我之前总结的《ICMP 重定向的一些问题》; […]

  2. in.down说道:

    想问下博主,这种文本的拓扑图是怎么画出来的?有什么工具介绍一下吗?谢谢!

  3. zhaocs说道:

    不好意思,一直在忙,用的是“Email Effects“,可以看下面官网:
    http://www.sigsoftware.com/emaileffects/

  4. in.down说道:

    谢谢!

留言哦

blonde teen swallows load.xxx videos