学会在接口配置地址,创建Loopback接口,通过配置静态路由范围设备的Loopback接口。
一、网络拓扑
二、IP地址规划
路由器 | 接口 | 地址 |
R1 | GE 0/0/0 | 10.0.12.1/24 |
R1 | GE 0/0/1 | 10.0.13.1/24 |
R1 | LoopBack0 | 10.0.1.1/32 |
R2 | GE 0/0/0 | 10.0.12.2/24 |
R2 | GE 0/0/2 | 10.0.23.2/24 |
R2 | LoopBack0 | 10.0.1.2/32 |
R3 | GE 0/0/1 | 10.0.13.3/24 |
R3 | GE 0/0/2 | 10.0.23.3/24 |
R3 | LoopBack0 | 10.0.1.3/32 |
三、配置
1、R1路由器
接口配置
#
interface GigabitEthernet0/0/0
ip address 10.0.12.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.13.1 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 10.0.1.1 255.255.255.255
#
路由配置
#
ip route-static 10.0.1.2 255.255.255.255 10.0.12.2
ip route-static 10.0.1.3 255.255.255.255 10.0.13.3
#
2、R2路由器
接口配置
#
interface GigabitEthernet0/0/0
ip address 10.0.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
ip address 10.0.23.2 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 10.0.1.2 255.255.255.255
#
路由配置
#
ip route-static 10.0.1.1 255.255.255.255 10.0.12.1
ip route-static 10.0.1.3 255.255.255.255 10.0.23.3
#
3、R3路由器
接口配置
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/1
ip address 10.0.13.3 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 10.0.23.3 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 10.0.1.3 255.255.255.255
#
路由配置
#
ip route-static 10.0.1.1 255.255.255.255 10.0.13.1
ip route-static 10.0.1.2 255.255.255.255 10.0.23.2
#
四、测试
R1上ping测试R2的loopback接口
[R1]ping 10.0.1.2
PING 10.0.1.2: 56 data bytes, press CTRL_C to break
Reply from 10.0.1.2: bytes=56 Sequence=1 ttl=255 time=110 ms
Reply from 10.0.1.2: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 10.0.1.2: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 10.0.1.2: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 10.0.1.2: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 10.0.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/42/110 ms
R1上ping测试R3的loopback接口
[R1]ping 10.0.1.3
PING 10.0.1.3: 56 data bytes, press CTRL_C to break
Reply from 10.0.1.3: bytes=56 Sequence=1 ttl=255 time=60 ms
Reply from 10.0.1.3: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 10.0.1.3: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 10.0.1.3: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 10.0.1.3: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 10.0.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/32/60 ms