码迷,mamicode.com
首页 > 其他好文 > 详细

动态路由——OSPF虚链路配置 实验篇 (五)

时间:2019-09-20 09:15:22      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:sum   网卡ip   inf   rom   check   cte   避免   gateway   ESS   

搭建OSPF虚链路实验

搭建虚链路拓扑图

再GNS 3中拓扑区域添加四台路由设备,两台PC机,使用连接线,连接四台路由设备与两台PC机,并再拓扑图中标注连接接口的IP地址与区域信息,如图所示:

技术图片

网段划分:

  • 192.168.10.0/24
  • 192.168.20.0/24
  • 192.168.30.0/24
  • 192.168.40.0/24
  • 192.168.50.0/24

区域划分:

  • area 0
  • area 1
  • area 2

Router ID划分:

  • R11.1.1.1
  • R22.2.2.2
  • R33.3.3.3
  • R44.4.4.4

搭建实验:

1、首先开启在GNS 3中开启全部设备,并进入R1路由设备中配置接口IP地址,设置回环网卡,配置OSPF协议。

R1#conf t                     //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f0/0            //进入f0/0接口
R1(config-if)#ip add 192.168.10.1 255.255.255.0     //添加IP地址
R1(config-if)#no shut            //开启接口
R1(config-if)#
*Mar  1 00:00:50.995: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:00:51.995: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int f0/1              //进入f0/1接口
R1(config-if)#ip add 192.168.20.1 255.255.255.0        //添加IP地址
R1(config-if)#no shut            //开启接口
R1(config-if)#
*Mar  1 00:07:41.143: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:07:42.143: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#ex               //退出接口模式
R1(config)#int loopback 0       //进入配置回环网卡
R1(config-if)#
*Mar  1 00:09:25.479: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R1(config-if)#ip add 1.1.1.1 255.255.255.255    //添加固定回环网卡IP地址
R1(config-if)#no shut            //开启接口
R1(config-if)#ex               //退出接口模式
R1(config)#router ospf 1        //开启ospf协议,进程号为1
R1(config-router)#router-id 1.1.1.1    //设置宣告Router ID
R1(config-router)#network 192.168.10.0 0.0.0.255 area 2    //宣告网段信息
R1(config-router)#network 192.168.20.0 0.0.0.255 area 2
R1(config-router)#
*Mar  1 00:15:16.883: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/1 from LOADING to FULL, Loading Done
R1(config-router)#ex             //退出接口模式

2、进入R2路由设置,配置接口IP地址,设置回环网卡,配置OSPF协议。

R2#conf t                            //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int f0/0            //进入f0/0接口
R2(config-if)#ip add 192.168.20.2 255.255.255.0     //添加IP地址
R2(config-if)#no shut            //开启接口
R2(config-if)#
*Mar  1 00:12:37.643: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:12:38.643: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#int f0/1              //进入f0/1接口
R2(config-if)#ip add 192.168.30.1 255.255.255.0        //添加IP地址
R2(config-if)#no shut            //开启接口
R2(config-if)#
*Mar  1 00:13:06.051: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:13:07.051: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R2(config-if)#ex               //退出接口模式
R2(config)#int loopback 0      //进入配置回环网卡
R2(config-if)#
*Mar  1 00:13:54.103: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R2(config-if)#ip add 2.2.2.2 255.255.255.255    //添加固定回环网卡IP地址
R2(config-if)#no shut            //开启接口
R2(config-if)#ex               //退出接口模式
R2(config)#router ospf 1       //开启ospf协议,进程号为1
R2(config-router)#router-id 2.2.2.2    //设置宣告Router ID
R2(config-router)#network 192.168.20.1 0.0.0.255 area 2    //宣告网段信息
R2(config-router)#
*Mar  1 00:15:16.887: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
R2(config-router)#network 192.168.30.1 0.0.0.255 area 1 
R2(config-router)#ex             //退出接口模式

3、进入R3路由设置,配置接口IP地址,设置回环网卡,配置OSPF协议。

R3#conf t                            //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#int f0/0            //进入f0/0接口
R3(config-if)#ip add 192.168.30.2 255.255.255.0     //添加IP地址
R3(config-if)#no shut            //开启接口
R3(config-if)#
*Mar  1 00:16:24.835: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:16:25.835: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#int f0/1              //进入f0/1接口
R3(config-if)#ip add 192.168.40.1 255.255.255.0        //添加IP地址 
R3(config-if)#no shut            //开启接口
R3(config-if)#
*Mar  1 00:16:56.135: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:16:57.135: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R3(config-if)#ex              //退出接口模式
R3(config)#int loopback 0     //进入配置回环网卡
R3(config-if)#ip 
*Mar  1 00:17:10.871: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R3(config-if)#ip add 3.3.3.3 255.255.255.255     //添加固定回环网卡IP地址              
R3(config-if)#no shut           //开启接口
R3(config-if)#ex               //退出接口模式
R3(config)#router ospf 1       //开启ospf协议,进程号为1
R3(config-router)#router-id 3.3.3.3    //设置宣告Router ID
R3(config-router)#network 192.168.30.0 0.0.0.255 area 1    //宣告网段信息
R3(config-router)#
*Mar  1 00:19:16.383: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
R3(config-router)#network 192.168.40.0 0.0.0.255 area 0
R3(config-router)#ex             //退出接口模式

4、进入R4路由设置,配置接口IP地址,设置回环网卡,配置OSPF协议。

