IPV4/IPV6双协议栈配置案例

拓扑:

XRV1配置:

===================================================================

hostname XRV1
!

ipv6 unicast-routing

!
interface Loopback0
ip address 192.168.1.1 255.255.255.255
ipv6 address 2001::1/64
ipv6 ospf 100 area 0
!
interface Ethernet0/0
ip address 10.10.1.1 255.255.255.252
ipv6 address 2002::1/64
!
interface Ethernet0/1
ip address 10.10.2.1 255.255.255.252
ip ospf network point-to-point
ipv6 address 2003::2/64
ipv6 ospf 100 area 0
ospfv3 network point-to-point
!
router ospfv3 100
router-id 192.168.1.1
!
address-family ipv6 unicast
exit-address-family
!
router ospf 100
router-id 192.168.1.1
network 10.10.2.0 0.0.0.3 area 0
network 192.168.1.1 0.0.0.0 area 0
!
router bgp 65001
bgp router-id 192.168.1.1
bgp log-neighbor-changes
bgp graceful-restart restart-time 120
bgp graceful-restart stalepath-time 360
bgp graceful-restart
neighbor 10.10.1.2 remote-as 65002
neighbor 2001::3 remote-as 65001
neighbor 2001::3 update-source Loopback0
neighbor 2002::2 remote-as 65002
neighbor 192.168.1.3 remote-as 65001
neighbor 192.168.1.3 update-source Loopback0
!
address-family ipv4
neighbor 10.10.1.2 activate
neighbor 2001::3 activate
no neighbor 2002::2 activate
neighbor 192.168.1.3 activate
neighbor 192.168.1.3 next-hop-self
exit-address-family
!
address-family ipv6
neighbor 2001::3 activate
neighbor 2001::3 next-hop-self
neighbor 2002::2 activate
exit-address-family
!

XRV2配置:

===================================================================

!
hostname XRV2
!
no aaa new-model
clock timezone CST 8 0
mmi polling-interval 60
no mmi auto-configure
no mmi pvc

!
ipv6 unicast-routing
!
interface Loopback0
ip address 192.168.1.2 255.255.255.255
ipv6 address 2001::2/64
ipv6 ospf 100 area 0
!
interface Ethernet0/0
ip address 10.10.1.2 255.255.255.252
ipv6 address 2002::2/64
!
interface Ethernet0/1
ip address 10.10.3.1 255.255.255.252
ip ospf network point-to-point
ipv6 address 2004::2/64
ipv6 ospf 100 area 0
ipv6 ospf network point-to-point
!
router ospfv3 100
router-id 192.168.1.2
!
address-family ipv6 unicast
exit-address-family
!
router ospf 100
router-id 192.168.1.2
network 10.10.3.0 0.0.0.3 area 0
network 192.168.1.2 0.0.0.0 area 0
!
router bgp 65002
bgp router-id 192.168.1.2
bgp log-neighbor-changes
bgp graceful-restart restart-time 120
bgp graceful-restart stalepath-time 360
bgp graceful-restart
neighbor 10.10.1.1 remote-as 65001
neighbor 2001::4 remote-as 65002
neighbor 2001::4 update-source Loopback0
neighbor 2002::1 remote-as 65001
neighbor 192.168.1.4 remote-as 65002
neighbor 192.168.1.4 update-source Loopback0
!
address-family ipv4
neighbor 10.10.1.1 activate
no neighbor 2001::4 activate
no neighbor 2002::1 activate
neighbor 192.168.1.4 activate
neighbor 192.168.1.4 next-hop-self
exit-address-family
!
address-family ipv6
neighbor 2001::4 activate
neighbor 2001::4 next-hop-self
neighbor 2002::1 activate
exit-address-family

XRV3配置:

===================================================================

!
hostname XRV3
!

