构建拓扑
先配IPV4部分
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 23.1.1.1 24
[r2]ip route-static 0.0.0.0 0 23.1.1.2
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip address 34.1.1.1 24
[r3]int lo 0
[r3-LoopBack0]ip add 3.3.3.3 2
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 34.1.1.2 24
[r4]ip route-static 0.0.0.0 0 34.1.1.1
做nat
[r1]ip route-static 0.0.0.0 0 192.168.1.2
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.1.1 24
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 24
[r2-GigabitEthernet0/0/0]q
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r2-acl-basic-2000]q
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]nat outbound 2000
IPV6部分
[r1]ipv6
[r1]int lo 0
[r1-LoopBack0]ipv6 enable
[r1-LoopBack0]ipv6 address 2002:1701:0101::1/65
[r1-LoopBack0]int lo 1
[r1-LoopBack1]ipv6 enable
[r1-LoopBack1]ipv6 address 2002:1701:0101:0:8000::1/65
接口
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ipv6 enable
[r1-GigabitEthernet0/0/1]ipv6 address 2002:1701:0101:1::1/64
[r2]ipv6
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ipv6 enable
[r2-GigabitEthernet0/0/0]ipv6 address 2002:1701:0101:1::2/64
R2环回
[r2-GigabitEthernet0/0/0]int lo 0
[r2-LoopBack0]ipv6 enable
[r2-LoopBack0]ipv6 address 2002:1701:0101:2::1/64
起ripng
[r1]ripng 1
[r1]int lo 0
[r1-LoopBack0]ripng 1 enable
[r1]int lo 1
[r1-LoopBack1]ripng 1 enable
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ripng 1 enable
[r2]ripng 1
[r2]int lo 0
[r2-LoopBack0]ripng 1 enable
[r2-LoopBack0]int g0/0/0
[r2-GigabitEthernet0/0/0]ripng 1 enable
查询是否学到各自环回
[r1]display ipv6 routing-table protocol ripng
将R1上的两个环回汇总
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ripng summary-address 2002:1701:0101:: 64
6 to 4 tunnel
左边
[r2]int Tunnel 0/0/0
[r2-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4
[r2-Tunnel0/0/0]ipv6 enable
[r2-Tunnel0/0/0]ipv6 add 2002:1701:101:3::1/64
[r2-Tunnel0/0/0]source 23.1.1.1
[r2]ipv6 route-static 2002:: 16 Tunnel 0/0/0
[r2]ripng 1
[r2-ripng-1]import-route static
右边
[r4]ipv6
[r4]int lo 0
[r4-LoopBack0]ipv6 enable
[r4-LoopBack0]ipv6 add 2002:2201:0102::1/64
[r4-LoopBack0]int g0/0/1
[r4-GigabitEthernet0/0/1]ipv6 enable
[r4-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:1::1/64
[r5-GigabitEthernet0/0/0]ipv6 address 2002:2201:0102:1::2/64
[r5-LoopBack0]ipv6 address 2002:2201:0102:8000::1/64
[r5-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:8001::1/64
[r6-GigabitEthernet0/0/0] ipv6 address 2002:2201:0102:8001::2/64
[r6-LoopBack0]ipv6 address 2002:2201:0102:8002::1/64
[r6-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:8003::1/64
[r7-GigabitEthernet0/0/0]ipv6 address 2002:2201:0102:8003::2/64
[r7-LoopBack0]ipv6 address 2002:2201:0102:8004::1/64
[r7-GigabitEthernet0/0/1]ipv6 address 2002:2201:0102:8005::1/64
[r8-GigabitEthernet0/0/0]ipv6 address 2002:2201:0102:8005::2/64
[r8-LoopBack0]ipv6 address 2002:2201:0102:8006::1/64
as2起ospfv3
[r5]ospfv3 1
[r5-ospfv3-1]router-id 5.5.5.5
[r5-ospfv3-1]int lo 0
[r5-LoopBack0]ospfv3 1 area 0
[r5-LoopBack0]int g0/0/1
[r5-GigabitEthernet0/0/1]ospfv3 1 area 0
R6\7\8同理
至此R5678ospf已同
起bgp
[r4]bgp 1
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 2002:2201:102:1::2 as-number 2-
[r4-bgp]ipv6-family
[r4-bgp-af-ipv6]peer 2002:2201:102:1::2 enable
[r5]bgp 64512
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 2
[r5-bgp]peer 2002:2201:102:1::1 as-number 1
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 2002:2201:102:1::1 enable
利用IPV6多宿主特点在环回在配置一个ip地址便于bgp配置
[r5]int lo 0
[r5-LoopBack0]ipv6 address 5::5/64----R6\7\8同理
R5R7 EBGP
[r5]bgp 64512
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 2
[r5-bgp]peer 6::6 as-number 64512
[r5-bgp]peer 6::6 connect-interface lo 0 5::5
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 6::6 enable
[r7]bgp 64512
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 2
[r7-bgp]peer 6::6 as-number 64512
[r7-bgp]peer 6::6 connect-interface lo 0 7::7
[r7-bgp]peer 8::8 as-number 64513
[r7-bgp]peer 8::8 connect-interface lo 0 7::7
[r7-bgp]peer 8::8 ebgp-max-hop 2
[r7-bgp]ipv6-family
[r7-bgp-af-ipv6]peer 6::6 enable
[r7-bgp-af-ipv6]pee 8::8 enable
右边起tunnel
[r4]int Tunnel 0/0/0
[r4-Tunnel0/0/0]tunnel-protocol ipv6 6to4
[r4-Tunnel0/0/0]ipv6 enable
[r4-Tunnel0/0/0]ipv6 address 2002:2201:0102:2::1/64
[r4-Tunnel0/0/0]source 34.1.1.2
[r4]ipv6 route-static 2002:: 16 Tunnel 0/0/0
[r4]bgp 1
[r4-bgp]ipv6-family
将tunnel宣告到右边区域传给R5\6\7\8
[r4-bgp-af-ipv6]network 2002:: 16
由于R4\R5为EBGP关系,因此R4传给R5时R5学到的此条目为优,但R5\R6为IBGP,只能传一跳,此时需要在EBGPR5上改下一跳属性,使R6学到此路由条目为优
[r5]bgp 64512
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 6::6 next-hop-local
解决ibgp水平分割
[r6]bgp 64512
[r6-bgp]ipv6-family
[r6-bgp-af-ipv6]peer 7::7 reflect-client
在R5上汇总
[r5]ipv6 route-static 2002:2201:0102:8000:: 49 null 0
[r5]bgp 64512
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]network 2002:2201:0102:8000:: 49
注:在做实验的过程中因为路由器不能用其他只能使用Router名称的路由器也就是软件自带而不是注册的路由器 所以 ripng 功能不能启用 ospfv3功能也不能使用,别问我怎么知道的,TvT, 所以只能在网页上搜寻一样的题来进行学习