专业认证

关注公众号 jb51net

关闭
IT专业知识 > 专业认证 >

华为HCIP认证ENSP实现IPV4与IPV6的双栈配置详解

冰镇阔落

本文讲述了华为HCIP认证ENSP实现IPV4与IPV6的双栈配置。分享给大家供大家参考,具体如下:
 

双栈:设备能同时工作在IPV4与IPV6两种网络中,能同时与IPV4和IPV6网络中的设备进行通信。

IPV6的特点:
1:全球单播地址—IPV6网络中没有NAT。
2:可聚合性—IANA组织对全球的IPV6地址进行合理分配。
3:多宿主—在一个物理接口上可以同时配置多个不同网段的IPV6地址,不同接口的IPV6地址不能处于同一网段。
4:自动配置:
1>:DHCP
2>:auto-config—在路由接口手工配置IPV6地址,随后路由器将自己地址的前缀(网络号)下放给PC,PC使用EUI-64来补充主机位。
5:即插即用—支持热插拔。
6:端到端连接—不需要NAT。
7:重编址。
8:简易的报头:
1>:没有广播机制,只有单播和组播。
2>:没有校验盒(2、4层均存在校验盒)。
3>:流标签—QOS
9:安全性和移动性。
10:IPV4和IPV6可以共存。

双栈及不同IPV6局域网之间的通信案例

拓扑图:

在这里插入图片描述
 

注:路由器连接的蓝色线表示环回。

要求:
1:两个局域网基于6 to 4 tunnel进行通信。
2:R1环回可以访问R3的环回。

配置及思路:

1:实现R2、R3、R4所在IPV4局域网全网可达。

R2:

