侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

动态路由——OSPF高级配置 实验篇 (四)

2023-03-14 星期二 / 0 评论 / 0 点赞 / 72 阅读 / 21174 字

搭建OSPF高级配置实验搭建拓扑图在GNS 3中拓扑区域添加6台路由设别,其中一台R6路由设备作为网络运营商提供的网络设备路由,在R3路由设备中添加两块单口业务单板,分别用于连接外部网络路由与PC机;

.

搭建OSPF高级配置实验

搭建拓扑图

GNS 3中拓扑区域添加6台路由设别,其中一台R6路由设备作为网络运营商提供的网络设备路由,在R3路由设备中添加两块单口业务单板,分别用于连接外部网络路由与PC机;添加四台PC机与路由设备连接,其中PC3作为网络运营商的服务器设备,与R3路由设备相连。其中划分三个区域area 0area 2RIP;分别路由设备与PC接口处标注网段信息,如图所示:

网段划分:

  • 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
  • 192.168.60.0/24
  • 192.168.70.0/24
  • 12.0.0.0/24
  • 13.0.0.0/24

Router ID 划分:

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

搭建实验

1、首先在R1路由设备中添加网段地址,并设置将R1路由设备配置为默认路由。

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:01:10.451: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up*Mar  1 00:01:11.451: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR1(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:01:44.735: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up*Mar  1 00:01:45.735: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upR1(config-if)#exit                    //退出接口模式R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.20.2   //配置默认路由R1(config)#do show ip route           //查看路由表    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 routeGateway of last resort is 192.168.20.2 to network 0.0.0.0C    192.168.10.0/24 is directly connected, FastEthernet0/0C    192.168.20.0/24 is directly connected, FastEthernet0/1S*   0.0.0.0/0 [1/0] via 192.168.20.2                    //配置成功

2、进入R2路由设备,配置接口地址,启动OSPF协议,设置宣告Router ID、网段信息;设置静态路由用于连接默认路由网段,最后在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.30.1 255.255.255.0    //添加IP地址R2(config-if)#no shut            //开启接口R2(config-if)#*Mar  1 00:11:10.515: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up*Mar  1 00:11:11.515: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR2(config-if)#int f0/1             //进入f0/1接口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:11:49.983: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up*Mar  1 00:11:50.983: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upR2(config-if)#exitR2(config)#router ospf 1         //开启ospf协议,进程号为1R2(config-router)#router-id 2.2.2.2     //设置并宣告Router IDR2(config-router)#network 192.168.30.0 0.0.0.255 area 1    //在area 1区域中宣告网段信息R2(config-router)#exit                //退出ospf协议R2(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1   //配置静态路由信息R2(config)#router ospf 1          //进入ospf协议R2(config-router)#redistribute connected subnets     //注入直连网段信息R2(config-router)#redistribute static subnets         //注入默认路由网段信息R2(config-router)#ex                                   //退出协议R2(config)#do show ip route           //查看路由表信息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 routeGateway of last resort is not setC    192.168.30.0/24 is directly connected, FastEthernet0/0S    192.168.10.0/24 [1/0] via 192.168.20.1                     //成功添加网段信息C    192.168.20.0/24 is directly connected, FastEthernet0/1

3、在R3路由设备中配置接口IP地址;配置默认路由连接外部网段;开启OSPF协议,设置Router ID,并在区域中宣告网段,注入设置的外部默认路由网段信息。

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:42:41.963: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up*Mar  1 00:42:42.963: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR3(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:43:23.963: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up*Mar  1 00:43:24.963: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upR3(config-if)#int f1/0             //进入f1/0接口R3(config-if)#ip add 12.0.0.1 255.255.255.0            //添加IP地址R3(config-if)#no shut               //开启接口R3(config-if)#*Mar  1 00:44:01.631: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up*Mar  1 00:44:02.631: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to upR3(config-if)#int f2/0               //进入f2/0接口R3(config-if)#ip add 192.168.70.1 255.255.255.0             //添加IP地址R3(config-if)#no shut               //开启接口R3(config-if)#*Mar  1 00:44:41.015: %LINK-3-UPDOWN: Interface FastEthernet2/0, changed state to up*Mar  1 00:44:42.015: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet2/0, changed state to upR3(config-if)#do show ip int b       //查看接口信息Interface                  IP-Address      OK? Method Status                ProtocolFastEthernet0/0            192.168.30.2    YES manual up                    up      FastEthernet0/1            192.168.40.1    YES manual up                    up      FastEthernet1/0            12.0.0.1        YES manual up                    up      FastEthernet2/0            192.168.70.1    YES manual up                    up        //成功添加网段 R3(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2          //配置默认路由,连接外部网段R3(config)#router ospf 1                               //开启ospf协议,进程号为1R3(config-router)#router-id 3.3.3.3                   //设置宣告Router IDR3(config-router)#network 192.168.30.0 0.0.0.255 area 1   //在area 1区域中宣告网段信息,注意子网掩码写反码R3(config-router)#*Mar  1 00:47:50.531: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading DoneR3(config-router)#network 192.168.40.0 0.0.0.255 area 0    //在area 0区域中宣告网段信息,注意子网掩码写反码R3(config-router)#network 192.168.70.0 0.0.0.255 area 0R3(config-router)#default-information originate          //将外部路由网段注入ospf协议中R3(config-router)#ex                                     //退出R3(config)#do show ip route                              //查看路由表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 routeGateway of last resort is 12.0.0.2 to network 0.0.0.0C    192.168.30.0/24 is directly connected, FastEthernet0/0O E2 192.168.10.0/24 [110/20] via 192.168.30.1, 00:01:21, FastEthernet0/0C    192.168.40.0/24 is directly connected, FastEthernet0/1O E2 192.168.20.0/24 [110/20] via 192.168.30.1, 00:01:21, FastEthernet0/0     12.0.0.0/24 is subnetted, 1 subnetsC       12.0.0.0 is directly connected, FastEthernet1/0C    192.168.70.0/24 is directly connected, FastEthernet2/0S*   0.0.0.0/0 [1/0] via 12.0.0.2                                  //成功添加网段

4、在R4路由设备添加接口IP地址,启用RIP协议,启用版本2,关闭路由自动汇总功能,宣告网段信息,最后注入OSPF协议,设置跳数为5;启用OSPF协议,设置Router ID,并在区域中宣告网段,注入RIP协议。

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 01:03:22.375: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up*Mar  1 01:03:23.375: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR4(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 01:03:57.519: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up*Mar  1 01:03:58.519: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upR4(config-if)#ex             //退出接口模式R4(config)#router rip         //启用RIP协议R4(config-router)#version 2    //启用版本2R4(config-router)#no auto-summary      //关闭路由自动汇总功能R4(config-router)#network 192.168.50.0        //宣告网段    R4(config-router)#redistribute ospf 1 metric 5   //注入ospf协议,设置条数为5R4(config-router)#ex                             //退出R4(config)#router ospf 1             //开启ospf协议,进程号为1R4(config-router)#router-id 4.4.4.4    //设置宣告Router IDR4(config-router)#network 192.168.40.0 0.0.0.255 area 0  //在area 0区域中宣告网段信息,注意子网掩码写反码R4(config-router)#*Mar  1 01:10:09.027: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading DoneR4(config-router)#redistribute rip subnets    //注入RIP协议R4(config-router)#ex                          //退出R4(config)#do show ip route                   //查看路由表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 routeGateway of last resort is 192.168.40.1 to network 0.0.0.0O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:01:30, FastEthernet0/0O E2 192.168.10.0/24 [110/20] via 192.168.40.1, 00:01:30, FastEthernet0/0C    192.168.40.0/24 is directly connected, FastEthernet0/0O E2 192.168.20.0/24 [110/20] via 192.168.40.1, 00:01:30, FastEthernet0/0C    192.168.50.0/24 is directly connected, FastEthernet0/1O    192.168.70.0/24 [110/11] via 192.168.40.1, 00:01:30, FastEthernet0/0O*E2 0.0.0.0/0 [110/1] via 192.168.40.1, 00:01:30, FastEthernet0/0          //成功学习网段信息

5、在R5路由设备中添加接口IP地址,启用RIP协议,并关闭自动汇总功能,宣告两个网段。

R5#conf t                    //进入全局配置模式Enter configuration commands, one per line.  End with CNTL/Z.R5(config)#int f0/0            //进入f0/0接口R5(config-if)#ip add 192.168.50.2 255.255.255.0    //添加IP地址R5(config-if)#no shut          //开启接口R5(config-if)#*Mar  1 01:27:42.539: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up*Mar  1 01:27:43.539: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR5(config-if)#int f0/1         //进入接口f0/1R5(config-if)#ip add 192.168.60.1 255.255.255.0  //添加IP地址R5(config-if)#no shut           //开启接口R5(config-if)#*Mar  1 01:28:17.635: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up*Mar  1 01:28:18.635: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upR5(config-if)#router rip         //启用RIP协议R5(config-router)#version 2       //启用版本2R5(config-router)#no auto-summary  //关闭自动汇总功能R5(config-router)#network 192.168.50.0    //宣告网段信息R5(config-router)#network 192.168.60.0R5(config-router)#ex                  //退出R5(config)#do show ip route             //查看路由表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 routeGateway of last resort is 192.168.50.1 to network 0.0.0.0R    192.168.30.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0C    192.168.60.0/24 is directly connected, FastEthernet0/1R    192.168.10.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0R    192.168.40.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0R    192.168.20.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0C    192.168.50.0/24 is directly connected, FastEthernet0/0R    192.168.70.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0R*   0.0.0.0/0 [120/1] via 192.168.50.1, 00:00:26, FastEthernet0/0       //成功学习网段信息

6、在R6路由设备中添加接口IP地址,然后配置静态路由。

R6#conf t                  //进入全局配置模式Enter configuration commands, one per line.  End with CNTL/Z.R6(config)#int f0/0        //进入f0/0接口R6(config-if)#ip add 12.0.0.2 255.255.255.0      //添加IP地址R6(config-if)#no shut      //开启接口R6(config-if)#*Mar  1 01:36:54.323: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up*Mar  1 01:36:55.323: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR6(config-if)#int f0/1      //进入接口f0/1R6(config-if)#ip add 13.0.0.1 255.255.255.0     //添加IP地址R6(config-if)#no shut         //开启接口R6(config-if)#*Mar  1 01:37:26.223: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up*Mar  1 01:37:27.223: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upR6(config-if)#ex            //退出模式R6(config)#ip route 192.168.0.0 255.255.0.0 12.0.0.1     //设置静态路由R6(config)#do show ip route           //查看路由表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 routeGateway of last resort is not set     12.0.0.0/24 is subnetted, 1 subnetsC       12.0.0.0 is directly connected, FastEthernet0/0     13.0.0.0/24 is subnetted, 1 subnetsC       13.0.0.0 is directly connected, FastEthernet0/1S    192.168.0.0/16 [1/0] via 12.0.0.1                       //网段添加成功

7、分别在PC机中添加IP地址,并测试网络互通性。

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.70.2 192.168.70.1      //添加IP地址Checking for duplicate address...PC1 : 192.168.70.2 255.255.255.0 gateway 192.168.70.1
PC3> ip 13.0.0.2 13.0.0.1             //添加IP地址Checking for duplicate address...PC1 : 13.0.0.2 255.255.255.0 gateway 13.0.0.1
P4> ip 192.168.60.2 192.168.60.1      //添加IP地址Checking for duplicate address...PC1 : 192.168.60.2 255.255.255.0 gateway 192.168.60.1
PC1> ping 192.168.70.2                //测试PC1与PC2的互通性192.168.70.2 icmp_seq=1 timeout192.168.70.2 icmp_seq=2 timeout84 bytes from 192.168.70.2 icmp_seq=3 ttl=61 time=53.853 ms84 bytes from 192.168.70.2 icmp_seq=4 ttl=61 time=60.168 ms84 bytes from 192.168.70.2 icmp_seq=5 ttl=61 time=57.781 ms    //成功通信PC1> ping 13.0.0.2                   //测试PC1与PC3的互通性13.0.0.2 icmp_seq=1 timeout13.0.0.2 icmp_seq=2 timeout84 bytes from 13.0.0.2 icmp_seq=3 ttl=60 time=76.872 ms84 bytes from 13.0.0.2 icmp_seq=4 ttl=60 time=83.919 ms84 bytes from 13.0.0.2 icmp_seq=5 ttl=60 time=77.712 ms    //成功通信PC1> ping 192.168.60.2              //测试PC1与P4的互通性192.168.60.2 icmp_seq=1 timeout84 bytes from 192.168.60.2 icmp_seq=2 ttl=59 time=97.596 ms84 bytes from 192.168.60.2 icmp_seq=3 ttl=59 time=97.688 ms84 bytes from 192.168.60.2 icmp_seq=4 ttl=59 time=99.732 ms84 bytes from 192.168.60.2 icmp_seq=5 ttl=59 time=103.440 ms    //成功通信
PC2> ping 13.0.0.2               //测试PC2与PC3的互通性    13.0.0.2 icmp_seq=1 timeout13.0.0.2 icmp_seq=2 timeout84 bytes from 13.0.0.2 icmp_seq=3 ttl=62 time=38.042 ms84 bytes from 13.0.0.2 icmp_seq=4 ttl=62 time=37.842 ms84 bytes from 13.0.0.2 icmp_seq=5 ttl=62 time=40.034 ms    //成功通信PC2> ping 192.168.60.2            //测试PC2与P4的互通性192.168.60.2 icmp_seq=1 timeout192.168.60.2 icmp_seq=2 timeout84 bytes from 192.168.60.2 icmp_seq=3 ttl=61 time=56.783 ms84 bytes from 192.168.60.2 icmp_seq=4 ttl=61 time=63.372 ms84 bytes from 192.168.60.2 icmp_seq=5 ttl=61 time=53.795 ms    //成功通信
PC3> ping 192.168.60.2            //测试PC3与P4的互通性84 bytes from 192.168.60.2 icmp_seq=1 ttl=60 time=78.788 ms84 bytes from 192.168.60.2 icmp_seq=2 ttl=60 time=79.786 ms84 bytes from 192.168.60.2 icmp_seq=3 ttl=60 time=87.773 ms84 bytes from 192.168.60.2 icmp_seq=4 ttl=60 time=84.850 ms84 bytes from 192.168.60.2 icmp_seq=5 ttl=60 time=84.778 ms    //成功通信
.

广告 广告

评论区