拓扑图
使用静态路由协议来实现不同网段间的通信
首先为路由器的接口设置IP地址
router 1 的配置
Router>en
Router#conf t
Router(config)#int s0/1/0
Router(config-if)#ip addr 192.168.10.1 255.255.255.0
Router(config-if)#no shu
进入虚拟接口 L0
Router(config)#int l0
Router(config-if)#ip addr 192.168.1.1 255.255.255.0
Router(config-if)#exit
router 2 的配置
Router>en
Router#conf t
Router(config)#int s0/0/0
Router(config-if)#ip addr 193.168.10.2 255.255.255.0
Router(config-if)#clock rate 64000
Router(config-if)#no shu
Router(config)#int s0/0/1
Router(config-if)#ip addr 193.168.20.1 255.255.255.0
Router(config-if)#clock rate 64000
Router(config-if)#no shu
进入虚拟接口
Router(config)#int l0
Router(config-if)#ip addr 192.168.2.1 255.255.255.0
Router(config-if)#exit
router 3 的配置
Router>en
Router#conf t
Router(config)#int s0/0/0
Router(config-if)#ip addr 192.168.20.2 255.255.255.0
Router(config-if)#no shu
进入虚拟接口
Router(config)#int l0
Router(config-if)#ip addr 192.168.3.1 255.255.255.0
Router(config-if)#exit
IP地址配置完成后为路由器配置静态路由
由于router 1和3 属于边缘路由所以只需要配置缺省路由即可
router 1
Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.2
router 3
Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.20.1
router 2
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.10.1Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.20.2
查看路由表
router 1
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 192.168.10.2 to network 0.0.0.0 C 192.168.1.0/24 is directly connected, Loopback0 C 192.168.10.0/24 is directly connected, Serial0/1/0 S* 0.0.0.0/0 [1/0] via 192.168.10.2 使用 router 1 ping router 3 Router#ping 192.168.3.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/7/11 ms 可以通信,静态路由配置完成转载于:https://www.cnblogs.com/knightysa/p/9187335.html