静态路由配置实验二(途经三台路由设备)
实验拓扑图
PC1/PC2途经三台路由进行不同网段的相互通信
配置步骤
1.路由接口ip配置
路由设备A
R1(config)#int f0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#int fa0/1
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#no shut
路由设备B
R2(config)#int fa 0/0
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no shut
R2(config)#int fa0/1
R2(config-if)#ip add 192.168.3.1 255.255.255.0
R2(config-if)#no shut
路由设备C
Router(config)#int fa0/0
Router(config-if)#ip add 192.168.3.2 255.255.255.0
Router(config-if)#no shut
Router(config)#int fa0/1
Router(config-if)#ip add 192.168.4.1 255.255.255.0
Router(config-if)#no shut
2.配置PC静态ip地址
PC1
PC2
3.三台路由器静态路由配置
RA
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2
R1#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
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
S 192.168.3.0/24 [1/0] via 192.168.2.2
S 192.168.4.0/24 [1/0] via 192.168.3.2
RB
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2
R2#show ip rou --查看路由信息
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.1.0/24 [1/0] via 192.168.2.1
C 192.168.2.0/24 is directly connected, FastEthernet0/0
C 192.168.3.0/24 is directly connected, FastEthernet0/1
S 192.168.4.0/24 [1/0] via 192.168.3.2
RC
R3(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1
R3(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R3#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.1.0/24 [1/0] via 192.168.2.1
S 192.168.2.0/24 [1/0] via 192.168.3.1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, FastEthernet0/1
4.测试路由器之间的连通性
RA ping RB\RC接口地址
RB PingRA\RC接口地址
RC PingRA\RB接口地址
数据包正常发送
5.测试PC是否成功互通
pc1 ping pc2网卡ip地址
pc2 ping pc1 ip地址
静态路由配置成功
总结
关键点:
在进行配置的时候要注意路由器B作为桥梁连接路由A和路由B,去往A和B方向都要设置静态路由;静态路由是一跳一跳进行寻址的,不能由A直接到C,只能先到B,再由B到C,所以在进行路由A和C静态路由添加时需要注意下一跳地址是从最近路由B开始的