实验目的:

1.通过虚链路的方式使远离骨干区域的区域能够实现收敛

2.通过tunel0的方式进行解决

实验拓扑:

ospf---虚链路_第1张图片

实验步骤:

方法一:通过虚链路解决

R1:

router ospf 1

router-id 1.1.1.1

log-adjacency-changes

network 1.1.1.1 0.0.0.0 area 0

network 10.1.1.1 0.0.0.0 area 0

R2:

router ospf 1

router-id 1.1.1.1

log-adjacency-changes

network 1.1.1.1 0.0.0.0 area 0

network 10.1.1.1 0.0.0.0 area 0

area 1 virtual-link 3.3.3.3

R3:

router ospf 1

log-adjacency-changes

network 3.3.3.3 0.0.0.0 area 1

network 10.1.2.2 0.0.0.0 area 1

network 10.1.3.1 0.0.0.0 area 2

area 1 virtual-link 2.2.2.2

方法二:通过tunnel 解决: 这种方法有点问题:

R1:

router ospf 1

router-id 1.1.1.1

log-adjacency-changes

network 1.1.1.1 0.0.0.0 area 0

network 10.1.1.1 0.0.0.0 area 0

network 192.168.1.0 0.0.0.255 area 2

interface Tunnel0 //tunnel0

ip address 192.168.1.1 255.255.255.0 //写IP地址

tunnel source 10.1.1.1 //出口IP地址

tunnel destination 10.1.2.2 //R3相连的IP地址即建立连接的IP地址

R1#SHOW Ip ospf nei

Neighbor ID Pri State Dead Time Address Interface

2.2.2.2 1 FULL/ - 00:00:39 10.1.1.2 Serial1/1

3.3.3.3 1 FULL/ - 00:00:33 192.168.1.3 Tunnel0

R1#show ip ospf neighbor detail

Neighbor 2.2.2.2, interface address 10.1.1.2

In the area 0 via interface Serial1/1

Neighbor priority is 1, State is FULL, 6 state changes

DR is 0.0.0.0 BDR is 0.0.0.0

Options is 0x42

Dead timer due in 00:00:33

Neighbor is up for 00:54:37

Index 1/1, retransmission queue length 0, number of retransmission 1

First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)

Last retransmission scan length is 1, maximum is 1

Last retransmission scan time is 0 msec, maximum is 0 msec

Neighbor 3.3.3.3, interface address 192.168.1.3

In the area 2 via interface Tunnel0

Neighbor priority is 1, State is FULL, 6 state changes

DR is 0.0.0.0 BDR is 0.0.0.0

Options is 0x42

Dead timer due in 00:00:38

Neighbor is up for 00:21:04

Index 1/2, retransmission queue length 0, number of retransmission 1

First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)

Last retransmission scan length is 1, maximum is 1

Last retransmission scan time is 0 msec, maximum is 0 msec

R1#

R1#show ip route

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

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/24 is subnetted, 1 subnets

C 1.1.1.0 is directly connected, Loopback0

2.0.0.0/32 is subnetted, 1 subnets

O 2.2.2.2 [110/65] via 10.1.1.2, 00:17:09, Serial1/1

3.0.0.0/32 is subnetted, 1 subnets

O IA 3.3.3.3 [110/129] via 10.1.1.2, 00:16:44, Serial1/1

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/11176] via 192.168.1.3, 00:16:44, Tunnel0

10.0.0.0/24 is subnetted, 3 subnets

O 10.1.3.0 [110/11175] via 192.168.1.3, 00:16:44, Tunnel0

O IA 10.1.2.0 [110/128] via 10.1.1.2, 00:16:44, Serial1/1

C 10.1.1.0 is directly connected, Serial1/1

C 192.168.1.0/24 is directly connected, Tunnel0

R1#show ip ospf int tunnel 0

Tunnel0 is up, line protocol is up

Internet Address 192.168.1.1/24, Area 2

Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 11111

Transmit Delay is 1 sec, State POINT_TO_POINT,

Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

Hello due in 00:00:00

Index 1/3, flood queue length 0

Next 0x0(0)/0x0(0)

Last flood scan length is 1, maximum is 1

Last flood scan time is 0 msec, maximum is 0 msec

Neighbor Count is 1, Adjacent neighbor count is 1

Adjacent with neighbor 3.3.3.3

Suppress hello for 0 neighbor(s)

R3:

