实验目的
掌握接口 IPv4 地址的配置方法
理解 LoopBack 接口的作用与含义
理解直连路由的产生原则
掌握静态路由的配置方法并理解其生效的条件
掌握通过 PING 工具测试网络层联通性
掌握并理解特殊静态路由的配置方法与应用场景

配置路由物理接口的 IP 地址
R1:
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.0.12.1 255.255.255.0
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/0]ip address 10.0.12.2 255.255.255.0
R2:
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.0.12.2 255.255.255.0
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/0]ip address 10.0.23.2 255.255.255.0
R3:
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.0.23.3 255.255.255.0
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/0]ip address 10.0.13.3 255.255.255.0
配置设备的 LoopBack 接口
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 10.0.1.1 255.255.255.255
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 10.0.1.2 255.255.255.255
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 10.0.1.3 255.255.255.255
配置静态路由
R1:
[R1]ip route-static 10.0.1.2 32 10.0.12.2
[R1]ip route-static 10.0.1.3 32 10.0.13.3
R2:
[R2]ip route-static 10.0.1.1 32 10.0.12.1


配置 R1->R3->R2 作为 R1 的 LoopBack0 到 R2 的 LoopBack0 接口的备份路径


通过默认路由实现 R1 的 LoopBack0 接口和 R2 的 LoopBack0 接口互联互通

[R1]ip route-static 10.0.1.2 32 10.0.13.3 preference 100
[R2]ip route-static 10.0.1.1 32 10.0.23.3 preference 100
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]shutdown
[R1-GigabitEthernet0/0/0]ping -a 10.0.1.1 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=254 time=40 ms
Reply from 10.0.1.2: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 10.0.1.2: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 10.0.1.2: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 10.0.1.2: bytes=56 Sequence=5 ttl=254 time=30 ms
[R1-GigabitEthernet0/0/0]tracert -a 10.0.1.1 10.0.1.2
traceroute to 10.0.1.2(
10.0.1.2), max hops: 30 ,packet length: 40,press CTRL_C to break
1 10.0.13.3 30 ms 20 ms 20 ms
2 10.0.23.2 30 ms 30 ms 20 ms[R1]undo ip route-static 10.0.1.2 255.255.255.255 10.0.12.2
[R1]undo ip route-static 10.0.1.2 255.255.255.255 10.0.13.3 preference 100
[R1]ip route-static 0.0.0.0 0 10.0.12.2
[R1]ping -a 10.0.1.1 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=20 ms
Reply from 10.0.1.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 10.0.1.2: bytes=56 Sequence=3 ttl=255 time=30 ms