设计架构图及IP地址如下:PC1和PC2通过DHCP和DHCPV6获取IPV4和IPV6地址,实现图内的所有设备IPV4和IPV6全部互通。

1、IPV4 配置:

R2配置:
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]interface GigabitEthernet 0/0/0
    
[R2-GigabitEthernet0/0/0]ip address 1.1.1.2 255.255.255.0
Aug 29 2024 08:55:40-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]

R2配置静态路由
[R2]ip route-static 192.168.0.0 255.255.0.0 1.1.1.1


R1配置:
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
    
[R1]interface GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]ip address 1.1.1.1 255.255.255.0
[R1-GigabitEthernet0/0/0]
Aug 29 2024 08:57:00-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]interface G0/0/1
[R1-GigabitEthernet0/0/1]ip addr 192.168.1.254 255.255.255.0
Aug 29 2024 08:57:54-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1-GigabitEthernet0/0/1]interface G0/0/2
[R1-GigabitEthernet0/0/2]ip addr 192.168.2.254 255.255.255.0
Aug 29 2024 08:58:17-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R1-GigabitEthernet0/0/2]

R1配置静态路由:
[R1]ip route-static 1.1.1.0 255.255.255.0  1.1.1.2

R1:配置DHCPV4
[R1]dhcp enable
[R1]ip pool 1 
Info: It's successful to create an IP address pool.

[R1-ip-pool-1]network 192.168.1.0 mask 255.255.255.0
    
[R1-ip-pool-1]gateway-list 192.168.1.254 
    
[R1-ip-pool-1]dns-list 223.5.5.5 119.29.29.29
    


[R1-ip-pool-1]excluded-ip-address 192.168.1.200 192.168.1.253

[R1]ip pool 2
Info: It's successful to create an IP address pool.
[R1-ip-pool-2]network 192.168.2.0 mask 255.255.255.0
[R1-ip-pool-2]gateway-list 192.168.2.254

[R1-ip-pool-2]dns-list 119.29.29.29 223.5.5.5


[R1-ip-pool-2]excluded-ip-address 192.168.2.200 192.168.2.253

[R1]interface GigabitEthernet 0/0/1
    
[R1-GigabitEthernet0/0/1]dhcp select global
    
[R1-GigabitEthernet0/0/1]interface G0/0/2
    
[R1-GigabitEthernet0/0/2]dhcp select global 


查看PC1和PC2的地址:
PC>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fe81:39d0
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.199
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.254
Physical address..................: 54-89-98-81-39-D0
DNS server........................: 223.5.5.5
                                    119.29.29.29
PC>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fe81:39d0
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.199
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.254
Physical address..................: 54-89-98-81-39-D0
DNS server........................: 223.5.5.5
                                    119.29.29.29

PC1和PC2互通:
PC>ping 192.168.2.199

Ping 192.168.2.199: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.199: bytes=32 seq=2 ttl=127 time=16 ms
From 192.168.2.199: bytes=32 seq=3 ttl=127 time=15 ms
From 192.168.2.199: bytes=32 seq=4 ttl=127 time=16 ms
From 192.168.2.199: bytes=32 seq=5 ttl=127 time=15 ms

PC>ping 192.168.1.199

Ping 192.168.1.199: 32 data bytes, Press Ctrl_C to break
From 192.168.1.199: bytes=32 seq=1 ttl=127 time=16 ms
From 192.168.1.199: bytes=32 seq=2 ttl=127 time=16 ms
From 192.168.1.199: bytes=32 seq=3 ttl=127 time=15 ms
From 192.168.1.199: bytes=32 seq=4 ttl=127 time=16 ms
From 192.168.1.199: bytes=32 seq=5 ttl=127 time=15 ms

PC1和PC2和R2互通:
PC>ping 1.1.1.2

Ping 1.1.1.2: 32 data bytes, Press Ctrl_C to break
From 1.1.1.2: bytes=32 seq=1 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=2 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=3 ttl=254 time=31 ms
From 1.1.1.2: bytes=32 seq=4 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=5 ttl=254 time=15 ms

PC>ping 1.1.1.2

Ping 1.1.1.2: 32 data bytes, Press Ctrl_C to break
From 1.1.1.2: bytes=32 seq=1 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=2 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=3 ttl=254 time=31 ms
From 1.1.1.2: bytes=32 seq=4 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=5 ttl=254 time=15 ms

<R2>ping 192.168.1.199
  PING 192.168.1.199: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 192.168.1.199: bytes=56 Sequence=2 ttl=127 time=40 ms
    Reply from 192.168.1.199: bytes=56 Sequence=3 ttl=127 time=30 ms
    Reply from 192.168.1.199: bytes=56 Sequence=4 ttl=127 time=20 ms
    Reply from 192.168.1.199: bytes=56 Sequence=5 ttl=127 time=20 ms

  --- 192.168.1.199 ping statistics ---
    5 packet(s) transmitted
    4 packet(s) received
    20.00% packet loss
    round-trip min/avg/max = 20/27/40 ms