router ospf 1

log-adjacency-changes

network 3.3.3.3 0.0.0.0 area 1

network 10.1.2.2 0.0.0.0 area 1

network 10.1.3.1 0.0.0.0 area 2

network 192.168.1.0 0.0.0.255 area 2

interface Tunnel0

ip address 192.168.1.3 255.255.255.0

tunnel source 10.1.2.2

tunnel destination 10.1.1.1

R3#show ip route

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

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

O IA 1.1.1.1 [110/129] via 10.1.2.1, 00:18:03, Serial1/0

2.0.0.0/32 is subnetted, 1 subnets

O IA 2.2.2.2 [110/65] via 10.1.2.1, 00:18:03, Serial1/0

3.0.0.0/24 is subnetted, 1 subnets

C 3.3.3.0 is directly connected, Loopback0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/65] via 10.1.3.2, 00:18:03, Serial1/1

10.0.0.0/24 is subnetted, 3 subnets

C 10.1.3.0 is directly connected, Serial1/1

C 10.1.2.0 is directly connected, Serial1/0

O IA 10.1.1.0 [110/128] via 10.1.2.1, 00:18:03, Serial1/0

C 192.168.1.0/24 is directly connected, Tunnel0

R3#show ip ospf nei

Neighbor ID Pri State Dead Time Address Interface

2.2.2.2 1 FULL/ - 00:00:36 10.1.2.1 Serial1/0

1.1.1.1 1 FULL/ - 00:00:31 192.168.1.1 Tunnel0

4.4.4.4 1 FULL/ - 00:00:30 10.1.3.2 Serial1/1

R1#show ip ospf int tunnel 0

Tunnel0 is up, line protocol is up

Internet Address 192.168.1.1/24, Area 2

Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 11111

Transmit Delay is 1 sec, State POINT_TO_POINT,

Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

Hello due in 00:00:08

Index 1/3, flood queue length 0

Next 0x0(0)/0x0(0)

Last flood scan length is 1, maximum is 1

Last flood scan time is 0 msec, maximum is 0 msec

Neighbor Count is 1, Adjacent neighbor count is 1

Adjacent with neighbor 3.3.3.3

Suppress hello for 0 neighbor(s)

实验心得:

在一个ospf自治系统中,如果一个区域与area 0脱离也就是说不与骨干区域相连的话,一般可以通过虚链路的方式解决,但是

可以通过tunnel 的方式解决,类似与×××的隧道技术。

在R2和R3上做:正确的方法是在R2,R3上做。

R1:

R1#SHOW IP ROUTE

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

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/24 is subnetted, 1 subnets

C 1.1.1.0 is directly connected, Loopback0

2.0.0.0/32 is subnetted, 1 subnets

O IA 2.2.2.2 [110/65] via 10.1.1.2, 00:05:38, Serial1/1

3.0.0.0/32 is subnetted, 1 subnets

O IA 3.3.3.3 [110/129] via 10.1.1.2, 00:05:38, Serial1/1

4.0.0.0/32 is subnetted, 1 subnets

O IA 4.4.4.4 [110/11240] via 10.1.1.2, 00:05:38, Serial1/1

10.0.0.0/24 is subnetted, 3 subnets

O IA 10.1.3.0 [110/11239] via 10.1.1.2, 00:05:38, Serial1/1

O IA 10.1.2.0 [110/128] via 10.1.1.2, 00:05:38, Serial1/1

C 10.1.1.0 is directly connected, Serial1/1

O 192.168.1.0/24 [110/11175] via 10.1.1.2, 00:05:38, Serial1/1

R2:

interface Tunnel0

ip address 192.168.1.1 255.255.255.0

tunnel source 10.1.2.1

tunnel destination 10.1.2.2

router ospf 1

log-adjacency-changes

network 2.2.2.2 0.0.0.0 area 1

network 10.1.1.2 0.0.0.0 area 0

network 10.1.2.1 0.0.0.0 area 1

network 192.168.1.1 0.0.0.0 area 0

R2# show ip route

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

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

O 1.1.1.1 [110/65] via 10.1.1.1, 00:04:30, Serial1/0

2.0.0.0/24 is subnetted, 1 subnets

C 2.2.2.0 is directly connected, Loopback0

3.0.0.0/32 is subnetted, 1 subnets

O 3.3.3.3 [110/65] via 10.1.2.2, 00:07:49, Serial1/1

