Router1 S1/0 <----> Router2 S2/0
Router2 S1/0 <----> Router3 S2/0
Router3 S1/0 <----> Router1 S2/0
一:配置IP
R1:
interface ser 1/0
ip addr 1.1.1.1 255.255.255.0
no shut
inter ser 2/0
ip add 10.1.1.1 255.255.255.0
no shut
R2:
interface ser 2/0
ip addr 1.1.1.2 255.255.255.0
no shut
inter ser 1/0
ip addr 2.2.2.2 255.255.255.0
no shut
R3:
interface s 2/0
ip add 2.2.2.3 255.255.255.0
no shut
inter s 1/0
ip addr 10.1.1.3 255.255.255.0
no shut
二:路由的配置。
R1:
ip route 2.0.0.0 255.0.0.0 10.1.1.3
R2:
ip route 10.0.0.0 255.0.0.0 1.1.1.1
ip route 10.0.0.0 255.0.0.0 2.2.2.3 10
R3:
ip route 1.0.0.0 255.0.0.0 10.1.1.1
这是一个让人倍感纠结的路由表。
不过看来在R1上ping 10.1.1.3是可以通的。
现在做ACL
access-list 1 permit any
R2:现在ping R3上的10.1.1.3
R2#
*Mar 1 00:26:28.343: IP: tableid=0, s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), routed via FIB
*Mar 1 00:26:28.343: IP: s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), len 100, sending
*Mar 1 00:26:28.459: IP: tableid=0, s=10.1.1.3 (Serial2/0), d=1.1.1.2 (Serial2/0), routed via RIB
*Mar 1 00:26:28.459: IP: s=10.1.1.3 (Serial2/0), d=1.1.1.2 (Serial2/0), len 100, rcvd 3
*Mar 1 00:26:28.463: IP: tableid=0, s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), routed via FIB
*Mar 1 00:26:28.463: IP: s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), len 100, sending
*Mar 1 00:26:28.507: IP: tableid=0, s=10.1.1.3 (Serial2/0), d=1.1.1.2 (Serial2/0), routed via RIB
*Mar 1 00:26:28.507: IP: s=10.1.1.3 (Serial2/0), d=1.1.1.2 (Serial2/0), len 100, rcvd 3
*Mar 1 00:26:28.519: IP: tableid=0, s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), routed via FIB
*Mar 1 00:26:28.519: IP: s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), len 100, sending
*Mar 1 00:26:28.531: IP: tableid=0, s=10.1.1.3 (Serial2/0), d=1.1.1
R2#.2 (Serial2/0), routed via RIB
*Mar 1 00:26:28.531: IP: s=10.1.1.3 (Serial2/0), d=1.1.1.2 (Serial2/0), len 100, rcvd 3
*Mar 1 00:26:28.535: IP: tableid=0, s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), routed via FIB
*Mar 1 00:26:28.535: IP: s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), len 100, sending
*Mar 1 00:26:28.647: IP: tableid=0, s=10.1.1.3 (Serial2/0), d=1.1.1.2 (Serial2/0), routed via RIB
*Mar 1 00:26:28.651: IP: s=10.1.1.3 (Serial2/0), d=1.1.1.2 (Serial2/0), len 100, rcvd 3
*Mar 1 00:26:28.655: IP: tableid=0, s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), routed via FIB
*Mar 1 00:26:28.655: IP: s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), len 100, sending
*Mar 1 00:26:28.671: IP: tableid=0, s=10.1.1.3 (Serial2/0), d=1.1.1.2 (Serial2/0), routed via RIB
*Mar 1 00:26:28.671: IP: s=10.1.1.3 (Serial2/0), d=1.1.1.2 (Serial2/0), len 100, rcvd 3
可以看到数据是从S2、0口出去的,绕的R1再到的R3.
现在我们到R1关掉S1、0口。
R1的S1.0口d掉后。R2的S2、0口几秒后也D掉了。
R2#ping 10.1.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.3, timeout is 2 seconds:
*Mar 1 00:29:09.551: IP: tableid=0, s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), routed via FIB
*Mar 1 00:29:09.551: IP: s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), len 100, sending.
*Mar 1 00:29:11.551: IP: tableid=0, s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), routed via FIB
*Mar 1 00:29:11.551: IP: s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), len 100, sending.
*Mar 1 00:29:13.551: IP: tableid=0, s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), routed via FIB
*Mar 1 00:29:13.551: IP: s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), len 100, sending.
*Mar 1 00:29:15.551: IP: tableid=0, s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), routed via FIB
*Mar 1 00:29:15.551: IP: s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), len 100, sending.
*Mar 1 00:29:17.551: IP: tableid=0, s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), routed via FIB
*Mar 1 00:29:17.551: IP: s=1.1.1.2 (local), d=10.1.1.3 (Serial2/0), len 100, sending.
Success rate is 0 percent (0/5)
R2#
*Mar 1 00:29:19.523: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to down
R2#ping 10.1.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/59/184 ms
R2#
*Mar 1 00:29:27.063: IP: tableid=0, s=2.2.2.2 (local), d=10.1.1.3 (Serial1/0), routed via FIB
*Mar 1 00:29:27.067: IP: s=2.2.2.2 (local), d=10.1.1.3 (Serial1/0), len 100, sending
*Mar 1 00:29:27.243: IP: tableid=0, s=10.1.1.3 (Serial1/0), d=2.2.2.2 (Serial1/0), routed via RIB
*Mar 1 00:29:27.243: IP: s=10.1.1.3 (Serial1/0), d=2.2.2.2 (Serial1/0), len 100, rcvd 3
*Mar 1 00:29:27.247: IP: tableid=0, s=2.2.2.2 (local), d=10.1.1.3 (Serial1/0), routed via FIB
*Mar 1 00:29:27.247: IP: s=2.2.2.2 (local), d=10.1.1.3 (Serial1/0), len 100, sending
*Mar 1 00:29:27.311: IP: tableid=0, s=10.1.1.3 (Serial1/0), d=2.2.2.2 (Serial1/0), routed via RIB
*Mar 1 00:29:27.315: IP: s=10.1.1.3 (Serial1/0), d=2.2.2.2 (Serial1/0), len 100, rcvd 3
*Mar 1 00:29:27.319: IP: tableid=0, s=2.2.2.2 (local), d=10.1.1.3 (Serial1/0), routed via FIB
*Mar 1 00:29:27.319: IP: s=2.2.2.2 (local), d=10.1.1.3 (Serial1/0), len 100, sending
*Mar 1 00:29:27.343: IP: tableid=0, s=10.1.1.3 (Serial1/0), d=2.2.2
R2#.2 (Serial1/0), routed via RIB
*Mar 1 00:29:27.343: IP: s=10.1.1.3 (Serial1/0), d=2.2.2.2 (Serial1/0), len 100, rcvd 3
*Mar 1 00:29:27.343: IP: tableid=0, s=2.2.2.2 (local), d=10.1.1.3 (Serial1/0), routed via FIB
*Mar 1 00:29:27.343: IP: s=2.2.2.2 (local), d=10.1.1.3 (Serial1/0), len 100, sending
*Mar 1 00:29:27.351: IP: tableid=0, s=10.1.1.3 (Serial1/0), d=2.2.2.2 (Serial1/0), routed via RIB
*Mar 1 00:29:27.355: IP: s=10.1.1.3 (Serial1/0), d=2.2.2.2 (Serial1/0), len 100, rcvd 3
*Mar 1 00:29:27.355: IP: tableid=0, s=2.2.2.2 (local), d=10.1.1.3 (Serial1/0), routed via FIB
*Mar 1 00:29:27.355: IP: s=2.2.2.2 (local), d=10.1.1.3 (Serial1/0), len 100, sending
*Mar 1 00:29:27.363: IP: tableid=0, s=10.1.1.3 (Serial1/0), d=2.2.2.2 (Serial1/0), routed via RIB
*Mar 1 00:29:27.363: IP: s=10.1.1.3 (Serial1/0), d=2.2.2.2 (Serial1/0), len 100, rcvd 3
这里我们可以看到,浮动静态路由并不是即可生效的。
总结:
其实所谓的静态路由不过就是由两条静态路由组成,然后在第二条或第x条后加一个管理距离罢了。