ip cef
ipv6 unicast-routing
ipv6 cef
!
interface Loopback0
ip address 192.168.1.3 255.255.255.255
ipv6 address 2001::3/64
ipv6 ospf 100 area 0
!
interface Ethernet0/0
ip address 10.10.4.1 255.255.255.252
ip ospf network point-to-point
ipv6 address 2005::1/64
ipv6 ospf 100 area 0
ospfv3 network point-to-point
!
interface Ethernet0/1
ip address 10.10.2.2 255.255.255.252
ip ospf network point-to-point
ipv6 address 2003::1/64
ipv6 ospf 100 area 0
ospfv3 network point-to-point
!
router ospfv3 100
router-id 192.168.1.3
!
address-family ipv6 unicast
exit-address-family
!
router ospf 100
router-id 192.168.1.3
network 10.10.2.0 0.0.0.3 area 0
network 10.10.4.0 0.0.0.3 area 0
network 192.168.1.3 0.0.0.0 area 0
!
router bgp 65001
bgp router-id 192.168.1.3
bgp log-neighbor-changes
bgp graceful-restart restart-time 120
bgp graceful-restart stalepath-time 360
bgp graceful-restart
neighbor 2001::1 remote-as 65001
neighbor 2001::1 update-source Loopback0
neighbor 2001::5 remote-as 65001
neighbor 2001::5 update-source Loopback0
neighbor 192.168.1.1 remote-as 65001
neighbor 192.168.1.1 update-source Loopback0
neighbor 192.168.1.5 remote-as 65001
neighbor 192.168.1.5 update-source Loopback0
!
address-family ipv4
no neighbor 2001::1 activate
no neighbor 2001::5 activate
neighbor 192.168.1.1 activate
neighbor 192.168.1.1 route-reflector-client
neighbor 192.168.1.5 activate
neighbor 192.168.1.5 route-reflector-client
exit-address-family
!
address-family ipv6
neighbor 2001::1 activate
neighbor 2001::1 route-reflector-client
neighbor 2001::5 activate
neighbor 2001::5 route-reflector-client
exit-address-family

XRV4配置:

===================================================================

!
hostname XRV4

!
no ip domain lookup
ip cef
ipv6 unicast-routing
ipv6 cef
!
interface Loopback0
ip address 192.168.1.4 255.255.255.255
ipv6 address 2001::4/64
ipv6 ospf 100 area 0
!
interface Ethernet0/0
ip address 10.10.5.1 255.255.255.252
ip ospf network point-to-point
ipv6 address 2006::1/64
ipv6 ospf 100 area 0
ipv6 ospf network point-to-point
!
interface Ethernet0/1
ip address 10.10.3.2 255.255.255.252
ip ospf network point-to-point
ipv6 address 2004::1/64
ipv6 ospf 100 area 0
ipv6 ospf network point-to-point
!
router ospfv3 100
router-id 192.168.1.4
!
address-family ipv6 unicast
exit-address-family
!
router ospf 100
router-id 192.168.1.4
network 10.10.3.0 0.0.0.3 area 0
network 10.10.5.0 0.0.0.3 area 0
network 192.168.1.4 0.0.0.0 area 0
!
router bgp 65002
bgp router-id 192.168.1.4
bgp log-neighbor-changes
bgp graceful-restart restart-time 120
bgp graceful-restart stalepath-time 360
bgp graceful-restart
neighbor 2001::2 remote-as 65002
neighbor 2001::2 update-source Loopback0
neighbor 2001::6 remote-as 65002
neighbor 2001::6 update-source Loopback0
neighbor 192.168.1.2 remote-as 65002
neighbor 192.168.1.2 update-source Loopback0
neighbor 192.168.1.6 remote-as 65002
neighbor 192.168.1.6 update-source Loopback0
!
address-family ipv4
no neighbor 2001::2 activate
no neighbor 2001::6 activate
neighbor 192.168.1.2 activate
neighbor 192.168.1.2 route-reflector-client
neighbor 192.168.1.6 activate
neighbor 192.168.1.6 route-reflector-client
exit-address-family
!
address-family ipv6
neighbor 2001::2 activate
neighbor 2001::2 route-reflector-client
neighbor 2001::6 activate
neighbor 2001::6 route-reflector-client
exit-address-family
!

XRV5配置:

===================================================================