4.0.0.0/32 is subnetted, 1 subnets

O IA 4.4.4.4 [110/11176] via 192.168.1.2, 00:04:30, Tunnel0

10.0.0.0/24 is subnetted, 3 subnets

O IA 10.1.3.0 [110/11175] via 192.168.1.2, 00:04:30, Tunnel0

C 10.1.2.0 is directly connected, Serial1/1

C 10.1.1.0 is directly connected, Serial1/0

C 192.168.1.0/24 is directly connected, Tunnel0

R3:

interface Tunnel0

ip address 192.168.1.2 255.255.255.0

tunnel source 10.1.2.2

tunnel destination 10.1.2.1

router ospf 1

log-adjacency-changes

network 3.3.3.3 0.0.0.0 area 1

network 10.1.2.2 0.0.0.0 area 1

network 10.1.3.1 0.0.0.0 area 2

network 192.168.1.2 0.0.0.0 area 0

R3# show ip route

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

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

O 1.1.1.1 [110/11176] via 192.168.1.1, 00:05:16, Tunnel0

2.0.0.0/32 is subnetted, 1 subnets

O 2.2.2.2 [110/65] via 10.1.2.1, 00:08:31, Serial1/0

3.0.0.0/24 is subnetted, 1 subnets

C 3.3.3.0 is directly connected, Loopback0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/65] via 10.1.3.2, 00:08:31, Serial1/1

10.0.0.0/24 is subnetted, 3 subnets

C 10.1.3.0 is directly connected, Serial1/1

C 10.1.2.0 is directly connected, Serial1/0

O 10.1.1.0 [110/11175] via 192.168.1.1, 00:05:16, Tunnel0

C 192.168.1.0/24 is directly connected, Tunnel0

第三种方法:通过ospf的不同进程的重分布来建立:

在R3上的配置:

router ospf 1

router-id 3.3.3.3

log-adjacency-changes

redistribute ospf 2 subnets 将ospf的进程2重分布进ospf进程1,

network 10.1.2.0 0.0.0.255 area 1

network 33.33.33.0 0.0.0.255 area 1

!

router ospf 2 这里又起了一个ospf的进程,这个进程会和R4的ospf进程建立邻居。

log-adjacency-changes

redistribute ospf 1 subnets 然后将ospf进程1充分布到进程2,这样路由通过进程1学到了,同时路由也得到了同步。

network 10.1.3.1 0.0.0.0 area 2

R3#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

33.0.0.0/24 is subnetted, 1 subnets

C 33.33.33.0 is directly connected, Loopback0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/65] via 10.1.3.2, 00:00:08, Serial1/1

22.0.0.0/32 is subnetted, 1 subnets

O IA 22.22.22.22 [110/65] via 10.1.2.1, 00:08:47, Serial1/0

10.0.0.0/24 is subnetted, 3 subnets

C 10.1.3.0 is directly connected, Serial1/1

C 10.1.2.0 is directly connected, Serial1/0

O IA 10.1.1.0 [110/128] via 10.1.2.1, 00:08:47, Serial1/0

11.0.0.0/32 is subnetted, 1 subnets

O IA 11.11.11.11 [110/129] via 10.1.2.1, 00:08:47, Serial1/0

在R4上的配置:

R4#show run | b r o

router ospf 1

log-adjacency-changes

network 4.4.4.4 0.0.0.0 area 2

network 10.1.3.2 0.0.0.0 area 2

R4# 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

33.0.0.0/24 is subnetted, 1 subnets

O E2 33.33.33.0 [110/1] via 10.1.3.1, 00:03:46, Serial1/0

4.0.0.0/24 is subnetted, 1 subnets

C 4.4.4.0 is directly connected, Loopback4

22.0.0.0/32 is subnetted, 1 subnets

O E2 22.22.22.22 [110/65] via 10.1.3.1, 00:03:46, Serial1/0

10.0.0.0/24 is subnetted, 3 subnets

C 10.1.3.0 is directly connected, Serial1/0

O E2 10.1.2.0 [110/64] via 10.1.3.1, 00:03:46, Serial1/0

O E2 10.1.1.0 [110/128] via 10.1.3.1, 00:03:46, Serial1/0

11.0.0.0/32 is subnetted, 1 subnets

O E2 11.11.11.11 [110/129] via 10.1.3.1, 00:03:46, Serial1/0

这样问题得到解决.