静态路由协议特征:
实验拓扑:
实验拓扑图
实验目的:
配置静态路由协议
实验环境:
Cisco ios c7200
实验规划:
R1: s1/0:12.1.1.1/24 loopback0: 1.1.1.1/24
R2: s1/1:12.1.1.2/24 s1/0:23.1.1.2/24 loopback0: 2.2.2.2/24
R3: s1/1:23.1.1.3/24 s1/0: 34.1.1.3/24 loopback0: 3.3.3.3/24
R4:s1/1: 34.1.1.4/24 s1/0:45.1.1.4/24 loopback0: 4.4.4.4/24
R5: s1/1: 45.1.1.5/24 loopback0: 5.5.5.5/24
实验步骤:
1:基本环境搭建
2:配置静态路由协议
3:测试网络得出结论
步骤1:基本环境搭建
在R1为接口设置指定的IP地址
R1#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface serial 1/0
R1(config-if)#ip address 12.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#exit
查看R1所有接口的信息
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
Serial1/0 12.1.1.1 YES manual up up
Serial1/1 unassigned YES unset administratively down down
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
Loopback0 1.1.1.1 YES manual up up
在R2为接口设置指定的IP地址
R2#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#interface serial 1/1
R2(config-if)#ip address 12.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface serial 1/0
R2(config-if)#ip address 23.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#exit
查看R2所有接口的信息
R2#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
Serial1/0 23.1.1.2 YES manual up up
Serial1/1 12.1.1.2 YES manual up up
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
Loopback0 2.2.2.2 YES manual up up
在R3为接口设置指定的IP地址
R3#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#interface serial 1/1
R3(config-if)#ip address 23.1.1.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface serial 1/0
R3(config-if)#ip address 34.1.1.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#exit
查看R3所有接口的信息
R3#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
Serial1/0 34.1.1.3 YES manual up up
Serial1/1 23.1.1.3 YES manual up up
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
Loopback0 3.3.3.3 YES manual up up
在R4为接口设置指定的IP地址
R4#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#interface serial 1/1
R4(config-if)#ip address 34.1.1.4 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config)#interface serial 1/0
R4(config-if)#ip address 45.1.1.4 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config)#interface loopback 0
R4(config-if)#ip address 4.4.4.4 255.255.255.0
R4(config-if)#exit
查看R4所有接口信息
R4#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
Serial1/0 45.1.1.4 YES manual up up
Serial1/1 34.1.1.4 YES manual up up
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
Loopback0 4.4.4.4 YES manual up up
在R5为接口设置指定的IP地址
R5#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
R5(config)#interface serial 1/1
R5(config-if)#ip address 45.1.1.5 255.255.255.0
R5(config-if)#no shutdown
R5(config-if)#exit
R5(config)#interface loopback 0
R5(config-if)#ip address 5.5.5.5 255.255.255.0
R5(config-if)#exit
查看R5所有接口信息
R5#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
Serial1/0 unassigned YES unset administratively down down
Serial1/1 45.1.1.5 YES manual up up
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
Loopback0 5.5.5.5 YES manual up up
步骤2:配置静态路由协议
静态路由协议实际上就是通过出接口或下一跳映射过来的远程网络。
在R1配置静态路由协议,通过R1本身的出接口或下一跳路由器将整个拓扑的网络分别映射到本地来,加入到数据库,,即路由表
R1(config)#ip route 23.1.1.0 255.255.255.0 12.1.1.2
R1(config)#ip route 2.2.2.2 255.255.255.255 s1/0
R1(config)#ip route 34.1.1.0 255.255.255.0 12.1.1.2
R1(config)#ip route 3.3.3.3 255.255.255.255 s1/0
R1(config)#ip route 45.1.1.0 255.255.255.0 12.1.1.2
R1(config)#ip route 4.4.4.4 255.255.255.0 s1/0
R1(config)#ip route 4.4.4.4 255.255.255.255 s1/0
R1(config)#ip route 5.5.5.5 255.255.255.255 s1/0
查看R1的路由表,查看结果R1已经将整个网络拓扑的网络分别映射到本地路由表中
R1#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
34.0.0.0/24 is subnetted, 1 subnets
S 34.1.1.0 [1/0] via 12.1.1.2
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
S 2.2.2.2 is directly connected, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
S 3.3.3.3 is directly connected, Serial1/0
4.0.0.0/32 is subnetted, 1 subnets
S 4.4.4.4 is directly connected, Serial1/0
5.0.0.0/32 is subnetted, 1 subnets
S 5.5.5.5 is directly connected, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
S 23.1.1.0 [1/0] via 12.1.1.2
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
45.0.0.0/24 is subnetted, 1 subnets
S 45.1.1.0 [1/0] via 12.1.1.2
在R2配置静态路由协议,通过R2本身的出接口或下一跳路由器将整个拓扑的网络分别映射到本地来
R2(config)#ip route 1.1.1.1 255.255.255.255 s1/1
R2(config)#ip route 3.3.3.3 255.255.255.255 s1/0
R2(config)#ip route 34.1.1.0 255.255.255.0 23.1.1.3
R2(config)#ip route 4.4.4.4 255.255.255.255 s1/0
R2(config)#ip route 45.1.1.0 255.255.255.0 23.1.1.3
R2(config)#ip route 5.5.5.5 255.255.255.255 s1/0
查看R2的路由表,查看结果显示已经将整个网络拓扑的网络映射到本地路由表中
R2#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
34.0.0.0/24 is subnetted, 1 subnets
S 34.1.1.0 [1/0] via 23.1.1.3
1.0.0.0/32 is subnetted, 1 subnets
S 1.1.1.1 is directly connected, Serial1/1
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
S 3.3.3.3 is directly connected, Serial1/0
4.0.0.0/32 is subnetted, 1 subnets
S 4.4.4.4 is directly connected, Serial1/0
5.0.0.0/32 is subnetted, 1 subnets
S 5.5.5.5 is directly connected, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/1
45.0.0.0/24 is subnetted, 1 subnets
S 45.1.1.0 [1/0] via 23.1.1.3
在R3配置静态路由协议,通过R3本身的出接口或下一跳路由器将整个拓扑的网络分别映射到本地来
R3(config)#ip route 1.1.1.1 255.255.255.255 s1/1
R3(config)#ip route 12.1.1.0 255.255.255.0 23.1.1.2
R3(config)#ip route 2.2.2.2 255.255.255.255 s1/1
R3(config)#ip route 4.4.4.4 255.255.255.255 s1/0
R3(config)#ip route 45.1.1.0 255.255.255.0 34.1.1.4
R3(config)#ip route 5.5.5.5 255.255.255.255 s1/0
查看R3的路由表,已经将整个拓扑的网络映射到本地中来
R3#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
34.0.0.0/24 is subnetted, 1 subnets
C 34.1.1.0 is directly connected, Serial1/0
1.0.0.0/32 is subnetted, 1 subnets
S 1.1.1.1 is directly connected, Serial1/1
2.0.0.0/32 is subnetted, 1 subnets
S 2.2.2.2 is directly connected, Serial1/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
S 4.4.4.4 is directly connected, Serial1/0
5.0.0.0/32 is subnetted, 1 subnets
S 5.5.5.5 is directly connected, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
S 12.1.1.0 [1/0] via 23.1.1.2
45.0.0.0/24 is subnetted, 1 subnets
S 45.1.1.0 [1/0] via 34.1.1.4
在R4配置静态路由协议,通过R4本身的出接口或下一跳路由器将整个拓扑的网络分别映射到本地来
R4(config)#ip route 1.1.1.1 255.255.255.255 s1/1
R4(config)#ip route 12.1.1.0 255.255.255.0 34.1.1.3
R4(config)#ip route 2.2.2.2 255.255.255.255 s1/1
R4(config)#ip route 23.1.1.0 255.255.255.0 34.1.1.3
R4(config)#ip route 3.3.3.3 255.255.255.255 s1/1
R4(config)#ip route 5.5.5.5 255.255.255.255 s1/0
查看路由表,已经将整个拓扑的网络映射到本地路由表中
R4#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
34.0.0.0/24 is subnetted, 1 subnets
C 34.1.1.0 is directly connected, Serial1/1
1.0.0.0/32 is subnetted, 1 subnets
S 1.1.1.1 is directly connected, Serial1/1
2.0.0.0/32 is subnetted, 1 subnets
S 2.2.2.2 is directly connected, Serial1/1
3.0.0.0/32 is subnetted, 1 subnets
S 3.3.3.3 is directly connected, Serial1/1
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
5.0.0.0/32 is subnetted, 1 subnets
S 5.5.5.5 is directly connected, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
S 23.1.1.0 [1/0] via 34.1.1.3
12.0.0.0/24 is subnetted, 1 subnets
S 12.1.1.0 [1/0] via 34.1.1.3
45.0.0.0/24 is subnetted, 1 subnets
C 45.1.1.0 is directly connected, Serial1/0
在R5配置静态路由协议,通过R5本身的出接口或下一跳路由器将整个拓扑的网络分别映射到本地来
R5(config)#ip route 4.4.4.4 255.255.255.255 s1/1
R5(config)#ip route 34.1.1.0 255.255.255.0 45.1.1.4
R5(config)#ip route 3.3.3.3 255.255.255.255 s1/1
R5(config)#ip route 23.1.1.0 255.255.255.0 45.1.1.4
R5(config)#ip route 2.2.2.2 255.255.255.255 s1/1
R5(config)#ip route 12.1.1.0 255.255.255.0 45.1.1.4
R5(config)#ip route 1.1.1.1 255.255.255.255 s1/1
查看R5的路由表,已经将整个拓扑的网络映射到路由表中
R5#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
34.0.0.0/24 is subnetted, 1 subnets
S 34.1.1.0 [1/0] via 45.1.1.4
1.0.0.0/32 is subnetted, 1 subnets
S 1.1.1.1 is directly connected, Serial1/1
2.0.0.0/32 is subnetted, 1 subnets
S 2.2.2.2 is directly connected, Serial1/1
3.0.0.0/32 is subnetted, 1 subnets
S 3.3.3.3 is directly connected, Serial1/1
4.0.0.0/32 is subnetted, 1 subnets
S 4.4.4.4 is directly connected, Serial1/1
5.0.0.0/24 is subnetted, 1 subnets
C 5.5.5.0 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
S 23.1.1.0 [1/0] via 45.1.1.4
12.0.0.0/24 is subnetted, 1 subnets
S 12.1.1.0 [1/0] via 45.1.1.4
45.0.0.0/24 is subnetted, 1 subnets
C 45.1.1.0 is directly connected, Serial1/1
步骤3:测试网络得出结论
整个网络节点分别配置了静态路由协议,接下来验证整个网络是否互通。
使用ping命令来检测网络通信是否连通
R1的回环接口1.1.1.1 ping R5的45.1.1.5地址,检测结果为!,证明可以通信
R1#ping 45.1.1.5 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 45.1.1.5, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 156/206/252 ms
使用traceroute命令检测当前节点到目的地址的路径信息
R1 traceroute R5,显示结果为,R1到达R5,共经过4跳,分别如下
R1#traceroute 45.1.1.5
Type escape sequence to abort.
Tracing the route to 45.1.1.5
1 12.1.1.2 72 msec 40 msec 32 msec
2 23.1.1.3 64 msec 60 msec 64 msec
3 34.1.1.4 140 msec 136 msec 124 msec
4 45.1.1.5 136 msec 140 msec 168 msec
同理,R5也使用ping命令检测是否可以和R1通信,检测结果显示,可以通信
R5#ping 12.1.1.1 source 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 5.5.5.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 108/147/176 ms
R5也使用traceroute命令检测当前节点到达目的地址的路径信息
R5#traceroute 12.1.1.1
Type escape sequence to abort.
Tracing the route to 12.1.1.1
1 45.1.1.4 64 msec 32 msec 32 msec
2 34.1.1.3 76 msec 112 msec 56 msec
3 23.1.1.2 48 msec 172 msec 76 msec
4 12.1.1.1 124 msec 112 msec 172 msec
点点关注·持续更新