静态路由配置
拓朴结构
在Router1上配置全部代码
Router>enable
Router#conf
Router(config)#int f0/0
Router(config-if)#ip address 192.168.0.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#int s2/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.2
Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.1.2
Router(config)#
在Router2上的全部配置代码
Router>enable
Router#conf
Router(config)#int s2/0
Router(config-if)#ip address 192.168.1.2 255.255.255.0
Router(config-if)#clock rate 128000
Router(config-if)#no shutdown
Router(config-if)#int s3/0
Router(config-if)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#ip route 192.168.0.0 255.255.255.0 192.168.1.1
Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
在Router3上的全部配置代码
Router>enable
Router#conf
Router(config)#int s3/0
Router(config-if)#ip address 192.168.2.2 255.255.255.0
Router(config-if)#clock rate 128000
Router(config-if)#no shutdown
Router(config-if)#int f0/0
Router(config-if)#ip address 192.168.3.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#ip route 192.168.0.0 255.255.255.0 192.168.2.1
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
Router(config)#exit
Router#
这时可以在三个路由器的特权模式下:show ip route
Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
S 192.168.0.0/24 [1/0] via 192.168.2.1
S 192.168.1.0/24 [1/0] via 192.168.2.1
C 192.168.2.0/24 is directly connected, Serial3/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
pc4 ip配置
pc5 ip配置
测试连通性
使用pc5 ping pc4测试