NSSA区域处于边界引入默认路由该怎么处理呢?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NSSA区域处于边界引入默认路由该怎么处理呢?相关的知识,希望对你有一定的参考价值。

如下图的拓扑所示,内部网络的路由连接internet上,边界的路由器的内部网口属于ospf的NSSA区域,路由器上配置相应的默认路由指向internet的下一跳。内部网络中跑着不同协议的路由信息,保证内部的OSPF区域当中还需要引入其他类型的路由信息;并且要保证内部网络能够正常访问internet(在边界的路由器上做NAT暂时忽略,保证网络的连通性 )

怎么保证内部的网络能够正常访问internet呢?

具体的配置信息如下:

R5的路由配置信息:

router ospf 1
 log-adjacency-changes
 area 1 nssa
 redistribute connected subnets
 redistribute static subnets
 network 192.168.4.0 0.0.0.255 area 1
ip route 0.0.0.0 0.0.0.0 192.168.5.6

R4的路由配置信息:

router ospf 1
 log-adjacency-changes
 area 1 nssa default-information-originate no-summary
 network 4.4.4.0 0.0.0.255 area 1
 network 192.168.3.0 0.0.0.255 area 0
 network 192.168.4.0 0.0.0.255 area 1
!

R3的路由配置信息:

router ospf 1
 log-adjacency-changes
 redistribute rip metric 1 subnets
 network 3.3.3.0 0.0.0.255 area 0
 network 192.168.2.0 0.0.0.255 area 3
 network 192.168.3.0 0.0.0.255 area 0
!
router rip
 version 2
 redistribute ospf 1 metric 2
 network 192.168.1.0
 no auto-summary

R2路由配置信息:

router ospf 1
 log-adjacency-changes
 network 2.2.2.0 0.0.0.255 area 3
 network 192.168.2.0 0.0.0.255 area 3

R1路由配置信息:

router rip
 version 2
 network 1.0.0.0
 network 192.168.1.0
 no auto-summary
查看R1的路由信息

R1#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/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback1
     2.0.0.0/32 is subnetted, 1 subnets
R       2.2.2.2 [120/2] via 192.168.1.3, 00:00:16, FastEthernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
R       3.3.3.0 [120/2] via 192.168.1.3, 00:00:16, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
R       4.4.4.4 [120/2] via 192.168.1.3, 00:00:16, FastEthernet0/0
     5.0.0.0/24 is subnetted, 1 subnets
R       5.5.5.0 [120/2] via 192.168.1.3, 00:00:16, FastEthernet0/0
R    192.168.4.0/24 [120/2] via 192.168.1.3, 00:00:16, FastEthernet0/0
R    192.168.5.0/24 [120/2] via 192.168.1.3, 00:00:16, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Loopback10
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R    192.168.2.0/24 [120/2] via 192.168.1.3, 00:00:17, FastEthernet0/0
R    192.168.3.0/24 [120/2] via 192.168.1.3, 00:00:17, FastEthernet0/0
查看R2的路由信息:

R2#  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/24 is subnetted, 1 subnets
O E2    1.1.1.0 [110/1] via 192.168.2.3, 04:44:05, FastEthernet0/1
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback2
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/2] via 192.168.2.3, 05:06:48, FastEthernet0/1
     4.0.0.0/32 is subnetted, 1 subnets
O IA    4.4.4.4 [110/12] via 192.168.2.3, 05:06:48, FastEthernet0/1
     5.0.0.0/24 is subnetted, 1 subnets
O E2    5.5.5.0 [110/20] via 192.168.2.3, 04:43:55, FastEthernet0/1
O IA 192.168.4.0/24 [110/21] via 192.168.2.3, 04:44:05, FastEthernet0/1
O E2 192.168.5.0/24 [110/20] via 192.168.2.3, 04:43:55, FastEthernet0/1
O E2 192.168.1.0/24 [110/1] via 192.168.2.3, 04:44:05, FastEthernet0/1
C    192.168.2.0/24 is directly connected, FastEthernet0/1
O IA 192.168.3.0/24 [110/11] via 192.168.2.3, 05:06:49, FastEthernet0/1

