实验目的
实验步骤
1、首先配置IPV4的公网和私网
R1:
R2:
R3:
R4:
2、配置IPV6内部子网划分
由于R1左面的骨干链路的ipv4地址为23.1.1.1,所以可以根据这个ipv4地址规划出可以使用的ipv6地址。
将23.1.1.1写为二进制格式,然后再根据ipv6的4个二进制为一位得到了1701:0101,所以得到了ipv6地址2002:1701:0101::/48,然后网络位向主机位借16位,得到2002:1701:0101:0000::/64,它的可用范围为2002:1701:0101:0000::/64 -- 2002:1701:0101:FFFF::/64。
在给R1环回配置ipv6时,可以取出2002:1701:0101:0000::/64,然后再借一位,就变成了2002:1701:0101:0000::/65和2002:1701:0101:0000:8000::/65。
[r1]ipv6
[r1]int lo0
[r1-LoopBack0]ipv6 enable
[r1-LoopBack0]ipv6 address 2002:1701:0101:0000::1 65
[r1-LoopBack0]int lo1
[r1-LoopBack1]ipv6 enable
[r1-LoopBack1]ipv6 address 2002:1701:0101:0000:8000::1 65
然后R1与R2一次往后取
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ipv6 enable
[r1-GigabitEthernet0/0/0]ipv6 address 2002:1701:0101:1::1 64
[r2]ipv6
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ipv6 enable
[r2-GigabitEthernet0/0/1]ipv6 address 2002:1701:0101:1::2 64
[r2-GigabitEthernet0/0/1]int lo0
[r2-LoopBack0]ipv6 enable
[r2-LoopBack0]ipv6 address 2002:1701:0101:2::1 64
3、将IPV6内部子网互通
R1:
[r1]ripng 1
[r1-ripng-1]q
[r1]int lo0
[r1-LoopBack0]ripng 1 enable
[r1-LoopBack0]int lo1
[r1-LoopBack1]ripng 1 enable
[r1-LoopBack1]int g0/0/0
[r1-GigabitEthernet0/0/0]ripng 1 enable
R2:
[r2]ripng 1
[r2-ripng-1]q
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ripng 1 enable
[r2]int lo0
[r2-LoopBack0]ripng 1 enable
4、配置6to4tunnel
R2:
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ipv6 enable
[r2-Tunnel0/0/0]ipv6 address 2002:1701:0101:3::1 64
[r2-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4
[r2-Tunnel0/0/0]source 23.1.1.1
[r2-Tunnel0/0/0]q
[r2]ipv6 route-static 2002:: 16 Tunnel 0/0/0
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ripng default-route only
5、配置右边区域的IPV6
由于R4左面的接口时唯一与公网连接的接口,所以在配置IPV6地址时需要将这个接口的地址转换为IPV6地址。
这个接口的地址为34.1.1.2,所以将这个ipv4地址转换为ipv6地址后为2002:2201:0102::/48。
由于右边的区域有两个AS,所以可以将这个地址一分为二,变成2002:2201:0102::/49(AS1)和2002:2201:0102:8000::/49(AS2)。
AS1的地址取值范围为:2002:2201:0102::/64 -- 2002:2201:0102:7FFF::/64
AS2的地址取值范围为:2002:2201:0102:8000::/64 -- 2002:2201:0102:FFFF::/64
R4:
R5:
R6:
R7:
R8:
6、配置AS2中的OSPFV3
R5:
[r5]ospfv3 1
[r5-ospfv3-1]router-id 5.5.5.5
[r5-ospfv3-1]int lo0
[r5-LoopBack0]ospfv3 1 area 0
[r5-LoopBack0]int g0/0/0
[r5-GigabitEthernet0/0/0]ospfv3 1 area 0
R6:
[r6]ospfv3 1
[r6-ospfv3-1]router-id 6.6.6.6
[r6-ospfv3-1]int g0/0/1
[r6-GigabitEthernet0/0/1]ospfv3 1 area 0
[r6-GigabitEthernet0/0/1]int lo0
[r6-LoopBack0]ospfv3 1 area 0
[r6-LoopBack0]int g0/0/0
[r6-GigabitEthernet0/0/0]ospfv3 1 area 0
R7:
[r7]ospfv3 1
[r7-ospfv3-1]int lo0
[r7-LoopBack0]ospfv3 1 area 0
[r7-ospfv3-1]router-id 7.7.7.7
[r7-ospfv3-1]int g0/0/1
[r7-GigabitEthernet0/0/1]ospfv3 1 area 0
[r7-GigabitEthernet0/0/1]int g0/0/0
[r7-GigabitEthernet0/0/0]ospfv3 1 area
R8:
[r8]ospfv3 1
[r8-ospfv3-1]router-id 8.8.8.8
[r8-ospfv3-1]int lo0
[r8-LoopBack0]ospfv3 1 area 0
7、配置BGP
R4:
[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:
[r5]bgp 64512
[r5-bgp]router-id 5.5.5.5
[r5-bgp]con
[r5-bgp]confederation id 2
[r5-bgp]peer 2002:2201:102:1::1 as-number 1
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]pee
[r5-bgp-af-ipv6]peer 2002:2201:102:1::1 ena
[r5-bgp-af-ipv6]peer 2002:2201:102:1::1 enable
[r5-bgp-af-ipv6]q
[r5-bgp]int lo0
[r5-LoopBack0]ipv6 address 5::5 64
[r5-LoopBack0]q
[r5]bgp 64512[r5-bgp]peer 6::6 connect-interface LoopBack 0 5::5
[r5-bgp]peer 6::6 as-number 64512
[r5-bgp-af-ipv6]peer 6::6 enable
R6:
[r6]bgp 64512
[r6-bgp]confederation id 2t
[r6-bgp]router-id 6.6.6.6
[r6-bgp]peer 5::5 as-number 64512
[r6-bgp]peer 7::7 as-number 64512
[r6-bgp]ipv6-family
[r6-bgp-af-ipv6]peer 5::5 ena
[r6-bgp-af-ipv6]peer 7::7 enable
[r6]bgp 64512[r6-bgp]peer 5::5 connect-interface LoopBack 0 6::6
[r6-bgp]peer 7::7 connect-interface LoopBack 0 6::6
R7:
[r7]bgp 64512
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 2
[r7-bgp]confederation peer-as 64513
[r7-bgp]peer 6::6 as-number 64512
[r7-bgp]peer 8::8 as-number 64513
[r7-bgp]peer 8::8 ebgp-max-hop 2
[r7-bgp]ipv6-family
[r7-bgp-af-ipv6]peer 8::8 enable
[r7-bgp-af-ipv6]peer 6::6 enable
[r7-bgp-af-ipv6]q
[r7-bgp]peer 6::6 connect-interface LoopBack 0 7::7
[r7-bgp]peer 8::8 connect-interface LoopBack 0 7::7
R8:
[r8]bgp 64513
[r8-bgp]router-id 8.8.8.8
[r8-bgp]confederation id 2
[r8-bgp]confederation peer-as 64512
[r8-bgp]peer 7::7 as-number 64512
[r8-bgp]peer 7::7 ebgp-max-hop 2
[r8-bgp]ipv6-family
[r8-bgp-af-ipv6]peer 7::7 enable
[r8-bgp]peer 7::7 connect-interface LoopBack 0 8::8
7、实现右面区域可以连通公网
R4:
[r4]int t0/0/0
[r4-Tunnel0/0/0]ipv6 enable
[r4-Tunnel0/0/0]ipv6 address 2002:2201:0102:2::1 64
[r4-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4
[r4-Tunnel0/0/0]source 34.1.1.2
[r4]ipv6 route-static 2002:: 16 Tunnel 0/0/0
[r4]bgp 64512
[r4]bgp 1
[r4-bgp]ipv6w
[r4-bgp-af-ipv6]network 2002:: 16
R5:
[r5]bgp 64512
[r5-bgp]ipv6
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]network 2002:2201:0102:8000:: 49
[r5-bgp-af-ipv6]peer 6::6 next-hop-local
R6:
[r6]bgp 64512
[r6-bgp]ipv6
[r6-bgp-af-ipv6]peer 7::7 reflect-client
实验结果
R1可以ping通R8的环回