hostname XRV5
!
ip cef
ipv6 unicast-routing
ipv6 cef
!
interface Loopback0
ip address 192.168.1.5 255.255.255.255
ipv6 address 2001::5/64
ipv6 ospf 100 area 0
!
interface Port-channel10
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface Ethernet0/0
no switchport
ip address 10.10.4.2 255.255.255.252
ip ospf network point-to-point
duplex auto
ipv6 address 2005::2/64
ipv6 ospf 100 area 0
ospfv3 network point-to-point
!
interface Ethernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 10 mode active
!
interface Ethernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 10 mode active
!
interface Ethernet0/3
shutdown
!
interface Vlan1
ip address 10.20.1.254 255.255.255.0
ipv6 address 2011::1/64
!
interface Vlan2
ip address 10.20.2.254 255.255.255.0
ipv6 address 2012::1/64
!
interface Vlan3
ip address 10.20.3.254 255.255.255.0
ipv6 address 2013::1/64
!
interface Vlan4
ip address 10.20.4.254 255.255.255.0
ipv6 address 2014::1/64
!
router ospfv3 100
router-id 192.168.1.5
!
address-family ipv6 unicast
exit-address-family
!
router ospf 100
router-id 192.168.1.5
network 10.10.4.0 0.0.0.3 area 0
network 192.168.1.5 0.0.0.0 area 0
!
router bgp 65001
bgp router-id 192.168.1.5
bgp log-neighbor-changes
bgp graceful-restart restart-time 120
bgp graceful-restart stalepath-time 360
bgp graceful-restart
neighbor 2001::3 remote-as 65001
neighbor 2001::3 update-source Loopback0
neighbor 192.168.1.3 remote-as 65001
neighbor 192.168.1.3 update-source Loopback0
!
address-family ipv4
network 10.20.1.0 mask 255.255.255.0
network 10.20.2.0 mask 255.255.255.0
network 10.20.3.0 mask 255.255.255.0
network 10.20.4.0 mask 255.255.255.0
no neighbor 2001::3 activate
neighbor 192.168.1.3 activate
exit-address-family
!
address-family ipv6
network 2011::/64
network 2012::/64
network 2013::/64
network 2014::/64
neighbor 2001::3 activate
exit-address-family

XRV6配置:

===================================================================

!
hostname XRV6
!
no ip domain-lookup
ip cef
ipv6 unicast-routing
ipv6 cef
!
interface Loopback0
ip address 192.168.1.6 255.255.255.255
ipv6 address 2001::6/64
ipv6 ospf 100 area 0
!
interface Port-channel10
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface Ethernet0/0
no switchport
ip address 10.10.5.2 255.255.255.252
ip ospf network point-to-point
duplex auto
ipv6 address 2006::2/64
ipv6 ospf 100 area 0
ipv6 ospf network point-to-point
!
interface Ethernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 10 mode active
!
interface Ethernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 10 mode active
!
interface Ethernet0/3
!
interface Vlan1
ip address 10.30.1.254 255.255.255.0
ipv6 address 2015::1/64
!
interface Vlan2
ip address 10.30.2.254 255.255.255.0
ipv6 address 2016::2/64
!
interface Vlan3
ip address 10.30.3.254 255.255.255.0
ipv6 address 2017::1/64
!
interface Vlan4
ip address 10.30.4.254 255.255.255.0
ipv6 address 2018::1/64
!
router ospfv3 100
router-id 192.168.1.6
!
address-family ipv6 unicast
exit-address-family
!
router ospf 100
router-id 192.168.1.6
network 10.10.5.0 0.0.0.3 area 0
network 192.168.1.6 0.0.0.0 area 0
!
router bgp 65002
bgp router-id 192.168.1.6
bgp log-neighbor-changes
bgp graceful-restart restart-time 120
bgp graceful-restart stalepath-time 360
bgp graceful-restart
neighbor 2001::4 remote-as 65002
neighbor 2001::4 update-source Loopback0
neighbor 192.168.1.4 remote-as 65002
neighbor 192.168.1.4 update-source Loopback0
!
address-family ipv4
network 10.30.1.0 mask 255.255.255.0
network 10.30.2.0 mask 255.255.255.0
network 10.30.3.0 mask 255.255.255.0
network 10.30.4.0 mask 255.255.255.0
no neighbor 2001::4 activate
neighbor 192.168.1.4 activate
exit-address-family
!
address-family ipv6
network 2015::/64
network 2016::/64
network 2017::/64
network 2018::/64
neighbor 2001::4 activate
exit-address-family
!

XRV7配置:

=========================================================================================================

!
hostname XRV7
!

interface Port-channel10
switchport trunk encapsulation dot1q
!
interface Ethernet0/0
!
interface Ethernet0/1
switchport trunk encapsulation dot1q
channel-group 10 mode active
!
interface Ethernet0/2
switchport trunk encapsulation dot1q
channel-group 10 mode active
!

XRV8配置:

===================================================================

!
hostname XRV8
!

interface Port-channel10
switchport trunk encapsulation dot1q
!
interface Ethernet0/0
!
interface Ethernet0/1
switchport trunk encapsulation dot1q
channel-group 10 mode active
!
interface Ethernet0/2
switchport trunk encapsulation dot1q
channel-group 10 mode active
!

在XRV6上使用show bgp ipv6 unicast summary看V6的邻居关系建立如下图:

在XRV6上使用show bgp ipv6 unicast 查看V6的BGP路由表如下图:

原文地址:https://www.cnblogs.com/networking/p/10303321.html