设计架构图及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..<