OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

前言:

理论知识我在上一篇博客已经写过了,但光是掌握理论,而不去实践就如同纸上谈兵。只有理论与实践相结合,我们下能更深的理解与记忆。闲话少叙,接下来我会直接演示OSPF协议的具体配置过程。本次实验主要分为两个部分:一、基本配置;二、虚链路的配置。

一、OSPF协议基本配置:

1.实验环境

本次实验是在GNS3-1.3.10版本中进行的,具体拓扑图如下:

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

需要注意的是R1与R3的接口不够,需要分别添加一个NM-1FE-TX单板。
OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

2.R1的配置

(1)给R1各个接口配上IP地址,并检查是否设置成功。

R1#conf t                                                                                                                  //进入全局模式
R1(config)#int f0/0                                                                                                  //进入f0/0接口
R1(config-if)#ip add 192.168.20.1 255.255.255.0                                             //设置IP地址与子网掩码
R1(config-if)#no shut                                                                                             //开启接口
R1(config-if)#int f0/1                                                                                              //进入f0/1接口
R1(config-if)#ip add 192.168.50.2 255.255.255.0                                           //设置IP地址与子网掩码
R1(config-if)#no shut                                                                                           //开启接口
R1(config-if)#int f1/0                                                                                            //进入f1/0接口
R1(config-if)#ip add 192.168.10.1 255.255.255.0                                          //设置IP地址与子网掩码
R1(config-if)#no shut                                                                                          //开启接口
R1(config-if)#exit                                                                                                  //退出
R1(config)#do show ip int b                                                                              //查看接口IP
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.20.1    YES manual up                    up      
FastEthernet0/1            192.168.50.2    YES manual up                    up      
FastEthernet1/0            192.168.10.1    YES manual up                    up     

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置
(2)设置回环网卡的IP,并查看是否设置成功。(我只演示一遍,下面我就直接添加router-id了)

R1(config)#int loopback 0                                                                                     //进入loopback 0 接口
R1(config-if)#ip add 1.1.1.1 255.255.255.255                                                   //设置IP地址与子网掩码
R1(config-if)#no shut                                                                                             //开启接口
R1(config-if)#exit                                                                                                   //退出
R1(config)#do show ip int b                                                                                //查看接口IP
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.20.1    YES manual up                    up      
FastEthernet0/1            192.168.50.2    YES manual up                    up      
FastEthernet1/0            192.168.10.1    YES manual up                    up      
Loopback0                  1.1.1.1         YES manual up                    up      

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置
(3)启用R1的OSPF协议,并进行相关配置。

R1(config)#router ospf 1                                                                    //启用OSPF协议,进程号1
R1(config-router)#router-id 1.1.1.1                                                  //设置router-id
R1(config-router)#network 192.168.20.0 0.0.0.255 area 0         //宣告网段,每个网段要宣告在自己的Area内
R1(config-router)#network 192.168.50.0 0.0.0.255 area 0        //宣告网段,每个网段要宣告在自己的Area内
R1(config-router)#network 192.168.10.0 0.0.0.255 area 0        //宣告网段,每个网段要宣告在自己的Area内
R1(config-router)#exit                                                                     //退出

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

3.R2的配置

(1)给R2各个接口配上IP地址,并检查是否设置成功。

R2#conf t                                                                                                                  //进入全局模式
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)#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)#exit                                                                                                  //退出
R2(config)#do show ip int b                                                                              //查看接口IP
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.20.2    YES manual up                    up      
FastEthernet0/1            192.168.30.1    YES manual up                    up  

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

(2)启用R2的OSPF协议,并进行相关配置。

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.0 0.0.0.255 area 0         //宣告网段,每个网段要宣告在自己的Area内
R2(config-router)#network 192.168.20.0 0.0.0.255 area 0         //宣告网段,每个网段要宣告在自己的Area内
R2(config-router)#exit                                                                     //退出

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

4.R3的配置

(1)给R3各个接口配上IP地址,并检查是否设置成功。

R3#conf t                                                                                                                  //进入全局模式
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)#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)#int f1/0                                                                                            //进入f1/0接口
R3(config-if)#ip add 192.168.60.1 255.255.255.0                                           //设置IP地址与子网掩码
R3(config-if)#no shut                                                                                             //开启接口
R3(config-if)#exit                                                                                                  //退出
R3(config)#do show ip int b                                                                              //查看接口IP
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            192.168.60.1    YES manual up                    up      

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

(2)启用R3的OSPF协议,并进行相关配置。

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内
R3(config-router)#network 192.168.40.0 0.0.0.255 area 1         //宣告网段,每个网段要宣告在自己的Area内
R3(config-router)#network 192.168.60.0 0.0.0.255 area 1         //宣告网段,每个网段要宣告在自己的Area内
R3(config-router)#exit                                                                     //退出

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

4.R4的配置

(1)给R4各个接口配上IP地址,并检查是否设置成功。

R4#conf t                                                                                                                  //进入全局模式
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)#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)#exit                                                                                                  //退出
R4(config)#do show ip int b                                                                              //查看接口IP
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.40.2    YES manual up                    up      
FastEthernet0/1            192.168.50.1    YES manual up                    up   

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

