wKiom1M9q5biTZgtAAEgGJHYZ5Y628.jpg

R1:int s0/0

ip add 12.1.1.1 255.255.255.0

no shu

int lo0

ip add 1.1.1.1 255.255.255.0

router ospf 100

net 12.1.1.0 0.0.0.255 area 0

net 1.1.1.1 0.0.0.0 area 0

router-id 1.1.1.1

R2: int s0/0

ip add 12.1.1.2 255.255.255.0

no shu

int s0/1

ip add 23.1.1.2 255.255.255.0

no shu

router ospf

router-id 2.2.2.2

net 12.1.1.0 0.0.0.255 area 0

net 23.1.1.0 0.0.0.255 area 1

R3: int s0/1

ip add 23.1.1.3 255.255.255.0

no shu

int s0/2

ip add 34.1.1.3 255.255.255.0

no shu

router ospf 100

router-id 3.3.3.3

net 23.1.1.0 0.0.0.255 area 1

net 34.1.1.0 0.0.0.255 area 2

R4: int s0/2

ip add 34.1.1.4 255.255.255.0

no shu

int lo0

ip add 4.4.4.4 255.255.255.0

router ospf 100

net 4.4.4.4 0.0.0.0 area 2

net 34.1.1.0 0.0.0.255 area 2

所有配置完成后,在R1上"show ip route":

wKioL1M9rUuTWewsAADoOcNUgok837.jpg

在R2上"show ip route":

wKiom1M9ra3BlGL_AAEp977IWDs397.jpg

在R4上:

wKiom1M9rdDSmy9UAAC0y3eyihY003.jpg

R4上没有到达骨干区域的路由,不连续的区域之间无法互相学习到路由

解决方法一,在R2和R3之间创建隧道tunnel:

在R2上:

int tunnel 0

ip add 123.1.1.2 255.255.255.0

tunnel source 23.1.1.2

tunnel destination 23.1.1.3

no shu

router ospf 100

net 123.1.1.0 0.0.0.255 area 0

在R3上:

int tunnel 0

ip add 123.1.1.3 255.255.255.0

tunnel source 23.1.1.3

tunnel destination 23.1.1.2

no shu

router ospf 100

net 123.1.1.0 0.0.0.255 area 0

配置完成后,在R1和R4上"show ip route"

wKioL1M9rt-DB0EJAAG_AGW6CXU767.jpg

wKiom1M9rxqy531rAAJzYlWk1hc992.jpg

通过查看路由表可以发现R1和R4可以互ping,通过域间路由OIA实现;

解决办法2,配置虚链路virtual-link实现:

R2上配置:

router ospf 100

area 1 virtual-link 3.3.3.3   (指定邻居)

在R3上配置:

router ospf 100

area 1 virtual-link 2.2.2.2

在R1和R4上查看路由表:

wKioL1M9sJOiGmfOAAG17PzJv5E016.jpg

wKiom1M9sLyhUAkjAAGXz0UuRDw467.jpg


解决方法3,ospf的双向重分布

在R3上重新创建一个ospf 101的进程,把与R4连接的接口宣告进去:

router ospf 101

net 34.1.1.0 0.0.0.255 area 2(之前的ospf 100中有关34.1.1.0网段一定要删除)

在R4上:

router ospf 101

net 34.1.1.0 0.0.0.255 area 2

net 4.4.4.4 0.0.0.0 area 2

再进行ospf的双向重分布,R3上:

router ospf 100

redistribute ospf 101 subnets

router ospf 101

redistribute ospf 100 subnets

配置完成后,在R1和R4上查看路由表:

wKioL1M9tHLCiCmQAAGf-lfmRWQ271.jpg

wKiom1M9tJrALehwAAFzzLZBI5E863.jpg

R1和R4的路由表中出现了重分布的外部路由OE2。