<R2>ping 192.168.2.199
  PING 192.168.2.199: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 192.168.2.199: bytes=56 Sequence=2 ttl=127 time=10 ms
    Reply from 192.168.2.199: bytes=56 Sequence=3 ttl=127 time=30 ms
    Reply from 192.168.2.199: bytes=56 Sequence=4 ttl=127 time=30 ms

  --- 192.168.2.199 ping statistics ---
    4 packet(s) transmitted
    3 packet(s) received
    25.00% packet loss
    round-trip min/avg/max = 10/23/30 ms

华为路由器配置IPV4和IPV6局域网示例_华为


华为路由器配置IPV4和IPV6局域网示例_智能路由器_02


华为路由器配置IPV4和IPV6局域网示例_智能路由器_03


华为路由器配置IPV4和IPV6局域网示例_网络_04


华为路由器配置IPV4和IPV6局域网示例_IP_05

2、IPV6配置:

R2配置:
[R2]ipv6 
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ipv6 enable
    
[R2-GigabitEthernet0/0/0]ipv6 address 2001::1 64
[R2-GigabitEthernet0/0/0]
Aug 29 2024 09:16:32-08:00 R2 IPV6/2/IF_IPV6CHANGE:OID 16777216.50331648.1006632
96.16777216.33554432.16777216.922746880.33554432.0.16777216 The status of the IP
v6 Interface changed. (IfIndex=50331648, IfDescr=HUAWEI, AR Series, GigabitEther
net0/0/0 Interface, IfOperStatus=16777216, IfAdminStatus=16777216) 
[R2-GigabitEthernet0/0/0]
Aug 29 2024 09:16:32-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IPv
6 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]

R2配置IPV6默认路由:
[R2]ipv6 route-static 2002:: 64 2001::2
[R2]ipv6 route-static 2003:: 64 2001::2

R1配置:
[R1]ipv6
[R1]interface G0/0/0
[R1-GigabitEthernet0/0/0]ipv6 enable
[R1-GigabitEthernet0/0/0]ipv6 addr 2001::2/64
[R1-GigabitEthernet0/0/0]
Aug 29 2024 09:20:22-08:00 R1 IPV6/2/IF_IPV6CHANGE:OID 16777216.50331648.1006632
96.16777216.33554432.16777216.922746880.33554432.0.16777216 The status of the IP
v6 Interface changed. (IfIndex=50331648, IfDescr=HUAWEI, AR Series, GigabitEther
net0/0/0 Interface, IfOperStatus=16777216, IfAdminStatus=16777216) 
[R1-GigabitEthernet0/0/0]
Aug 29 2024 09:20:22-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IPv
6 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]
[R1-GigabitEthernet0/0/0]interface G0/0/1

[R1-GigabitEthernet0/0/1]ipv6 enable
[R1-GigabitEthernet0/0/1]ipv6 addr 2002::1/64
[R1-GigabitEthernet0/0/1]
Aug 29 2024 09:21:35-08:00 R1 IPV6/2/IF_IPV6CHANGE:OID 16777216.50331648.1006632
96.16777216.33554432.16777216.922746880.33554432.0.16777216 The status of the IP
v6 Interface changed. (IfIndex=67108864, IfDescr=HUAWEI, AR Series, GigabitEther
net0/0/1 Interface, IfOperStatus=16777216, IfAdminStatus=16777216) 
[R1-GigabitEthernet0/0/1]
Aug 29 2024 09:21:35-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IPv
6 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1-GigabitEthernet0/0/1]
[R1-GigabitEthernet0/0/1]int G0/0/2
[R1-GigabitEthernet0/0/2]ipv6 enable
[R1-GigabitEthernet0/0/2]ipv6 addr 2003::1/64
[R1-GigabitEthernet0/0/2]
Aug 29 2024 09:22:29-08:00 R1 IPV6/2/IF_IPV6CHANGE:OID 16777216.50331648.1006632
96.16777216.33554432.16777216.922746880.33554432.0.16777216 The status of the IP
v6 Interface changed. (IfIndex=83886080, IfDescr=HUAWEI, AR Series, GigabitEther
net0/0/2 Interface, IfOperStatus=16777216, IfAdminStatus=16777216) 
[R1-GigabitEthernet0/0/2]
Aug 29 2024 09:22:29-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IPv
6 on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R1-GigabitEthernet0/0/2]

R1配置静态路由:
[R1]ipv6 route-static  2001:: 64  2001::1


R1配置DHCPV6
[R1]dhcpv6 pool 1

[R1-dhcpv6-pool-1]address prefix 2002::/64