[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip add	
[r2-GigabitEthernet0/0/0]ip address 23.1.1.1 24
[r2-GigabitEthernet0/0/0]quit 
[r2]ip route-static 0.0.0.0 0 23.1.1.2

R3:

[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip address 23.1.1.2 24
[r3-GigabitEthernet0/0/1]quit 
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 3.3.3.3 24
[r3-LoopBack0]quit 
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 34.1.1.2 24
[r3-GigabitEthernet0/0/0]quit 

R4:

[r4]interface GigabitEthernet 0/0/1
[r4-GigabitEthernet0/0/1]ip address 34.1.1.1 24
[r4-GigabitEthernet0/0/1]quit 
[r4]ip route-static 0.0.0.0 0 34.1.1.2

测试:
 

R2:
 

在这里插入图片描述
 

R4:
 

在这里插入图片描述

2:配置R1、R2所在的IPV4局域网并可正常访问R3环回。
 

R1:

[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.0.1 26
[r1-GigabitEthernet0/0/0]quit 
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.0.65 27
[r1-LoopBack0]quit 
[r1]interface lo	
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 192.168.0.97 27
[r1-LoopBack1]quit 
[r1]rip 1
[r1-rip-1]version 2
[r1-rip-1]network 192.168.0.0
[r1-rip-1]quit 
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]rip summary-address 192.168.0.64 255.255.255.192
[r1-GigabitEthernet0/0/0]quit 

R2:

[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.0.2 26
[r2-GigabitEthernet0/0/1]quit 
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.0.129 26
[r2-LoopBack0]quit 
[r2]rip 1	
[r2-rip-1]version 2
[r2-rip-1]network 192.168.0.0
[r2-rip-1]quit 
[r2]rip 1
[r2-rip-1]default-route originate 
[r2-rip-1]quit 
[r2]acl  2000
[r2-acl-basic-2000]rule 5 permit source 192.168.0.0 0.0.0.255
[r2-acl-basic-2000]quit 
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]nat outbound 2000
[r2-GigabitEthernet0/0/0]quit 

测试:
 

在这里插入图片描述

3:在R1、R2上配置IPV6网络。

地址规划:

2002:1701:101::/64 R2环回
2002:1701:101:1::/64 骨干

2002:1701:101:2::/64 R1环回
2002:1701:101:2::/65
2002:1701:101:2:8000::/65

R1:

[r1]ipv6 
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ipv6 enable 
[r1-GigabitEthernet0/0/0]ipv6 address 2002:1701:101:1::1/64
[r1-GigabitEthernet0/0/0]quit 
[r1]interface LoopBack 0
[r1-LoopBack0]ipv6 enable 
[r1-LoopBack0]ipv6 address 2002:1701:101:2::1/65
[r1-LoopBack0]quit 
[r1]interface LoopBack 1
[r1-LoopBack1]ipv6 enable 
[r1-LoopBack1]ipv6 address 2002:1701:101:2:8000::1/65
[r1-LoopBack1]quit 
[r1]ripng 1
[r1-ripng-1]quit 
[r1]interface LoopBack 0
[r1-LoopBack0]ripng 1 enable 
[r1-LoopBack0]quit 
[r1]interface LoopBack 1
[r1-LoopBack1]ripng 1 enable
[r1-LoopBack1]quit 
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ripng 1 enable 
[r1-GigabitEthernet0/0/0]quit 
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ripng summary-address 2002:1701:101:2:: 64
[r1-GigabitEthernet0/0/0]quit 

R2:

[r2]ipv6 
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ipv6 enable 
[r2-GigabitEthernet0/0/1]ipv6 address 2002:1701:101:1::2/64
[r2-GigabitEthernet0/0/1]quit 
[r2]interface LoopBack 0
[r2-LoopBack0]ipv6 enable 
[r2-LoopBack0]ipv6 address 2002:1701:101::1/64
[r2-LoopBack0]quit 
[r2]ripng 1
[r2-ripng-1]quit 
[r2]interface LoopBack 0
[r2-LoopBack0]ripng 1 enable 
[r2-LoopBack0]quit 
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ripng 1 enable 
[r2-GigabitEthernet0/0/1]quit 
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ipv6 enable 
[r2-Tunnel0/0/0]ipv6 address 2002:1701:101:2::1/64
[r2-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4 
[r2-Tunnel0/0/0]source 23.1.1.1
[r2-Tunnel0/0/0]quit 
[r2]ipv6 route-static 2002:: 16 Tunnel 0/0/0
[r2]ripng 1
[r2-ripng-1]import-route static 
[r2-ripng-1]quit 

4:配置BGP区域。

地址规划:
 

2002:2201:101::/49 AS1
2002:2201:101::/64—2002:2201:101:7fff::/64

2002:2201:101:8000::/49 AS2
2002:2201:101:8000::/64—2002:2201:101:ffff::/64

1>:配置IPV6地址
 

R4:

[r4]ipv6 
[r4]interface LoopBack 0
[r4-LoopBack0]ipv6 enable 
[r4-LoopBack0]ipv6 address 2002:2201:101::1/64
[r4-LoopBack0]quit 
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ipv6 enable 
[r4-GigabitEthernet0/0/0]ipv6 address 2002:2201:101:1::1/64
[r4-GigabitEthernet0/0/0]quit 

R5:

[r5]ipv6 
[r5]interface GigabitEthernet 0/0/1
[r5-GigabitEthernet0/0/1]ipv6 enable 
[r5-GigabitEthernet0/0/1]ipv6 address 2002:2201:101:1::2/64
[r5-GigabitEthernet0/0/1]quit 
[r5]interface LoopBack 0	
[r5-LoopBack0]ipv6 enable 	
[r5-LoopBack0]ipv6 address 2002:2201:101:8000::1/64
[r5-LoopBack0]quit 
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ipv6 enable 
[r5-GigabitEthernet0/0/0]ipv6 address 2002:2201:101:8001::1/64
[r5-GigabitEthernet0/0/0]quit 

R6:

[r6]ipv6 
[r6]interface GigabitEthernet 0/0/1
[r6-GigabitEthernet0/0/1]ipv6 enable 
[r6-GigabitEthernet0/0/1]ipv6 address 2002:2201:101:8001::2/64
[r6-GigabitEthernet0/0/1]quit 
[r6]interface LoopBack 0
[r6-LoopBack0]ipv6 enable 
[r6-LoopBack0]ipv6 address 2002:2201:101:8002::1/64
[r6-LoopBack0]quit 
[r6]interface g0/0/0
[r6-GigabitEthernet0/0/0]ipv6 enable 
[r6-GigabitEthernet0/0/0]ipv6 address 2002:2201:101:8003::1/64
[r6-GigabitEthernet0/0/0]quit 

R7:

[r7]ipv6 
[r7]interface GigabitEthernet 0/0/1	
[r7-GigabitEthernet0/0/1]ipv6 enable 
[r7-GigabitEthernet0/0/1]ipv6 address 2002:2201:101:8003::2/64
[r7-GigabitEthernet0/0/1]quit 
[r7]interface LoopBack 0
[r7-LoopBack0]ipv6 enable 
[r7-LoopBack0]ipv6 address 2002:2201:101:8004::1/64
[r7-LoopBack0]quit 
[r7]interface GigabitEthernet 0/0/0
[r7-GigabitEthernet0/0/0]ipv6 enable 
[r7-GigabitEthernet0/0/0]ipv6 address 2002:2201:101:8005::1/64
[r7-GigabitEthernet0/0/0]quit 

R8:

[r8]ipv6 
[r8]interface GigabitEthernet 0/0/1
[r8-GigabitEthernet0/0/1]ipv6 enable 
[r8-GigabitEthernet0/0/1]ipv6 address 2002:2201:101:8005::2/64
[r8-GigabitEthernet0/0/1]quit 
[r8]interface LoopBack 0
[r8-LoopBack0]ipv6 enable 
[r8-LoopBack0]ipv6 address 2002:2201:101:8006::1/64
[r8-LoopBack0]quit 

2>:配置OSPFV3域

R5:

[r5]ospfv3 1
[r5-ospfv3-1]router-id 5.5.5.5
[r5-ospfv3-1]quit 
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ospfv3 1 area 0
[r5-GigabitEthernet0/0/0]quit 
[r5]interface LoopBack 0
[r5-LoopBack0]ospfv3 1 area 0
[r5-LoopBack0]quit 

R6:

[r6]ospfv3 1
[r6-ospfv3-1]router-id 6.6.6.6
[r6-ospfv3-1]quit 
[r6]interface GigabitEthernet 0/0/1
[r6-GigabitEthernet0/0/1]ospfv3 1 area 0
[r6-GigabitEthernet0/0/1]quit 
[r6]interface LoopBack 0
[r6-LoopBack0]ospfv3 1 area 0
[r6-LoopBack0]quit 	
[r6]interface GigabitEthernet 0/0/0
[r6-GigabitEthernet0/0/0]ospfv3 1 area 0
[r6-GigabitEthernet0/0/0]quit 

R7:

[r7]ospfv3 1 
[r7-ospfv3-1]router-id 7.7.7.7
[r7-ospfv3-1]quit 
[r7]interface GigabitEthernet 0/0/1
[r7-GigabitEthernet0/0/1]ospfv3 1 area 0
[r7-GigabitEthernet0/0/1]quit 
[r7]interface LoopBack 0
[r7-LoopBack0]ospfv3 1 area 0
[r7-LoopBack0]quit 
[r7]interface GigabitEthernet 0/0/0
[r7-GigabitEthernet0/0/0]ospfv3 1 area 0
[r7-GigabitEthernet0/0/0]quit 

R8:

[r8]ospfv3 1 
[r8-ospfv3-1]router-id 8.8.8.8
[r8-ospfv3-1]quit 
[r8]interface GigabitEthernet 0/0/1
[r8-GigabitEthernet0/0/1]ospfv3 1 area 0
[r8-GigabitEthernet0/0/1]quit 
[r8]interface LoopBack 0
[r8-LoopBack0]ospfv3 1 area 0
[r8-LoopBack0]quit 

3>:配置BGP域

R4:

[r4]bgp 1
[r4-bgp]router-id 4.4.4.4	
[r4-bgp]peer 2002:2201:101:1::2 as-number 2
[r4-bgp]ipv6-family
[r4-bgp-af-ipv6]peer 2002:2201:101:1::2 enable 
[r4-bgp-af-ipv6]quit 
[r4-bgp]quit 

R5:

[r5]bgp 64512
[r5-bgp]confederation id 2
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 2002:2201:101:1::1 as-number 1
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 2002:2201:101:1::1 enable 
[r5-bgp-af-ipv6]quit 
[r5-bgp]peer 2002:2201:101:8002::1 as-number 64512
[r5-bgp]peer 2002:2201:101:8002::1 connect-interface LoopBack 0
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 2002:2201:101:8002::1 enable 
[r5-bgp-af-ipv6]quit 

R6:

[r6]bgp 64512
[r6-bgp]confederation id 2
[r6-bgp]router-id 6.6.6.6
[r6-bgp]peer 2002:2201:101:8000::1 as-number 64512
[r6-bgp]peer 2002:2201:101:8000::1 connect-interface LoopBack 0
[r6-bgp]ipv6-family
[r6-bgp-af-ipv6]peer 2002:2201:101:8000::1 enable 
[r6-bgp-af-ipv6]quit 
[r6-bgp]peer 2002:2201:101:8004::1 as-number 64512
[r6-bgp]peer 2002:2201:101:8004::1 connect-interface LoopBack 0
[r6-bgp]ipv6-family
[r6-bgp-af-ipv6]peer 2002:2201:101:8004::1 enable 
[r6-bgp-af-ipv6]quit 
[r6-bgp]

R7:

[r7]bgp 64512
[r7-bgp]confederation id 2
[r7-bgp]confederation peer-as 64513
[r7-bgp]router-id 7.7.7.7
[r7-bgp]peer 2002:2201:101:8002::1 as-number 64512
[r7-bgp]peer 2002:2201:101:8002::1 connect-interface LoopBack 0
[r7-bgp]ipv6-family
[r7-bgp-af-ipv6]peer 2002:2201:101:8002::1 enable 
[r7-bgp-af-ipv6]quit 
[r7-bgp]peer 2002:2201:101:8005::2 as-number 64513
[r7-bgp]peer 2002:2201:101:8005::2 ebgp-max-hop 2
[r7-bgp]ipv6-family
[r7-bgp-af-ipv6]peer 2002:2201:101:8005::2 enable 
[r7-bgp-af-ipv6]quit 

R8:

[r8]bgp 64513
[r8-bgp]confederation id 2
[r8-bgp]confederation peer-as 64512
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 2002:2201:101:8005::1 as-number 64512
[r8-bgp]peer 2002:2201:101:8005::1 ebgp-max-hop 2
[r8-bgp]ipv6-family
[r8-bgp-af-ipv6]peer 2002:2201:101:8005::1 enable 
[r8-bgp-af-ipv6]quit 

4>:将路由宣告到BGP中实现BGP可达

R5:

[r5]ipv6 route-static 2002:2201:101:8000:: 49 NULL 0
[r5]bgp 64512
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]network 2002:2201:101:8000:: 49
[r5-bgp-af-ipv6]quit 
[r5]bgp 64512
[r5-bgp]ipv6-family
[r5-bgp-af-ipv6]peer 2002:2201:101:8002::1 next-hop-local 
[r5-bgp-af-ipv6]quit 

R6:

[r6]bgp 64512
[r6-bgp]ipv6-family
[r6-bgp-af-ipv6]peer 2002:2201:101:8004::1 reflect-client 
[r6-bgp-af-ipv6]quit 
[r6-bgp]quit 

5>:在R4上配置6 to 4 tunnel,并将路由宣告到BGP中

R4:

[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ipv6 enable 
[r4-Tunnel0/0/0]ipv6 address 2002:2201:101:2::1/64
[r4-Tunnel0/0/0]tunnel-protocol ipv6-ipv4 6to4 
[r4-Tunnel0/0/0]source 34.1.1.1
[r4-Tunnel0/0/0]quit 
[r4]ipv6 route-static 2002:: 16 Tunnel 0/0/0
[r4]bgp 1
[r4-bgp]ipv6-family
[r4-bgp-af-ipv6]network 2002:: 16
[r4-bgp-af-ipv6]quit 
[r4-bgp]quit 

5:测试—R1访问R3和R8的环回

访问R3环回:
 

在这里插入图片描述
 

访问R8环回:
 

在这里插入图片描述
 

至此,双栈与IPV6之间的互访已全部完成。由于ENSP可能存在BUG,会导致访问出现问题。保存配置后重启设备即可正常访问。