本文已参与「新人创作礼」活动,一起开启掘金创作之路。
一、静态路由背景
静态路由指由网络管理员手动配置的路由条目,适用于对系统要求低的简单小型网络,与动态路由相比,其不能自适应网络变化,需人为干预。
二、实验拓扑
实验说明:实验效果为每台设备可到达其它设备的loopback接口的IP
三、实验步骤
步骤一: 如图配置路由器的IP地址
对R1:
[R1]int lo 0
[R1-LoopBack0]ip address 1.1.1.1 32
[R1-LoopBack0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
对R2:
[R2]int lo0
[R2-LoopBack0]ip address 2.2.2.2 32
[R2-LoopBack0]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.1.2 24
对R3:
[R3]int lo0
[R3-LoopBack0]ip address 3.3.3.3 32
[R3-LoopBack0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.1.3 24
对R4:
[R4]int lo0
[R4-LoopBack0]ip address 4.4.4.4 32
[R4-LoopBack0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.1.4 24
步骤二:进行静态路由配置
对R1:
[R1]ip route-static 2.2.2.2 32 192.168.1.2
[R1]ip route-static 3.3.3.3 32 192.168.1.3
[R1]ip route-static 4.4.4.4 32 192.168.1.4
对R2:
[R2]ip route-static 1.1.1.1 32 192.168.1.1
[R2]ip route-static 3.3.3.3 32 192.168.1.3
[R2]ip route-static 4.4.4.4 32 192.168.1.4
对R3:
[R3]ip route-static 1.1.1.1 32 192.168.1.1
[R3]ip route-static 2.2.2.2 32 192.168.1.2
[R3]ip route-static 4.4.4.4 32 192.168.1.4
对R4:
[R4]ip route-static 1.1.1.1 32 192.168.1.1
[R4]ip route-static 2.2.2.2 32 192.168.1.2
[R4]ip route-static 3.3.3.3 32 192.168.1.3
四、验证:路由器的loopback接口可互相通信(这里以R1为例)
对R1:
[R1]ping 2.2.2.2
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=50 ms
Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=60 ms
Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=50 ms
Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 2.2.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/48/60 ms
[R1]ping 3.3.3.3
PING 3.3.3.3: 56 data bytes, press CTRL_C to break
Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=255 time=110 ms
Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=70 ms
Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=50 ms
Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 3.3.3.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/60/110 ms
[R1]ping 4.4.4.4
PING 4.4.4.4: 56 data bytes, press CTRL_C to break
Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=255 time=90 ms
Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=255 time=50 ms
Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=255 time=40 ms
Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=255 time=60 ms
Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=255 time=60 ms
--- 4.4.4.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/60/90 ms