实验拓扑
实验需求
- R1、R2完成接口IPv6地址的配置;
- R1、R2按图示运行OSPF。R2的三个Loopback接口并不直接激活OSPFv3,而是以重发布的形式注入;
- 在R1、R2上分别执行OSPF路由汇总,使得双方的路由表中关于对方的Loopback只学习到一条汇总路由。
实验步骤及配置
R1、R2完成接口IPv6地址的配置
R1的配置如下:
[R1] ipv6
[R1] interface gigabitEthernet0/0/0
[R1-GgabitEthernet0/0/0] ipv6 enable
[R1-GgabitEthernet0/0/0] ipv6 address 2001:12::1 64
[R1-GgabitEthernet0/0/0] quit
[R1] interface loopback1
[R1-LoopBack1] ipv6 enable
[R1-LoopBack1] ipv6 address 2001:1:1::FFFF 64
[R1] interface loopback2
[R1-LoopBack2] ipv6 enable
[R1-LoopBack2] ipv6 address 2001:1:2::FFFF 64
[R1] interface loopback3
[R1-LoopBack3] ipv6 enable
[R1-LoopBack3] ipv6 address 2001:1:3::FFFF 64
R2的配置如下:
[R2] ipv6
[R2] interface gigabitEthernet0/0/0
[R2-GgabitEthernet0/0/0] ipv6 enable
[R2-GgabitEthernet0/0/0] ipv6 address 2001:12::2 64
[R2-GgabitEthernet0/0/0] quit
[R2] interface loopback1
[R2-LoopBack1] ipv6 enable
[R2-LoopBack1] ipv6 address 2001:2:1::FFFF 64
[R2] interface loopback2
[R2-LoopBack2] ipv6 enable
[R2-LoopBack2] ipv6 address 2001:2:2::FFFF 64
[R2] interface loopback3
[R2-LoopBack3] ipv6 enable
[R2-LoopBack3] ipv6 address 2001:2:3::FFFF 64
R1、R2运行OSPFv3
R1的配置如下:
[R1] ospfv3 1
[R1-ospfv3-1] router-id 1.1.1.1
[R1-ospfv3-1] quit
[R1] interface gigabitEthernet0/0/0
[R1-GgabitEthernet0/0/0] ospfv3 1 area 0
[R1] interface loopback 1
[R1-LoopBack1] ospfv3 1 area 1
[R1] interface loopback 2
[R1-LoopBack2] ospfv3 1 area 1
[R1] interface loopback 3
[R1-LoopBack3] ospfv3 1 area 1
R2的配置如下:
[R2] ospfv3 1
[R2-ospfv3-1] router-id 2.2.2.2
[R2-ospfv3-1] import-route direct #将直连路由重发布到OSPF
[R2-ospfv3-1] quit
[R2] interface gigabitEthernet0/0/0
[R2-GgabitEthernet0/0/0] ospfv3 1 area 0
完成上述配置后,查看一下R1、R2的路由表:
[R1] display ipv6 routing-table protocol ospfv3
Public Routing Table : OSPFv3
Summary Count : 7
OSPFv3 Routing Table's Status : < Active >
Summary Count : 3
Destination : 2001:2:1:: PrefixLength : 64
NextHop : FE80::2E0:FCFF:FE0B:4314 Preference : 150
Cost : 1 Protocol : OSPFv3ASE
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
Destination : 2001:2:2:: PrefixLength : 64
NextHop : FE80::2E0:FCFF:FE0B:4314 Preference : 150
Cost : 1 Protocol : OSPFv3ASE
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
Destination : 2001:2:3:: PrefixLength : 64
NextHop : FE80::2E0:FCFF:FE0B:4314 Preference : 150
Cost : 1 Protocol : OSPFv3ASE
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
R1已经通过OSPFv3学习到R2的三个Loopback接口路由。
[R2] display ipv6 routing-table protocol ospfv3
Public Routing Table : OSPFv3
Summary Count : 4
OSPFv3 Routing Table's Status : < Active >
Summary Count : 3
Destination : 2001:1:1::FFFF PrefixLength : 128
NextHop : FE80::2E0:FCFF:FEB1:416B Preference : 10
Cost : 1 Protocol : OSPFv3
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
Destination : 2001:1:2::FFFF PrefixLength : 128
NextHop : FE80::2E0:FCFF:FEB1:416B Preference : 10
Cost : 1 Protocol : OSPFv3
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
Destination : 2001:1:3::FFFF PrefixLength : 128
NextHop : FE80::2E0:FCFF:FEB1:416B Preference : 10
Cost : 1 Protocol : OSPFv3
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
R2也已经学习到了R1的Loopback接口路由,这些路由在R2的路由表中以/128掩码的形式存在,这是正常的,因为缺省情况下OSPF将Loopback接口视为stub host,因此以主机路由的形式通告之。
R1、R2部署OSPFv3路由汇总
首先在R1上部署路由汇总,将Area 1内的路由汇总成2001:1::/32。R1的配置如下:
[R1] ospfv3 1
[R1-ospfv3-1] area 1
[R1-ospfv3-1-area-0.0.0.1] abr-summary 2001:1:: 32
完成上述配置后,R2的路由表就变精简了,R1不会再将自己Loopback接口的路由以明细的方式通告出去,而是通告一条汇总路由:2001:1::/32:
[R2] display ipv6 routing-table protocol ospf
Public Routing Table : OSPFv3
Summary Count : 2
OSPFv3 Routing Table's Status : < Active >
Summary Count : 1
Destination : 2001:1:: PrefixLength : 32
NextHop : FE80::2E0:FCFF:FEB1:416B Preference : 10
Cost : 1 Protocol : OSPFv3
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D
接着在ASBR R2上执行路由汇总,这种路由汇总方式是对注入到OSPF的外部路由进行的路由汇总,汇总后的路由是2001:2::/32,R2的配置如下:
[R2] ospfv3 1
[R2-ospfv3-1] asbr-summary 2001:2:: 32
完成上述配置后R1的路由表也精简了:
[R1] display ipv6 routing-table protocol ospfv3
Public Routing Table : OSPFv3
Summary Count : 5
OSPFv3 Routing Table's Status : < Active >
Summary Count : 1
Destination : 2001:2:: PrefixLength : 32
NextHop : FE80::2E0:FCFF:FE0B:4314 Preference : 150
Cost : 2 Protocol : OSPFv3ASE
RelayNextHop : :: TunnelID : 0x0
Interface : GigabitEthernet0/0/0 Flags : D