查看R5路由的信息:

R5#   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 192.168.5.6 to network 0.0.0.0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/11] via 192.168.4.4, 00:09:53, Ethernet1/0
     5.0.0.0/24 is subnetted, 1 subnets
C       5.5.5.0 is directly connected, Loopback5
C    192.168.4.0/24 is directly connected, Ethernet1/0
C    192.168.5.0/24 is directly connected, Ethernet1/2
S*   0.0.0.0/0 [1/0] via 192.168.5.6

R5的LSDB信息:

R5#show ip ospf database
            OSPF Router with ID (5.5.5.5) (Process ID 1)
                Router Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum Link count
4.4.4.4         4.4.4.4         618         0x80000007 0x00A253 2
5.5.5.5         5.5.5.5         601         0x80000006 0x003ED1 1
                Net Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum
192.168.4.5     5.5.5.5         627         0x80000001 0x001277
                Summary Net Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         4.4.4.4         473         0x80000001 0x00C065
                Type-7 AS External Link States (Area 1)
Link ID         ADV Router      Age         Seq#       Checksum Tag
0.0.0.0         4.4.4.4         482         0x80000001 0x005D34 0
5.5.5.0         5.5.5.5         715         0x80000001 0x00B24E 0
192.168.5.0     5.5.5.5         715         0x80000001 0x007E23 0

查看到R1上的LSDB也会产生相应的7类0.0.0.0的默认路由LSA,但是查看路由表中只有一条去往internet的默认路由;为什么没有产生一条去往R2的默认路由呢?

是由于路由的管理距离起的作用,默认路由的管理距离是1 ,ospf的管理距离是110,管理距离是越小越优先,所以就没有产生ospf的默认路由

解决方案:1、要么修改Area 1的属性,nssa区域修改成普通的area区域并要在边界路由器的上注入默认路由(命令:default-information originate),保证内部网络能够正常访问internet网络

修改后:查看到的R1/R2上路由信息都能够学习到一条外部引入的默认路由信息

具体的修改信息如下:

修改后R5的配置如下:

 log-adjacency-changes
 redistribute connected subnets
 redistribute static subnets
 network 192.168.4.0 0.0.0.255 area 1
 default-information originate
!
ip route 0.0.0.0 0.0.0.0 192.168.5.6

R4的配置信息:

router ospf 1
 log-adjacency-changes
 network 4.4.4.0 0.0.0.255 area 1
 network 192.168.3.0 0.0.0.255 area 0
 network 192.168.4.0 0.0.0.255 area 1
!
查看R1的路由信息:

R1#            show ip ro
R1#            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 192.168.1.3 to network 0.0.0.0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback1
     2.0.0.0/32 is subnetted, 1 subnets
R       2.2.2.2 [120/2] via 192.168.1.3, 00:00:13, FastEthernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
R       3.3.3.0 [120/2] via 192.168.1.3, 00:00:13, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
R       4.4.4.4 [120/2] via 192.168.1.3, 00:00:13, FastEthernet0/0
     5.0.0.0/24 is subnetted, 1 subnets
R       5.5.5.0 [120/2] via 192.168.1.3, 00:00:13, FastEthernet0/0
R    192.168.4.0/24 [120/2] via 192.168.1.3, 00:00:13, FastEthernet0/0
R    192.168.5.0/24 [120/2] via 192.168.1.3, 00:00:13, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Loopback10
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R    192.168.2.0/24 [120/2] via 192.168.1.3, 00:00:14, FastEthernet0/0
R    192.168.3.0/24 [120/2] via 192.168.1.3, 00:00:14, FastEthernet0/0
R*   0.0.0.0/0 [120/2] via 192.168.1.3, 00:00:14, FastEthernet0/0