(2)启用R4的OSPF协议,并进行相关配置。

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 1         //宣告网段,每个网段要宣告在自己的Area内
R4(config-router)#network 192.168.50.0 0.0.0.255 area 0         //宣告网段,每个网段要宣告在自己的Area内
R4(config-router)#exit                                                                    //退出

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

5.查看各路由器的路由表

(1)查看R1路由表,成功学习到所有网段。

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 not set

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0                                                       // C表示直连网段
O IA 192.168.30.0/24 [110/20] via 192.168.20.2, 00:04:43, FastEthernet0/0     //O表示通过ospf协议学习到的,IA表示通过区域间路由(ABR)学习到的
O IA 192.168.60.0/24 [110/21] via 192.168.50.1, 00:00:19, FastEthernet0/1
                     [110/21] via 192.168.20.2, 00:01:53, FastEthernet0/0
C    192.168.10.0/24 is directly connected, FastEthernet1/0
O IA 192.168.40.0/24 [110/20] via 192.168.50.1, 00:00:19, FastEthernet0/1
C    192.168.20.0/24 is directly connected, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/1
R1(config)#

(2)查看R2路由表,成功学习到所有网段。

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/1
O    192.168.60.0/24 [110/11] via 192.168.30.2, 00:02:16, FastEthernet0/1
O    192.168.10.0/24 [110/11] via 192.168.20.1, 00:05:11, FastEthernet0/0
O    192.168.40.0/24 [110/20] via 192.168.30.2, 00:02:16, FastEthernet0/1
C    192.168.20.0/24 is directly connected, FastEthernet0/0
O    192.168.50.0/24 [110/20] via 192.168.20.1, 00:05:11, FastEthernet0/0
R2(config)#

(3)查看R3路由表,成功学习到所有网段。

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 not set

C    192.168.30.0/24 is directly connected, FastEthernet0/0
C    192.168.60.0/24 is directly connected, FastEthernet1/0
O IA 192.168.10.0/24 [110/21] via 192.168.40.2, 00:01:07, FastEthernet0/1
                     [110/21] via 192.168.30.1, 00:02:49, 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:02:49, FastEthernet0/0
O IA 192.168.50.0/24 [110/20] via 192.168.40.2, 00:01:09, FastEthernet0/1
R3(config)#

(4)查看R4路由表,成功学习到所有网段。

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 not set

O    192.168.30.0/24 [110/20] via 192.168.40.1, 00:01:39, FastEthernet0/0
O    192.168.60.0/24 [110/11] via 192.168.40.1, 00:01:39, FastEthernet0/0
O    192.168.10.0/24 [110/11] via 192.168.50.2, 00:01:24, FastEthernet0/1
C    192.168.40.0/24 is directly connected, FastEthernet0/0
O    192.168.20.0/24 [110/20] via 192.168.50.2, 00:01:24, FastEthernet0/1
C    192.168.50.0/24 is directly connected, FastEthernet0/1
R4(config)#

6.PC1与PC2的配置

(1)PC1的配置

PC1> 
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

(2)PC2的配置

PC2> 
PC2> 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

7.实验结果验证

用PC1去pingPC2,结果可以互通,实验成功。

PC1> ping 192.168.60.2
192.168.60.2 icmp_seq=1 timeout
84 bytes from 192.168.60.2 icmp_seq=2 ttl=61 time=61.873 ms
84 bytes from 192.168.60.2 icmp_seq=3 ttl=61 time=56.882 ms
84 bytes from 192.168.60.2 icmp_seq=4 ttl=61 time=62.596 ms
84 bytes from 192.168.60.2 icmp_seq=5 ttl=61 time=59.575 ms

二、OSPF协议的虚链路配置

1.实验环境

本次实验是任在GNS3-1.3.10版本中进行的,具体拓扑图如下:

OSPF动态路由协议(实验篇)OSPF协议的基本配置与虚链路的配置

2.R1的配置

(1)给R1各个接口配上IP地址,并检查是否设置成功。

R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
*Mar  1 00:01:01.679: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:01:02.679: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int f0/1
R1(config-if)#ip add 192.168.20.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
*Mar  1 00:01:54.047: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:01:55.047: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#exit

(2)启用R1的OSPF协议,并宣告网段。

R1(config)#router ospf 1
R1(config-router)#rout
R1(config-router)#router-id 1.1.1.1
R1(config-router)#netw
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)#exit

3.R2的配置

(1)给R2各个接口配上IP地址,并检查是否设置成功。

R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int f0/0
R2(config-if)#ip add 192.168.20.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int f0/
*Mar  1 00:03:53.775: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:03:54.775: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#int f0/1
R2(config-if)#ip add 192.168.30.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#
*Mar  1 00:04:14.891: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:04:15.891: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R2(config-if)#exit

(2)启用R2的OSPF协议,并宣告网段。

