在GNS 3
中拓撲區域添加6臺路由設別,其中一臺R6路由設備做爲網絡運營商提供的網絡設備路由,在R3
路由設備中添加兩塊單口業務單板,分別用於鏈接外部網絡路由與PC機;添加四臺PC機與路由設備鏈接,其中PC3
做爲網絡運營商的服務器設備,與R3路由設備相連。其中劃分三個區域area 0
、area 2
、RIP
;分別路由設備與PC
接口處標註網段信息,如圖所示:redis
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
R2
:2.2.2.2
R3
:3.3.3.3
R4
:4.4.4.4
一、首先在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 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: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 up R1(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 route Gateway of last resort is 192.168.20.2 to network 0.0.0.0 C 192.168.10.0/24 is directly connected, FastEthernet0/0 C 192.168.20.0/24 is directly connected, FastEthernet0/1 S* 0.0.0.0/0 [1/0] via 192.168.20.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 up R2(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 up R2(config-if)#exit R2(config)#router ospf 1 //開啓ospf協議,進程號爲1 R2(config-router)#router-id 2.2.2.2 //設置並宣告Router ID R2(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 route Gateway of last resort is not set C 192.168.30.0/24 is directly connected, FastEthernet0/0 S 192.168.10.0/24 [1/0] via 192.168.20.1 //成功添加網段信息 C 192.168.20.0/24 is directly connected, FastEthernet0/1
三、在R3路由設備中配置接口IP
地址;配置默認路由鏈接外部網段;開啓OSPF
協議,設置Router ID
,並在區域中宣告網段,注入設置的外部默認路由網段信息。ide
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 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: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 up R3(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 up R3(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 up R3(config-if)#do show ip int b //查看接口信息 Interface IP-Address OK? Method Status Protocol FastEthernet0/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協議,進程號爲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 //在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 Done R3(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 0 R3(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 route Gateway of last resort is 12.0.0.2 to network 0.0.0.0 C 192.168.30.0/24 is directly connected, FastEthernet0/0 O E2 192.168.10.0/24 [110/20] via 192.168.30.1, 00:01:21, FastEthernet0/0 C 192.168.40.0/24 is directly connected, FastEthernet0/1 O 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 subnets C 12.0.0.0 is directly connected, FastEthernet1/0 C 192.168.70.0/24 is directly connected, FastEthernet2/0 S* 0.0.0.0/0 [1/0] via 12.0.0.2 //成功添加網段
四、在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 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 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 up R4(config-if)#ex //退出接口模式 R4(config)#router rip //啓用RIP協議 R4(config-router)#version 2 //啓用版本2 R4(config-router)#no auto-summary //關閉路由自動彙總功能 R4(config-router)#network 192.168.50.0 //宣告網段 R4(config-router)#redistribute ospf 1 metric 5 //注入ospf協議,設置條數爲5 R4(config-router)#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 //在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 Done R4(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 route Gateway of last resort is 192.168.40.1 to network 0.0.0.0 O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:01:30, FastEthernet0/0 O E2 192.168.10.0/24 [110/20] via 192.168.40.1, 00:01:30, FastEthernet0/0 C 192.168.40.0/24 is directly connected, FastEthernet0/0 O E2 192.168.20.0/24 [110/20] via 192.168.40.1, 00:01:30, FastEthernet0/0 C 192.168.50.0/24 is directly connected, FastEthernet0/1 O 192.168.70.0/24 [110/11] via 192.168.40.1, 00:01:30, FastEthernet0/0 O*E2 0.0.0.0/0 [110/1] via 192.168.40.1, 00:01:30, FastEthernet0/0 //成功學習網段信息
五、在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 up R5(config-if)#int f0/1 //進入接口f0/1 R5(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 up R5(config-if)#router rip //啓用RIP協議 R5(config-router)#version 2 //啓用版本2 R5(config-router)#no auto-summary //關閉自動彙總功能 R5(config-router)#network 192.168.50.0 //宣告網段信息 R5(config-router)#network 192.168.60.0 R5(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 route Gateway of last resort is 192.168.50.1 to network 0.0.0.0 R 192.168.30.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0 C 192.168.60.0/24 is directly connected, FastEthernet0/1 R 192.168.10.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0 R 192.168.40.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0 R 192.168.20.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0 C 192.168.50.0/24 is directly connected, FastEthernet0/0 R 192.168.70.0/24 [120/5] via 192.168.50.1, 00:00:25, FastEthernet0/0 R* 0.0.0.0/0 [120/1] via 192.168.50.1, 00:00:26, FastEthernet0/0 //成功學習網段信息
六、在R6
路由設備中添加接口IP地址,而後配置靜態路由。code
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 up R6(config-if)#int f0/1 //進入接口f0/1 R6(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 up R6(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 route Gateway of last resort is not set 12.0.0.0/24 is subnetted, 1 subnets C 12.0.0.0 is directly connected, FastEthernet0/0 13.0.0.0/24 is subnetted, 1 subnets C 13.0.0.0 is directly connected, FastEthernet0/1 S 192.168.0.0/16 [1/0] via 12.0.0.1 //網段添加成功
七、分別在PC
機中添加IP
地址,並測試網絡互通性。orm
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 timeout 192.168.70.2 icmp_seq=2 timeout 84 bytes from 192.168.70.2 icmp_seq=3 ttl=61 time=53.853 ms 84 bytes from 192.168.70.2 icmp_seq=4 ttl=61 time=60.168 ms 84 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 timeout 13.0.0.2 icmp_seq=2 timeout 84 bytes from 13.0.0.2 icmp_seq=3 ttl=60 time=76.872 ms 84 bytes from 13.0.0.2 icmp_seq=4 ttl=60 time=83.919 ms 84 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 timeout 84 bytes from 192.168.60.2 icmp_seq=2 ttl=59 time=97.596 ms 84 bytes from 192.168.60.2 icmp_seq=3 ttl=59 time=97.688 ms 84 bytes from 192.168.60.2 icmp_seq=4 ttl=59 time=99.732 ms 84 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 timeout 13.0.0.2 icmp_seq=2 timeout 84 bytes from 13.0.0.2 icmp_seq=3 ttl=62 time=38.042 ms 84 bytes from 13.0.0.2 icmp_seq=4 ttl=62 time=37.842 ms 84 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 timeout 192.168.60.2 icmp_seq=2 timeout 84 bytes from 192.168.60.2 icmp_seq=3 ttl=61 time=56.783 ms 84 bytes from 192.168.60.2 icmp_seq=4 ttl=61 time=63.372 ms 84 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 ms 84 bytes from 192.168.60.2 icmp_seq=2 ttl=60 time=79.786 ms 84 bytes from 192.168.60.2 icmp_seq=3 ttl=60 time=87.773 ms 84 bytes from 192.168.60.2 icmp_seq=4 ttl=60 time=84.850 ms 84 bytes from 192.168.60.2 icmp_seq=5 ttl=60 time=84.778 ms //成功通訊