查看R2的路由信息:

R2#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 192.168.2.3 to network 0.0.0.0

     1.0.0.0/24 is subnetted, 1 subnets
O E2    1.1.1.0 [110/1] via 192.168.2.3, 00:04:04, FastEthernet0/1
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback2
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/2] via 192.168.2.3, 05:25:49, FastEthernet0/1
     4.0.0.0/32 is subnetted, 1 subnets
O IA    4.4.4.4 [110/12] via 192.168.2.3, 05:25:49, FastEthernet0/1
     5.0.0.0/24 is subnetted, 1 subnets
O E2    5.5.5.0 [110/20] via 192.168.2.3, 00:04:04, FastEthernet0/1
O IA 192.168.4.0/24 [110/21] via 192.168.2.3, 00:04:19, FastEthernet0/1
O E2 192.168.5.0/24 [110/20] via 192.168.2.3, 00:04:04, FastEthernet0/1
O E2 192.168.1.0/24 [110/1] via 192.168.2.3, 00:04:04, FastEthernet0/1
C    192.168.2.0/24 is directly connected, FastEthernet0/1
O IA 192.168.3.0/24 [110/11] via 192.168.2.3, 05:25:49, FastEthernet0/1
O*E2 0.0.0.0/0 [110/1] via 192.168.2.3, 00:03:40, FastEthernet0/1

查看R2的LSDB信息:

R2#show ip ospf database
            OSPF Router with ID (2.2.2.2) (Process ID 1)
                Router Link States (Area 3)
Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         602         0x8000000D 0x005AC8 2
3.3.3.3         3.3.3.3         1666        0x8000000C 0x001F12 1
                Net Link States (Area 3)
Link ID         ADV Router      Age         Seq#       Checksum
192.168.2.2     2.2.2.2         602         0x8000000B 0x004E58
                Summary Net Link States (Area 3)
Link ID         ADV Router      Age         Seq#       Checksum
3.3.3.3         3.3.3.3         682         0x8000000B 0x009A7F
4.4.4.4         3.3.3.3         682         0x8000000B 0x00D03B
192.168.3.0     3.3.3.3         682         0x8000000D 0x00A806
192.168.4.0     3.3.3.3         396         0x80000001 0x001A95
                Summary ASB Link States (Area 3)
Link ID         ADV Router      Age         Seq#       Checksum
5.5.5.5         3.3.3.3         391         0x80000001 0x000305
                Type-5 AS External Link States
Link ID         ADV Router      Age         Seq#       Checksum Tag
0.0.0.0         5.5.5.5         359         0x80000001 0x00A4F9 1
1.1.1.0         3.3.3.3         1667        0x8000000A 0x009803 0
5.5.5.0         5.5.5.5         433         0x80000001 0x009CE0 0
192.168.1.0     3.3.3.3         1667        0x8000000A 0x00FF34 0
192.168.5.0     5.5.5.5         433         0x80000001 0x0068B5 0
网络测试:
R2# ping 6.6.6.6   模拟的外部internet网络
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/73/104 ms
R2#tracerou 6.6.6.6
Type escape sequence to abort.
Tracing the route to 6.6.6.6
  1 192.168.2.3 28 msec 12 msec 20 msec
  2 192.168.3.4 8 msec 24 msec 32 msec
  3 192.168.4.5 32 msec 40 msec 80 msec
  4 192.168.5.6 104 msec 60 msec 72 msec

以上是关于NSSA区域处于边界引入默认路由该怎么处理呢?的主要内容,如果未能解决你的问题,请参考以下文章

8. OSPF的NSSA详解

简单搭建OSPF,RIP,NSSA,外部路由汇总网络拓扑

路由重分发及配置

路由基础之OSPF NSSA区域

验证OSPF的NSSA区域ABR对LSA的七转五

日常笔记--OSPF nssa区域和不连续区域联通