OSPF_第1张图片

 

R1配置:

!

interface Loopback1

 ip address 1.1.1.1 255.255.255.255

!

interface FastEthernet0/0

 no ip address

 duplex full                           //将FastEthernet0/0该全双工模式

!

interface FastEthernet0/0.10

 encapsulation dot1Q 10                //封装子接口10,数字10必须与对端封装号相同

 ip address 10.0.6.1 255.255.255.0

!         

interface FastEthernet0/0.30

 encapsulation dot1Q 30

 ip address 192.168.0.1 255.255.255.0

!

interface Serial1/1

 ip address 10.0.1.1 255.255.255.0

 serial restart-delay 0

!

router eigrp 1

 network 192.168.0.0

 auto-summary

!

router ospf 1

 log-adjacency-changes

 area 1 nssa                             //将区域1设置为nssa区域

 redistribute eigrp 1 subnets            //将EIGRP路由重分发到OSPF中

 network 1.1.1.0 0.0.0.255 area 1

 network 10.0.1.0 0.0.0.255 area 1

 network 10.0.6.0 0.0.0.255 area 1

!

 

R2配置:

interface FastEthernet0/0

 no ip address

 duplex full

!

interface FastEthernet0/0.20

 encapsulation dot1Q 20

 ip address 10.0.7.1 255.255.255.0

!

interface FastEthernet0/0.40

 encapsulation dot1Q 40

 ip address 172.16.1.2 255.255.255.0

!

interface Serial1/0

 ip address 10.0.1.2 255.255.255.0

 ip ospf cost 300

 serial restart-delay 0

!

interface Serial1/1

 ip address 10.0.2.1 255.255.255.0

 serial restart-delay 0

!

router ospf 1

 log-adjacency-changes

 area 1 nssa                              //将区域1设置为nssa区域

 area 2 stub                              //将区域2设置为stub区域

 network 10.0.1.0 0.0.0.255 area 1

 network 10.0.2.0 0.0.0.255 area 2

 network 10.0.7.0 0.0.0.255 area 0

 default-information originate            //将路由重分发到OSPF

!

ip classless

ip route 0.0.0.0 0.0.0.0 172.16.1.1       //配置一条默认路由指向ISP提供商

 

R3配置:

interface Loopback1

 ip address 3.3.3.3 255.255.255.255

!

interface FastEthernet0/0

 no ip address

 shutdown

 duplex half

!

interface Serial1/0

 ip address 10.0.2.2 255.255.255.0

 serial restart-delay 0

!

interface Serial1/1

 ip address 10.0.3.1 255.255.255.0

 serial restart-delay 0

!

router ospf 1

 log-adjacency-changes

 area 2 stub                            //将区域2设置为stub区域

 network 3.3.3.3 0.0.0.0 area 0

 network 10.0.2.0 0.0.0.255 area 2

 network 10.0.3.0 0.0.0.255 area 0

!

 

R4配置:

interface Loopback1

 ip address 4.4.4.4 255.255.255.255

!

interface Serial1/0

 ip address 10.0.3.2 255.255.255.0

 serial restart-delay 0

!

interface Serial1/1

 ip address 10.0.4.1 255.255.255.0

 serial restart-delay 0

!

router ospf 1

 log-adjacency-changes

 network 4.4.4.4 0.0.0.0 area 0

 network 10.0.3.0 0.0.0.255 area 0

 network 10.0.4.0 0.0.0.255 area 0

!

 

R5配置:

interface FastEthernet0/0

 no ip address

 duplex full

!

interface FastEthernet0/0.20

 encapsulation dot1Q 20

 ip address 10.0.7.2 255.255.255.0

!

interface Serial1/0

 ip address 10.0.4.2 255.255.255.0

 serial restart-delay 0

!

interface Serial1/1

 ip address 10.0.5.1 255.255.255.0

 serial restart-delay 0

!

router ospf 1

 log-adjacency-changes

 network 10.0.4.0 0.0.0.255 area 0

 network 10.0.5.0 0.0.0.255 area 0

 network 10.0.7.0 0.0.0.255 area 0

!

 

R6配置:

interface Loopback1

 ip address 6.6.6.6 255.255.255.255

!

interface FastEthernet0/0

 no ip address

 duplex full

!

interface FastEthernet0/0.10

 encapsulation dot1Q 10

 ip address 10.0.6.2 255.255.255.0

!         

interface Serial1/0

 ip address 10.0.5.2 255.255.255.0

 serial restart-delay 0

!

router ospf 1

 log-adjacency-changes

 area 1 nssa                              //将区域1设置为nssa区域

 network 6.6.6.6 0.0.0.0 area 0

 network 10.0.5.0 0.0.0.255 area 0

 network 10.0.6.0 0.0.0.255 area 1

!         

 

R7配置:

interface FastEthernet0/0

 no ip address

 duplex full

!

interface FastEthernet0/0.30

!

interface FastEthernet0/0.40

 encapsulation dot1Q 40

 ip address 172.16.1.1 255.255.255.0

!

ip route 0.0.0.0 0.0.0.0 172.16.1.2      //回程路由,最好是配成静态的

 

 

当所有配置完成后发现在R3和R4上ping不通192.168.1.2  

查看R3和R4路由表发现OSPF标准区域和stub区域没有去往EIGRP网络的路由,当把R2路由器的S1/0端口down后就通了,再次查看路由表会有一项“O E2 192.168.1.0/24 [110/20] via 10.0.2.1, 00:00:02, Serial1/0 ” 的路由条目,这是为什么呢???

  分析:1、R2和R6都是ABR,也就是说nssa区域有两个ABR连OSPF标准区域

        

        2、当R2的S1/0 down后,那就只有R6一个ABR了,这时R3和R4路由表中“O E2 192.168.1.0/24,[110/20] via 10.0.2.1, 00:00:02, Serial1/0”条目消失。说明R6(ABR)不能将7类LSA转5类再发送到OSPF 标准区域中。

        3、查看R2和R6的route-id发现R2route-id要比R6的route-id高,当把R6路由器route-id改成比R2高时,R3和R4就学到“O E2 192.168.1.0/24 [110/20] via 10.0.2.1, 00:00:02,Serial1/0”条目了。这说明当nssa区域用两台或多台ABR时,将使用route-id较高的ABR发送7类LSA转5类。

 

  解决:1、可以修改R2或R6的route-id

        2、可以将R2宣告的10.0.1.0网段删掉

 

  结论:nssa区域用两台或多台ABR时,将使用route-id较高的ABR发送7类LSA转5类。