R2(config)#router ospf 1
R2(config-router)#route           
R2(config-router)#router-id 2.2.2.2
R2(config-router)#netw
R2(config-router)#network 192.168.20.0 0.0.0.255 area 2
*Mar  1 00:05:34.607: %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.0 0.0.0.255 area 1
R2(config-router)#exit

4.R3的配置

(1)给R3各个接口配上IP地址,并检查是否设置成功。

R3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#int f0/0
R3(config-if)#ip add 192.168.30.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int 
*Mar  1 00:06:28.107: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:06:29.107: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#int f0/1
R3(config-if)#ip add 192.168.40.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#
*Mar  1 00:06:47.311: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:06:48.311: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R3(config-if)#exit

(2)启用R3的OSPF协议,并宣告网段。

R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#netw
R3(config-router)#network 192.168.30.0 0.0.0.255 area 1
R3(config-router)#network 192.168.30.0 0.0.0.255 area  
*Mar  1 00:07:41.883: %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)#exit

5.R4的配置

(1)给R4各个接口配上IP地址,并检查是否设置成功。

R4#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R4(config)#int f0/0
R4(config-if)#ip add 192.168.40.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#
*Mar  1 00:08:46.155: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:08:47.155: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R4(config-if)#int f0/1
R4(config-if)#ip add 192.168.50.1 255.255.255.0
R4(config-if)#no shut
R4(config-if)#
*Mar  1 00:10:13.107: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:10:14.107: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R4(config-if)#exit

(2)启用R4的OSPF协议,并宣告网段。

R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#netw
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
R4(config-router)#
*Mar  1 00:11:48.155: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done
R4(config-router)#exit

6.PC1与PC2的配置

(1)PC1的配置

PC1> 
PC1> ip 192.168.10.2 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1

(2)PC2的配置

PC2> 
PC2> ip 192.168.50.2 192.168.50.1
Checking for duplicate address...
PC1 : 192.168.60.2 255.255.255.0 gateway 192.168.60.1

(3)用PC1去pingPC2,结果不通,因为Area2没有骨干区域(Area0)相连。

PC1> ping 192.168.50.2
*192.168.10.1 icmp_seq=1 ttl=255 time=9.295 ms (ICMP type:3, code:1, Destination host unreachable)
*192.168.10.1 icmp_seq=2 ttl=255 time=9.178 ms (ICMP type:3, code:1, Destination host unreachable)
*192.168.10.1 icmp_seq=3 ttl=255 time=11.967 ms (ICMP type:3, code:1, Destination host unreachable)
*192.168.10.1 icmp_seq=4 ttl=255 time=6.846 ms (ICMP type:3, code:1, Destination host unreachable)
*192.168.10.1 icmp_seq=5 ttl=255 time=7.255 ms (ICMP type:3, code:1, Destination host unreachable)

7.查看R1路由表

查看R1路由表,可以看到R1并没有学习到“30、40、50”网段,因为还没有配置虚链路。

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 not set

C    192.168.10.0/24 is directly connected, FastEthernet0/0
C    192.168.20.0/24 is directly connected, FastEthernet0/1
R1(config)#

8.配置虚链路

(1)R2的配置

R2(config)#router ospf 1
R2(config-router)#area 1 v
R2(config-router)#area 1 virtual-link 3.3.3.3
R2(config-router)#
*Mar  1 00:48:46.527: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on OSPF_VL0 from LOADING to FULL, Loading Done
R2(config-router)#exit
R2(config)#

(2)R3的配置

R3(config)#router ospf 1
R3(config-router)#
*Mar  1 00:48:25.207: %OSPF-4-ERRRCV: Received invalid packet: mismatch area ID, from backbone area must be virtual-link but not found from 192.168.30.1, FastEthernet0/0
R3(config-router)#area 1 virtual-link 2.2.2.2
R3(config-router)#
*Mar  1 00:48:45.183: %OSPF-4-ERRRCV: Received invalid packet: mismatch area ID, from backbone area must be virtual-link but not found from 192.168.30.1, FastEthernet0/0
R3(config-router)#
*Mar  1 00:48:46.539: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on OSPF_VL0 from LOADING to FULL, Loading Done
R3(config-router)#exit
R2(config)#

9.检验虚链路是否设置成功

(1)查看R1路由表,可以看到R1已经学习到所有网段。

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 not set

O IA 192.168.30.0/24 [110/20] via 192.168.20.2, 00:05:33, 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:04:22, 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:04:22, FastEthernet0/1
R1(config)#

(2)用PC1去pingPC2,结果可以互通了,实验成功。

PC1> ping 192.168.50.2
192.168.50.2 icmp_seq=1 timeout
84 bytes from 192.168.50.2 icmp_seq=2 ttl=60 time=90.923 ms
84 bytes from 192.168.50.2 icmp_seq=3 ttl=60 time=81.058 ms
84 bytes from 192.168.50.2 icmp_seq=4 ttl=60 time=78.562 ms
84 bytes from 192.168.50.2 icmp_seq=5 ttl=60 time=77.995 ms

(下一篇会综合OSPF、RIP、静态路由、默认路由等,做一个综合的实验,会涉及到路由的重分发)

猜你喜欢

转载自blog.51cto.com/14449541/2439830