[R1-dhcpv6-pool-1]dns-server 2002::1

[R1-dhcpv6-pool-1]excluded-address 2002::1 to 2002::10

[R1]dhcpv6 pool 2
    
[R1-dhcpv6-pool-2]address prefix 2003::/64

[R1-dhcpv6-pool-2]dns-server 2003::1

[R1-dhcpv6-pool-2]excluded-address 2003::1 to 2003::10

配置R1路由器G1和G2接口IPV6配置:
[R1-dhcpv6-pool-2]int g0/0/1



[R1-GigabitEthernet0/0/1]dhcpv6 server  1
[R1-GigabitEthernet0/0/1] undo ipv6 nd ra halt

[R1-GigabitEthernet0/0/1] ipv6 nd autoconfig managed-address-flag

[R1-GigabitEthernet0/0/1] ipv6 nd autoconfig other-flag

[R1-dhcpv6-pool-2]int g0/0/2



[R1-GigabitEthernet0/0/2]dhcpv6 server 2
[R1-GigabitEthernet0/0/2] undo ipv6 nd ra halt

[R1-GigabitEthernet0/0/2] ipv6 nd autoconfig managed-address-flag

[R1-GigabitEthernet0/0/2] ipv6 nd autoconfig other-flag

至此配置完毕,测试PC1和PC2与AR2的联通性。

PC1:
Link local IPv6 address...........: fe80::5689:98ff:fe81:39d0
IPv6 address......................: 2002::11 / 128
IPv6 gateway......................: fe80::2e0:fcff:fe14:1f1f
IPv4 address......................: 192.168.1.199
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.254
Physical address..................: 54-89-98-81-39-D0
DNS server........................: 223.5.5.5
                                    119.29.29.29

 PC2:
Link local IPv6 address...........: fe80::5689:98ff:fe2f:74d8
IPv6 address......................: 2003::11 / 128
IPv6 gateway......................: fe80::2e0:fcff:fe14:1f20
IPv4 address......................: 192.168.2.199
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.2.254
Physical address..................: 54-89-98-2F-74-D8
DNS server........................: 119.29.29.29
                                    223.5.5.5

PC1-PC2
PC>ping 2003::11

Ping 2003::11: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 2003::11: bytes=32 seq=2 hop limit=254 time=31 ms
From 2003::11: bytes=32 seq=3 hop limit=254 time=16 ms
From 2003::11: bytes=32 seq=4 hop limit=254 time=15 ms
From 2003::11: bytes=32 seq=5 hop limit=254 time=16 ms

PC>ping 2002::1

Ping 2002::1: 32 data bytes, Press Ctrl_C to break
From 2002::1: bytes=32 seq=1 hop limit=64 time=15 ms
From 2002::1: bytes=32 seq=2 hop limit=64 time=16 ms
From 2002::1: bytes=32 seq=3 hop limit=64 time=16 ms
From 2002::1: bytes=32 seq=4 hop limit=64 time=15 ms
From 2002::1: bytes=32 seq=5 hop limit=64 time=31 ms

PC和AR2
PC>ping 2001::1

Ping 2001::1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 2001::1: bytes=32 seq=2 hop limit=63 time=32 ms
From 2001::1: bytes=32 seq=3 hop limit=63 time=16 ms
From 2001::1: bytes=32 seq=4 hop limit=63 time=16 ms
From 2001::1: bytes=32 seq=5 hop limit=63 time=31 ms

PC>ping 2001::1

Ping 2001::1: 32 data bytes, Press Ctrl_C to break
From 2001::1: bytes=32 seq=1 hop limit=63 time=15 ms
From 2001::1: bytes=32 seq=2 hop limit=63 time=32 ms
From 2001::1: bytes=32 seq=3 hop limit=63 time=31 ms
From 2001::1: bytes=32 seq=4 hop limit=63 time=15 ms
From 2001::1: bytes=32 seq=5 hop limit=63 time=32 ms

<R2>ping ipv6 2002::11
  PING 2002::11 : 56  data bytes, press CTRL_C to break
    Reply from 2002::11 
    bytes=56 Sequence=1 hop limit=254  time = 20 ms
    Reply from 2002::11 
    bytes=56 Sequence=2 hop limit=254  time = 20 ms
    Reply from 2002::11 
    bytes=56 Sequence=3 hop limit=254  time = 20 ms
    Reply from 2002::11 
    bytes=56 Sequence=4 hop limit=254  time = 30 ms
    Reply from 2002::11 
    bytes=56 Sequence=5 hop limit=254  time = 20 ms

华为路由器配置IPV4和IPV6局域网示例_IPV6_06


华为路由器配置IPV4和IPV6局域网示例_IP_07


华为路由器配置IPV4和IPV6局域网示例_网络_08