提前思考:如果我们使用网络自动化进行运维?改如何进行呢。。
2.1实验一:IPv4编址及IPv4路由基础实验
2.1.1实验介绍
2.1.1.1关于本实验
IPv4(Internet Protocol Version4)是TCP/IP协议族中最为核心的协议之一。它工作在TCP/IP参考模型的网际互联层,该层与OSI参考模型的网络层相对应。网络层提供了无连接数据传输服务,即网络在发送分组时不需要先建立连接,每一个分组(也就是IP数据报文)独立发送。
路由是数据通信网络中最基本的要素。路由信息就是指导IP报文发送的路径信息,路由的过程就是报文转发的过程。
本实验将通过IPv4地址以及IPv4静态路由的配置,帮助学员理解路由转发的基本原理。
2.1.1.2实验目的
掌握接口IPv4地址的配置方法
理解LoopBack接口的作用与含义
理解直连路由的产生原则
掌握静态路由的配置方法并理解其生效的条件
掌握通过PING工具测试网络层联通性
掌握并理解特殊静态路由的配置方法与应用场景
2.1.1.3实验组网介绍
IPv4编址及IPv4路由基础实验拓扑
2.1.1.4实验背景
R1、R2、R3都是各自网络的网关设备,现在需要通过相应的配置,来实现这些网络之间的互联互通。
2.1.2实验任务配置
2.1.2.1配置思路
1.配置路由器上各接口的IP地址
2配置静态路由来实现互联互通
2.1.2.2配置步骤
步骤1 设备基础配置
# 设备命名
略。
步骤2 查看路由器当前接口IP地址配置与路由表
# 查看路由器上的接口状态,仅以R1为例
[R1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 1
The number of interface that is DOWN in Protocol is 3
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned up down
GigabitEthernet0/0/1 unassigned up down
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
display ip interface brief命令用来查看接口与IP相关的简要信息,包括IP地址、子网掩码、物理状态和协议状态以及处于不同状态的接口数目等。
当前R1上的GigabitEthernet0/0/1和GigabitEthernet0/0/3接口由于尚未配置IP地址,所以lP Address/Mask字段为unassigned状态,Protocol字段为down状态,Physical字段为up状态
# 查看路由器上的路由表情况,仅以R1为例
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
InLoopBackO为设备上默认创建的环回接口,它是一个特殊的、固定的LoopBack接口。
InLoopBackO接口使用环回地址127.0.0.1/8,用来接收所有发送给本机的数据包。该接口上的IP地址是不可以改变的,也不通过路由协议对外发布。
步骤3 配置路由物理接口的IP地址
# 按照下表配置路由器的物理接口的IP地址
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.0.13.1 24
[R1-GigabitEthernet0/0/0]undo shutdown
[R1-GigabitEthernet0/0/0]quit
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 10.0.14.1 24
[R1-GigabitEthernet0/0/1]undo shutdown
[R1-GigabitEthernet0/0/1]quit
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 10.0.13.2 24
[R2-GigabitEthernet0/0/0]undo shutdown
[R2-GigabitEthernet0/0/0]quit
[R2]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address 10.0.15.1 24
[R2-GigabitEthernet0/0/1]undo shutdown
[R2-GigabitEthernet0/0/1]quit
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 10.0.14.2 24
[R3-GigabitEthernet0/0/0]undo shutdown
[R3-GigabitEthernet0/0/0]quit
[R3]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ip address 10.0.15.2 24
[R3-GigabitEthernet0/0/1]undo shutdown
[R3-GigabitEthernet0/0/1]quit
# 使用ping工具测试联通性
[R1]ping 10.0.13.2
PING 10.0.13.2: 56 data bytes, press CTRL_C to break
Reply from 10.0.13.2: bytes=56 Sequence=1 ttl=255 time=120 ms
Reply from 10.0.13.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 10.0.13.2: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 10.0.13.2: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 10.0.13.2: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 10.0.13.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/40/120 ms
[R1]ping 10.0.14.2
PING 10.0.14.2: 56 data bytes, press CTRL_C to break
Reply from 10.0.14.2: bytes=56 Sequence=1 ttl=255 time=110 ms
Reply from 10.0.14.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 10.0.14.2: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 10.0.14.2: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 10.0.14.2: bytes=56 Sequence=5 ttl=255 time=10 ms
--- 10.0.14.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/40/110 ms
# 查看R1的路由表
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.13.0/24 Direct 0 0 D 10.0.13.1 GigabitEthernet 0/0/0
10.0.13.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0
10.0.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0
10.0.14.0/24 Direct 0 0 D 10.0.14.1 GigabitEthernet 0/0/1
10.0.14.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1
10.0.14.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
可以看到,在接口IP地址配置完成之后,针对每个接口自动生成了三条直连路由。分别
是:
1.指向接口所在网段的路由。
2.指向接口IP地址的主机路由。
3.指向接口所在网段广播地址的主机路由。
注:主机路由就是掩码长度为32的路由。
步骤4创建并配置LoopBack 接口
# 按照下表配置设备的LoopBack接口
LoopBack接口属于设备上的逻辑接口,逻辑接口是指能够实现数据交换功能但物理上不存在、需要通过配置建立的接口。LoopBack接口创建后除非手工关闭该接口,否则LoopBack接口物理层状态和链路层协议永远处于UP状态。一般情况下,LoopBack接口使用32位掩码。使用LoopBack接口一般有如下目的:
1.作为一台路由器的管理地址,起到标识一台设备的作用。
2.使用该接口地址作为动态路由协议OSPF的router id。
3.其他提高网络可靠性的用途。
本实验使用LoopBack接口模拟客户端。
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 10.0.0.1 32
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 10.0.0.2 32
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 10.0.0.3 32
# 查看设备上的路由表,以R1为例
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.0.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.0.13.0/24 Direct 0 0 D 10.0.13.1 GigabitEthernet0/0/0
10.0.13.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.14.0/24 Direct 0 0 D 10.0.14.1 GigabitEthernet0/0/1
10.0.14.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
10.0.14.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
比时已经生成了相应的直连路由
# 测试各LoopBack接口之间的联通性
[R1]ping -a 10.0.1.1 10.0.1.2
Warning: The specified source address is not a local address, the ping command w
ill not check the network connection.
PING 10.0.1.2: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 10.0.1.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
ping -a source-ip-address destination-ip-address命令用来指定发送ICMP ECHO-REQUEST报文的源IP地址及目的IP地址。此时由于路由器上没有到底该目的IP的路由条目,所以无法PING通。
步骤5 配置静态路由
# 在R1上配置到达R2和R3的LoopBack0接口的路由条目
[R1]ip route-static 10.0.1.2 32 10.0.13.2
[R1]ip route-static 10.0.1.3 32 10.0.14.2
# 查看R1的路由表
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.0.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.0.1.3/32 Static 60 0 RD 10.0.13.3 GigabitEthernet0/0/0
10.0.13.0/24 Direct 0 0 D 10.0.13.1 GigabitEthernet0/0/0
10.0.13.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.14.0/24 Direct 0 0 D 10.0.14.1 GigabitEthernet0/0/1
10.0.14.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
10.0.14.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
配置的静态路由被加入到了IP路由表中
# 测试联通性
[R1]ping -a 10.0.1.1 10.0.1.2
Warning: The specified source address is not a local address, the ping command w
ill not check the network connection.
PING 10.0.1.2: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 10.0.1.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
还是无法PING通R2的LoopBack0 接口,因为此时R2上没有到Rl的LoopBack0的路由
# 在R2上添加到达R1的LoopBackO的路由
[R2]ip route-static 10.0.1.1 32 10.0.13.1
# 测试联通性
[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=10 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=20 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 = 10/18/20 ms
此时Rl的LoopBackO已经可以和R2的LoopBack0实现互通。
# 完成剩余路由条目的配置
[R2]ip route-static 10.0.1.3 32 10.0.15.2
[R3]ip route-static 10.0.1.1 32 10.0.14.1
[R3]ip route-static 10.0.1.2 32 10.0.15.1
# 读者自行测试路由器的LoopBack0接口之间的联通性
步骤6 配置R1->R3->R2作为R1的LoopBack0到R2的LoopBack0接口的备份路径
# 配置R1和R2上的静态路由
[R1]ip route-static 10.0.1.2 32 10.0.14.2 preference 100
[R2]ip route-static 10.0.1.1 32 10.0.15.2 preference 100
# 查看R1和R2上的路由表
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.0.1.2/32 Static 60 0 RD 10.0.13.2 GigabitEthernet0/0/0
10.0.1.3/32 Static 60 0 RD 10.0.14.2 GigabitEthernet0/0/1
10.0.13.0/24 Direct 0 0 D 10.0.13.1 GigabitEthernet0/0/0
10.0.13.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.14.0/24 Direct 0 0 D 10.0.14.1 GigabitEthernet0/0/1
10.0.14.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
10.0.14.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R2]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.1/32 Static 60 0 RD 10.0.13.1 GigabitEthernet0/0/0
10.0.1.2/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.0.1.3/32 Static 60 0 RD 10.0.15.2 GigabitEthernet0/0/1
10.0.13.0/24 Direct 0 0 D 10.0.13.2 GigabitEthernet0/0/0
10.0.13.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.15.0/24 Direct 0 0 D 10.0.15.1 GigabitEthernet0/0/1
10.0.15.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
10.0.15.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
此时配置的preference 为100的静态路由没有被加载到路由表中。
# 关闭Rl和R2之间的链路对应的接口(GigabitEthernet0/0/3),使得优先级高的路由失效。
# 查看R1和R2上的路由表
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.0.1.2/32 Static 100 0 RD 10.0.14.2 GigabitEthernet
0/0/1
10.0.1.3/32 Static 60 0 RD 10.0.14.2 GigabitEthernet
0/0/1
10.0.14.0/24 Direct 0 0 D 10.0.14.1 GigabitEthernet
0/0/1
10.0.14.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.0.14.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R2]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.1/32 Static 100 0 RD 10.0.15.2 GigabitEthernet0/0/1
10.0.1.2/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.0.1.3/32 Static 60 0 RD 10.0.15.2 GigabitEthernet0/0/1
10.0.15.0/24 Direct 0 0 D 10.0.15.1 GigabitEthernet0/0/1
10.0.15.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
10.0.15.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
此时由于链路断开,原先的静态路由失效,低优先级的静态路由被激活。
# 检查联通性
[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=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=20 ms
Reply from 10.0.1.2: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 10.0.1.2: bytes=56 Sequence=5 ttl=254 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/26/40 ms
# 追踪数据包路径
[R1]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.14.2 30 ms 20 ms 10 ms
2 10.0.15.1 20 ms 20 ms 40 ms
tracert命令主要用于查看数据包从源端到目的端的路径信息。可以看到数据包经过了R3的GigabitEthernet0/0/1,再经过R3的GigabitEthernet0/0/3转发给R2的GigabitEthernet0/0/4。
注:部分实验环境下设备出于安全考虑,不会回复ICMP报文,实验现象可能会有所偏差,可以按ctrl+c结束tracert。
步骤7通过默认路由实现Rl的LoopBack 0接口和R2的LoopBack 0接口互联互通
# 恢复接口并删除已经配置的路由条目
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]undo shutdown
[R1-GigabitEthernet0/0/0]quit
[R1]undo ip route-static 10.0.1.2 32 10.0.13.1
[R1]undo ip route-static 10.0.1.2 32 10.0.14.2 preference 100
# 查看R1的路由表
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.0.1.3/32 Static 60 0 RD 10.0.14.2 GigabitEthernet0/0/1
10.0.13.0/24 Direct 0 0 D 10.0.13.1 GigabitEthernet0/0/0
10.0.13.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.14.0/24 Direct 0 0 D 10.0.14.1 GigabitEthernet0/0/1
10.0.14.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
10.0.14.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
此时Rl上没有到R2的LoopBack0 ( 10.0.1.2/32)的路由条目
# 在R1上配置默认路由
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 10.0.13.2 GigabitEthernet 0/0/0
10.0.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.0.1.3/32 Static 60 0 RD 10.0.14.2 GigabitEthernet 0/0/1
10.0.13.0/24 Direct 0 0 D 10.0.13.1 GigabitEthernet 0/0/0
10.0.13.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0
10.0.13.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0
10.0.14.0/24 Direct 0 0 D 10.0.14.1 GigabitEthernet 0/0/1
10.0.14.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1
10.0.14.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
默认路由已经被激活
# 测试R1的LoopBack0接口到R2的LoopBack0接口的联通性
[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=50 ms
Reply from 10.0.1.2: bytes=56 Sequence=2 ttl=255 time=10 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=30 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 = 10/28/50 ms
此时Rl的LoopBack0接口到R2的LoopBack0接口之间可以互联互通。
2.1.3结果验证
读者自行通过ping 和tracert命令检查设备LoopBack0接口之间的联通性。
2.1.4配置参考
R1的配置
#
sysname R1
#
interface GigabitEthernet0/0/0
ip address 10.0.13.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.14.1 255.255.255.0
#
interface LoopBack0
ip address 10.0.1.1 255.255.255.255
#
ip route-static 0.0.0.0 0.0.0.0 10.0.13.2
ip route-static 10.0.1.3 255.255.255.255 10.0.14.2
R2的配置
#
sysname R2
#
interface GigabitEthernet0/0/0
ip address 10.0.13.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.15.1 255.255.255.0
#
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.13.1
ip route-static 10.0.1.1 255.255.255.255 10.0.15.2 preference 100
ip route-static 10.0.1.3 255.255.255.255 10.0.15.2
#
R3的配置
#
sysname R3
#
interface GigabitEthernet0/0/0
ip address 10.0.14.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.15.2 255.255.255.0
#
interface GigabitEthernet0/0/2
#
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.14.1
ip route-static 10.0.1.2 255.255.255.255 10.0.15.1
#