OSPF NSSA 负载均衡

网络工程 思科 路由 ospf
2021-07-20 01:07:50

我有一个 OSPF 网络划分为 2 个区域,如下图所示。 在此处输入图片说明

区域 4 配置为无摘要的 NSSA,仅接收默认路由。路由器 R3、R4、R5 正在重新分配相同的 IP 地址 100.0.0.1(本地配置的环回接口)。我的问题是 R2 安装了 3 条到目的地的路由(OSPF NSSA 外部类型 2),而 R1 只安装了一个(OSPF 外部类型 2)。

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/32 is subnetted, 1 subnets
O       1.1.1.1 [110/2] via 10.0.12.1, 00:10:38, FastEthernet0/1
     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback0
     100.0.0.0/32 is subnetted, 1 subnets
O N2    100.0.0.1 [110/20] via 10.0.99.5, 00:03:45, FastEthernet0/0
                  [110/20] via 10.0.99.4, 00:04:14, FastEthernet0/0
                  [110/20] via 10.0.99.3, 00:04:33, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 10.0.99.3, 00:11:17, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/2] via 10.0.99.4, 00:11:17, FastEthernet0/0
     5.0.0.0/32 is subnetted, 1 subnets
O       5.5.5.5 [110/2] via 10.0.99.5, 00:11:18, FastEthernet0/0
     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C       10.0.12.0/30 is directly connected, FastEthernet0/1
C       10.0.27.0/30 is directly connected, FastEthernet1/0
O       10.0.16.0/30 [110/2] via 10.0.12.1, 00:10:40, FastEthernet0/1
O       10.0.67.0/30 [110/2] via 10.0.27.2, 00:11:28, FastEthernet1/0
C       10.0.99.0/24 is directly connected, FastEthernet0/0

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/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/2] via 10.0.12.2, 00:12:06, FastEthernet0/1
     100.0.0.0/32 is subnetted, 1 subnets
O E2    100.0.0.1 [110/20] via 10.0.99.5, 00:05:02, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 10.0.99.3, 00:12:06, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/2] via 10.0.99.4, 00:12:06, FastEthernet0/0
     5.0.0.0/32 is subnetted, 1 subnets
O       5.5.5.5 [110/2] via 10.0.99.5, 00:12:07, FastEthernet0/0
     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C       10.0.12.0/30 is directly connected, FastEthernet0/1
O       10.0.27.0/30 [110/2] via 10.0.12.2, 00:12:07, FastEthernet0/1
C       10.0.16.0/30 is directly connected, FastEthernet1/0
O       10.0.67.0/30 [110/2] via 10.0.16.2, 00:12:07, FastEthernet1/0
C       10.0.99.0/24 is directly connected, FastEthernet0/0

我知道其中一个路由器执行 Type7/5 转换(在这种情况下,R2 具有更高的路由器 ID),因此它安装了 3 个所有路由。

我的问题是,是否可以对流量进行负载平衡,以便所有 3 条路由也安装在 R1 上?如果没有,是否可以从 R1 删除到 100.0.0.1 的路由,以便流量仅通过 R2(在我的情况下,PBR 不是一个选项)。

路由器配置:

*********         R1        *************
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
 ip ospf 1 area 0
!         
interface FastEthernet0/0
 ip address 10.0.99.1 255.255.255.0
 ip ospf 1 area 4
!         
interface FastEthernet0/1
 ip address 10.0.12.1 255.255.255.252
 ip ospf 1 area 0
!         
interface FastEthernet1/0
 ip address 10.0.16.1 255.255.255.252
 ip ospf 1 area 0     
!         
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 area 4 nssa no-summary
!
*********         R2        *************
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
 ip ospf 1 area 0
!
interface FastEthernet0/0
 ip address 10.0.99.2 255.255.255.0
 ip ospf 1 area 4
!
interface FastEthernet0/1
 ip address 10.0.12.2 255.255.255.252
 ip ospf 1 area 0
!         
interface FastEthernet1/0
 ip address 10.0.27.1 255.255.255.252
 ip ospf 1 area 0
!
!
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 area 4 nssa no-summary
!
*********         R3        *************
!
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
 ip ospf 1 area 4
!
interface Loopback1
 ip address 100.0.0.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.0.99.3 255.255.255.0
 ip ospf 1 area 4
!
router ospf 1
 router-id 3.3.3.3
 log-adjacency-changes
 area 4 nssa no-summary
 redistribute connected subnets
!
*********         R4        *************
!
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
 ip ospf 1 area 4
!
interface Loopback1
 ip address 100.0.0.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.0.99.4 255.255.255.0
 ip ospf 1 area 4
!
router ospf 1
 router-id 4.4.4.4
 log-adjacency-changes
 area 4 nssa no-summary
 redistribute connected subnets
!
*********         R5        *************
!
interface Loopback0
 ip address 5.5.5.5 255.255.255.255
 ip ospf 1 area 4
!
interface Loopback1
 ip address 100.0.0.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 10.0.99.5 255.255.255.0
 ip ospf 1 area 4
!
router ospf 1
 router-id 5.5.5.5
 log-adjacency-changes
 area 4 nssa no-summary
 redistribute connected subnets

显示 ip ospf 数据库:

R1

R1# show ip ospf database 

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

        Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         35          0x80000003 0x00A5F4 3
2.2.2.2         2.2.2.2         34          0x80000003 0x00E88E 3
10.0.67.1       10.0.67.1       39          0x80000003 0x00FAB3 2
10.0.67.2       10.0.67.2       40          0x80000003 0x00F79D 2

        Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.12.2       2.2.2.2         37          0x80000001 0x00AC64