R4#conf t                             //进入全局配置模式
Enter configuration commands, one per line.  End with CNTL/Z.
R4(config)#int f0/0            //进入f0/0接口
R4(config-if)#ip add 192.168.40.2 255.255.255.0     //添加IP地址
R4(config-if)#no shut            //开启接口
R4(config-if)#
*Mar  1 00:20:26.999: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:20:27.999: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R4(config-if)#int f0/1              //进入f0/1接口
R4(config-if)#ip add 192.168.50.1 255.255.255.0        //添加IP地址 
R4(config-if)#no shut            //开启接口
R4(config-if)#
*Mar  1 00:20:51.107: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:20:52.107: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R4(config-if)#ex              //退出接口模式
R4(config)#int loopback 0     //进入配置回环网卡
R4(config-if)#
*Mar  1 00:21:07.103: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R4(config-if)#ip add 4.4.4.4 255.255.255.255     //添加固定回环网卡IP地址          
R4(config-if)#no shut           //开启接口
R4(config-if)#ex               //退出接口模式
R4(config)#router ospf 1       //开启ospf协议,进程号为1
R4(config-router)#router-id 4.4.4.4    //设置宣告Router ID
R4(config-router)#network 192.168.40.0 0.0.0.255 area 0    //宣告网段信息
R4(config-router)#network 192.168.50.0 0.0.0.255 area 0

5、查看各路由设备路由表信息。

R1(config)#do show ip route         //查看R1设备路由表信息
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

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
C    192.168.10.0/24 is directly connected, FastEthernet0/0
C    192.168.20.0/24 is directly connected, FastEthernet0/1        //未完全学到全部网段信息
R2(config)#do show ip route         //查看R2设备路由表信息
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

     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback0
C    192.168.30.0/24 is directly connected, FastEthernet0/1
O    192.168.10.0/24 [110/20] via 192.168.20.1, 00:09:31, FastEthernet0/0
O IA 192.168.40.0/24 [110/20] via 192.168.30.2, 00:05:30, FastEthernet0/1
C    192.168.20.0/24 is directly connected, FastEthernet0/0
O IA 192.168.50.0/24 [110/30] via 192.168.30.2, 00:02:26, FastEthernet0/1        //成功学习网段信息
R3(config)#do show ip route         //查看R3设备路由表信息
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

     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
C    192.168.30.0/24 is directly connected, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/1
O    192.168.50.0/24 [110/20] via 192.168.40.2, 00:02:39, FastEthernet0/1        //未完全学到全部网段信息
R4(config)#do show ip route         //查看R4设备路由表信息
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

O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:02:57, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
C      (1) 4.4.4.4 is directly connected, Loopback0    //添加(1)避免违禁词汇
C    192.168.40.0/24 is directly connected, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/1        //未完全学到全部网段信息

6、创建R2、R3路由设备中配置虚链路,是所有路由设备可以学到全部网段信息;然后在查看路由设备路由表信息。

R2(config)#router ospf 1        //进入ospf协议
R2(config-router)#area 1 virtual-link 3.3.3.3       //配置虚链路连接R3路由设备
R3(config)#router ospf 1               //进入ospf协议
R3(config-router)#area 1 virtual-link 2.2.2.2       //配置虚链路连接R2路由设备
R3(config-router)#
*Mar  1 01:03:14.947: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on OSPF_VL0 from LOADING to FULL, Loading Done
R1(config)#do show ip route               //查看R1路由设备路由表信息
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

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
O IA 192.168.30.0/24 [110/20] via 192.168.20.2, 00:05:19, FastEthernet0/1
C    192.168.10.0/24 is directly connected, FastEthernet0/0
O IA 192.168.40.0/24 [110/30] via 192.168.20.2, 00:03:36, FastEthernet0/1
C    192.168.20.0/24 is directly connected, FastEthernet0/1
O IA 192.168.50.0/24 [110/40] via 192.168.20.2, 00:03:36, FastEthernet0/1        //成功学习网段信息
R3(config)#do show ip route               //查看R3路由设备路由表信息
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

     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
C    192.168.30.0/24 is directly connected, FastEthernet0/0
O IA 192.168.10.0/24 [110/30] via 192.168.30.1, 00:04:06, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/1
O IA 192.168.20.0/24 [110/20] via 192.168.30.1, 00:04:06, FastEthernet0/0
O    192.168.50.0/24 [110/20] via 192.168.40.2, 00:44:50, FastEthernet0/1        //成功学习网段信息
R4(config)#do show ip route               //查看R4路由设备路由表信息
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

O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:45:36, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
C      (1) 4.4.4.4 is directly connected, Loopback0    //添加(1)避免违禁词汇
O IA 192.168.10.0/24 [110/40] via 192.168.40.1, 00:04:43, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/0
O IA 192.168.20.0/24 [110/30] via 192.168.40.1, 00:04:43, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/1        //成功学习网段信息

7、在两台PC机中添加IP地址,并使用ping命令检查互通性。

PC1> ip 192.168.10.2 192.168.10.1         //添加IP地址
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1
PC2> ip 192.168.50.2 192.168.50.1         //添加IP地址
Checking for duplicate address...
PC1 : 192.168.50.2 255.255.255.0 gateway 192.168.50.1
PC1> ping 192.168.50.2                   //使用ping命令与PC2通信
192.168.50.2 icmp_seq=1 timeout
84 bytes from 192.168.50.2 icmp_seq=2 ttl=60 time=78.779 ms
84 bytes from 192.168.50.2 icmp_seq=3 ttl=60 time=77.795 ms
84 bytes from 192.168.50.2 icmp_seq=4 ttl=60 time=81.932 ms
84 bytes from 192.168.50.2 icmp_seq=5 ttl=60 time=83.226 ms       //成功通信

动态路由——OSPF虚链路配置 实验篇 (五)

标签:sum   网卡ip   inf   rom   check   cte   避免   gateway   ESS   

原文地址:https://blog.51cto.com/14473285/2439482

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!