[R1]int e3/0/0 //进入接口
[R1-Ethernet3/0/0]ip address 192.168.10.1 255.255.255.0
[R1-Ethernet3/0/0]int s4/0/0
[R1-Serial4/0/0]ip address 192.168.11.1 24
[R2]int s4/0/0
[R2-Serial4/0/0]ip address 192.168.11.2 24
[R2-Serial4/0/0]int s4/0/1
[R2-Serial4/0/1]ip address 192.168.12.2 255.255.255.0
[R3]int s4/0/1
[R3-Serial4/0/1]ip address 192.168.12.3 24
[R3-Serial4/0/1]int e3/0/0
[R3-Ethernet3/0/0]ip address 192.168.20.3 24
//查看R1上的路由表
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.10.0/24 Direct 0 0 D 192.168.10.1 Ethernet3/0/0
192.168.10.1/32 Direct 0 0 D 127.0.0.1 Ethernet3/0/0
192.168.10.255/32 Direct 0 0 D 127.0.0.1 Ethernet3/0/0
192.168.11.0/24 Direct 0 0 D 192.168.11.1 Serial4/0/0
192.168.11.1/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
192.168.11.2/32 Direct 0 0 D 192.168.11.2 Serial4/0/0
192.168.11.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R1]ip route-static 192.168.20.0 255.255.255.0 192.168.11.2
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.10.0/24 Direct 0 0 D 192.168.10.1 Ethernet3/0/0
192.168.10.1/32 Direct 0 0 D 127.0.0.1 Ethernet3/0/0
192.168.10.255/32 Direct 0 0 D 127.0.0.1 Ethernet3/0/0
192.168.11.0/24 Direct 0 0 D 192.168.11.1 Serial4/0/0
192.168.11.1/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
192.168.11.2/32 Direct 0 0 D 192.168.11.2 Serial4/0/0
192.168.11.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
192.168.20.0/24 Static 60 0 RD 192.168.11.2 Serial4/0/0 //此处
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R2]ip route-static 192.168.20.0 255.255.255.0 192.168.12.3
[R2]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.11.0/24 Direct 0 0 D 192.168.11.2 Serial4/0/0
192.168.11.1/32 Direct 0 0 D 192.168.11.1 Serial4/0/0
192.168.11.2/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
192.168.11.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
192.168.12.0/24 Direct 0 0 D 192.168.12.2 Serial4/0/1
192.168.12.2/32 Direct 0 0 D 127.0.0.1 Serial4/0/1
192.168.12.3/32 Direct 0 0 D 192.168.12.3 Serial4/0/1
192.168.12.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/1
192.168.20.0/24 Static 60 0 RD 192.168.12.3 Serial4/0/1 //此处
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R3]ip route-static 192.168.10.0 24 192.168.12.2
[R2]ip route-static 192.168.10.0 24 192.168.11.1
//下面配置一条默认路由,即:目的网段和掩码为全0,表示任何网络,下一跳和出接口都一致。
[R1]ip route-static 0.0.0.0 0 192.168.11.2 //添加默认路由
[R1]undo ip route-static 192.168.20.0 24 192.168.11.2 //删除此条静态路由
[R1]undo ip route-static 192.168.12.0 24 192.168.11.2
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 192.168.11.2 Serial4/0/0 //此处
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.10.0/24 Direct 0 0 D 192.168.10.1 Ethernet3/0/0
192.168.10.1/32 Direct 0 0 D 127.0.0.1 Ethernet3/0/0
192.168.10.255/32 Direct 0 0 D 127.0.0.1 Ethernet3/0/0
192.168.11.0/24 Direct 0 0 D 192.168.11.1 Serial4/0/0
192.168.11.1/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
192.168.11.2/32 Direct 0 0 D 192.168.11.2 Serial4/0/0
192.168.11.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R3]ip route-static 0.0.0.0 0 192.168.12.2
[R3]undo ip route-static 192.168.10.0 24 192.168.12.2
[R3]undo ip route-static 192.168.11.0 24 192.168.12.2
[R3]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 192.168.12.2 Serial4/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.12.0/24 Direct 0 0 D 192.168.12.3 Serial4/0/1
192.168.12.2/32 Direct 0 0 D 192.168.12.2 Serial4/0/1
192.168.12.3/32 Direct 0 0 D 127.0.0.1 Serial4/0/1
192.168.12.255/32 Direct 0 0 D 127.0.0.1 Serial4/0/1
192.168.20.0/24 Direct 0 0 D 192.168.20.3 Ethernet3/0/0
192.168.20.3/32 Direct 0 0 D 127.0.0.1 Ethernet3/0/0
192.168.20.255/32 Direct 0 0 D 127.0.0.1 Ethernet3/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0