OSPF虚链路

 

1、 OSPF虚链路

 

a、当非主干区域与主干区域AREA0不连续时必须建立虚链路

b、虚链路配置:area area-id virtual-link router-id

area-id:指虚链路经过的中转区的区域id

router-id:指定虚链路另一端的路由器id




OSPF虚链路_第1张图片





OSPF虚链路_第2张图片






R1配置

en
conf t
hostname R1
 
int loopback 0
ip address 1.1.1.1 255.255.255.0
no shutdown
exit
 
int f0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
 
router ospf 1
network 1.1.1.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
exit
end


 

R2配置

 

en
conf t
hostname R2
 
int loopback 0
ip address 2.2.2.2 255.255.255.0
no shutdown
exit
 
int f0/0
ip address 192.168.1.2 255.255.255.0
no shutdown
exit
 
int f0/1
ip address 192.168.2.1 255.255.255.0
no shutdown
exit
 
 
router ospf 1
network 2.2.2.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
network 192.168.2.0 0.0.0.255 area 0
exit
end

 

 

R3配置

 

en
conf t
hostname R3
 
int loopback 0
ip address 3.3.3.3 255.255.255.0
no shutdown
exit
 
int f0/1
ip address 192.168.2.2 255.255.255.0
no shutdown
exit
 
int f0/0
ip address 192.168.3.1 255.255.255.0
no shutdown
exit
 
 
router ospf 1
network 3.3.3.0 0.0.0.255 area 0
network 192.168.2.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.255 area 1
area 1 virtual-link 5.5.5.5
exit
end

 


 

R4配置

en
conf t
hostname R4
 
int loopback 0
ip address 4.4.4.4 255.255.255.0
no shutdown
exit
 
int f0/0
ip address 192.168.3.2 255.255.255.0
no shutdown
exit
 
int f0/1
ip address 192.168.4.1 255.255.255.0
no shutdown
exit
 
 
router ospf 1
network 4.4.4.0 0.0.0.255 area 1
network 192.168.3.0 0.0.0.255 area 1
network 192.168.4.0 0.0.0.255 area 1
exit
end


 

R5配置

en
conf t
hostname R5
 
int loopback 0
ip address 5.5.5.5 255.255.255.0
no shutdown
exit
 
int f0/1
ip address 192.168.4.2 255.255.255.0
no shutdown
exit
 
int f0/0
ip address 192.168.5.1 255.255.255.0
no shutdown
exit
 
 
router ospf 1
network 5.5.5.0 0.0.0.255 area 1
network 192.168.4.0 0.0.0.255 area 1
network 192.168.5.0 0.0.0.255 area 2
area 1 virtual-link 3.3.3.3
exit
end


 

 


R6配置

en
conf t
hostname R6
 
int loopback 0
ip address 6.6.6.6 255.255.255.0
no shutdown
exit
 
int f0/0
ip address 192.168.5.2 255.255.255.0
no shutdown
exit
 
 
 
router ospf 1
network 6.6.6.0 0.0.0.255 area 2
network 192.168.5.0 0.0.0.255 area 2
exit
end


 


 

R6#show ip ospf database

           OSPF Router with ID (6.6.6.6) (Process ID 1)

 

                Router Link States (Area 2)

 

Link ID         ADV Router      Age         Seq#       Checksum Link count

6.6.6.6         6.6.6.6         41          0x80000003 0x0050c8 2

5.5.5.5         5.5.5.5         41          0x80000002 0x00ba90 1

 

                Net Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.5.2     6.6.6.6         41          0x80000001 0x00a0be

 

               Summary Net Link States (Area2)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.2.0     5.5.5.5         21          0x80000001 0x004993

192.168.1.0     5.5.5.5         21          0x80000002 0x005c7f

3.3.3.3         5.5.5.5         21          0x80000003 0x0082b7

2.2.2.2         5.5.5.5         21          0x80000004 0x00b883

1.1.1.1         5.5.5.5         21          0x80000005 0x00ee4f

R6#show ip route

Codes: C - connected, S - static, I - IGRP,R - RIP, M - mobile, B - BGP

      D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPFNSSA external type 2

       E1 - OSPF external type 1, E2 - OSPFexternal type 2, E - EGP

       i - IS-IS, L1 - IS-ISlevel-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/32is subnetted, 1 subnets

O IA   1.1.1.1 [110/6] via 192.168.5.1, 00:00:22, FastEthernet0/0

     2.0.0.0/32is subnetted, 1 subnets

O IA    2.2.2.2 [110/5] via 192.168.5.1, 00:00:22, FastEthernet0/0

     3.0.0.0/32 is subnetted, 1 subnets

O IA    3.3.3.3 [110/4] via 192.168.5.1, 00:00:22, FastEthernet0/0

     6.0.0.0/24 issubnetted, 1 subnets

C      6.6.6.0 is directly connected, Loopback0

O IA 192.168.1.0/24[110/5] via 192.168.5.1, 00:00:22, FastEthernet0/0

O IA 192.168.2.0/24[110/4] via 192.168.5.1, 00:00:22, FastEthernet0/0

C    192.168.5.0/24is directly connected, FastEthernet0/0

 

 

解释:R6能收到域间路由信息,说明虚链路创建成功。


你可能感兴趣的:(OSPF)