10.0.16.2       10.0.67.1       41          0x80000001 0x00EE91
10.0.27.2       10.0.67.2       40          0x80000001 0x00ABC3
10.0.67.2       10.0.67.2       44          0x80000001 0x00748C

        Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
3.3.3.3         1.1.1.1         25          0x80000001 0x00F436
3.3.3.3         2.2.2.2         35          0x80000001 0x00D650
4.4.4.4         1.1.1.1         39          0x80000001 0x00C660
4.4.4.4         2.2.2.2         39          0x80000001 0x00A87A
5.5.5.5         1.1.1.1         39          0x80000001 0x00988A
5.5.5.5         2.2.2.2         39          0x80000001 0x007AA4
10.0.99.0       1.1.1.1         80          0x80000001 0x00AD1D
10.0.99.0       2.2.2.2         83          0x80000001 0x008F37

        Router Link States (Area 4)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         42          0x80000002 0x00CB74 1
2.2.2.2         2.2.2.2         43          0x80000002 0x008DA9 1
3.3.3.3         3.3.3.3         43          0x80000002 0x00D041 2
4.4.4.4         4.4.4.4         52          0x80000002 0x00E420 2
5.5.5.5         5.5.5.5         51          0x80000002 0x00F8FE 2

        Net Link States (Area 4)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.99.5       5.5.5.5         43          0x80000002 0x00ACB7

        Summary Net Link States (Area 4)

Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         1.1.1.1         86          0x80000001 0x001B17
0.0.0.0         2.2.2.2         89          0x80000001 0x00FC31

        Type-7 AS External Link States (Area 4)

Link ID         ADV Router      Age         Seq#       Checksum Tag
100.0.0.1       3.3.3.3         86          0x80000001 0x006CAC 0
100.0.0.1       4.4.4.4         97          0x80000001 0x008090 0
100.0.0.1       5.5.5.5         94          0x80000001 0x009474 0

        Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
100.0.0.1       2.2.2.2         29          0x80000001 0x0051D1 0

R2

R2#show ip ospf database 

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

        Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         72          0x80000003 0x00A5F4 3
2.2.2.2         2.2.2.2         69          0x80000003 0x00E88E 3
10.0.67.1       10.0.67.1       76          0x80000003 0x00FAB3 2
10.0.67.2       10.0.67.2       75          0x80000003 0x00F79D 2

        Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.12.2       2.2.2.2         72          0x80000001 0x00AC64
10.0.16.2       10.0.67.1       77          0x80000001 0x00EE91
10.0.27.2       10.0.67.2       75          0x80000001 0x00ABC3
10.0.67.2       10.0.67.2       80          0x80000001 0x00748C

        Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
3.3.3.3         1.1.1.1         62          0x80000001 0x00F436
3.3.3.3         2.2.2.2         70          0x80000001 0x00D650
4.4.4.4         1.1.1.1         75          0x80000001 0x00C660
4.4.4.4         2.2.2.2         73          0x80000001 0x00A87A
5.5.5.5         1.1.1.1         75          0x80000001 0x00988A
5.5.5.5         2.2.2.2         73          0x80000001 0x007AA4
10.0.99.0       1.1.1.1         117         0x80000001 0x00AD1D
10.0.99.0       2.2.2.2         115         0x80000001 0x008F37

        Router Link States (Area 4)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         79          0x80000002 0x00CB74 1
2.2.2.2         2.2.2.2         76          0x80000002 0x008DA9 1
3.3.3.3         3.3.3.3         78          0x80000002 0x00D041 2
4.4.4.4         4.4.4.4         87          0x80000002 0x00E420 2
5.5.5.5         5.5.5.5         87          0x80000002 0x00F8FE 2

        Net Link States (Area 4)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.99.5       5.5.5.5         77          0x80000002 0x00ACB7

        Summary Net Link States (Area 4)

Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         1.1.1.1         122         0x80000001 0x001B17
0.0.0.0         2.2.2.2         121         0x80000001 0x00FC31

        Type-7 AS External Link States (Area 4)

Link ID         ADV Router      Age         Seq#       Checksum Tag
100.0.0.1       3.3.3.3         120         0x80000001 0x006CAC 0
100.0.0.1       4.4.4.4         131         0x80000001 0x008090 0
100.0.0.1       5.5.5.5         128         0x80000001 0x009474 0

        Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
100.0.0.1       2.2.2.2         63          0x80000001 0x0051D1 0

更新

所以我找到了问题的部分解决方案。如果无法实现负载共享,我只想通过其中一个路由器(R1 或 R2)路由流量。如果我们抑制 R2 上的转发地址,这是可能的。这会强制区域 0 中的其他路由器使用 R2 作为通往 100.0.0.1 IP 地址的网关。

必须在 R2 上添加以下命令。

router ospf 1
 area 4 nssa translate type7 suppress-fa
2个回答

我注意到您的配置中存在一个问题。您的 ASBR (R3-5) 和 ABR (R1-2)area 4 nssa no-summary 根据 NSSA 区域的配置指南进行配置http://www.cisco.com/c/en/us/support/docs/ip/open-shortest- path-first-ospf/6208-nssa.html你应该只在 ABR 上发布 no-summary。

我对这个拓扑进行了实验,并且根据需要在 R1 和 R2 上安装了 3 条路由。

的输出是show ip ospf | i NSSA什么?

它应该是

R1#show ip ospf | i NSSA
 Supports NSSA (compatible with RFC 3101)
        It is a NSSA area

如果输出显示 RFC 1587,则必须在 OSPF 进程下禁用它

router ospf 1  
 no compatible rfc1587