一.測試拓撲
二.基本配置
1.Win7的一個網卡配置兩個網段的IP
2.R1路由器
hostname R1
interface Ethernet0/0
ip address 192.168.10.8 255.255.255.0
no shutdown
3.R2路由器
hostname R2
interface Ethernet0/0
ip address 202.100.1.8 255.255.255.0
no shutdown
三.路由器配置
1.Win7開啓路由轉發
2.R1配置默認路由或靜態路由
ip route 0.0.0.0 0.0.0.0 192.168.10.10
或者
ip route 202.100.1.0 255.255.255.0 192.168.10.10
3.R2配置默認路由或靜態路由
ip route 0.0.0.0 0.0.0.0 202.100.1.10
或者
ip route 192.168.1.0 255.255.255.0 202.100.1.10
四.測試
1.由於Win7沒有關閉防火牆,因此R1沒法ping通Win7的直連地址
R1#ping 202.100.1.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.100.1.10, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R1#
2.R1能夠ping通R2的地址
R1#ping 202.100.1.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.100.1.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
R1#
3.若是提早在R2上開啓debug,能夠看到顯示的日誌
R2#debug ip icmp
ICMP packet debugging is on
Dec 9 02:44:09.989: ICMP: echo reply sent, src 202.100.1.8, dst 192.168.10.8, topology BASE, dscp 0 topoid 0
Dec 9 02:44:09.989: ICMP: bogus redirect from 202.100.1.10 - for 192.168.10.8 use gw 192.168.10.8
Dec 9 02:44:09.989: gateway address on different subnet
Dec 9 02:44:09.989: ICMP: echo reply sent, src 202.100.1.8, dst 192.168.10.8, topology BASE, dscp 0 topoid 0
Dec 9 02:44:09.990: ICMP: echo reply sent, src 202.100.1.8, dst 192.168.10.8, topology BASE, dscp 0 topoid 0
Dec 9 02:44:09.990: ICMP: echo reply sent, src 202.100.1.8, dst 192.168.10.8, topology BASE, dscp 0 topoid 0
R2#
*Dec 9 02:44:09.991: ICMP: echo reply sent, src 202.100.1.8, dst 192.168.10.8, topology BASE, dscp 0 topoid 0
R2#
備註:從日誌能夠看出,由於數據包從Win7相同網卡進出,因此Win7發出了網絡重定向的ICMP包,可是R2收到以後,由於判斷地址與本身的地址不在相同網段,因此忽略掉了。網絡