Example for Configuring a DHCPv6 Relay Agent
Networking Requirements
As shown in Figure 10-18, the DHCPv6 server needs to dynamically assign IPv6 addresses and DNS server addresses to the clients on network segments fc00:1::/64 and fc00:2::/64, and the DHCPv6 server and clients are on different links. The addresses fc00:1::1/64 and fc00:2::1/64 on SwitchA are used as the gateway addresses of the clients on the network segments fc00:1::/64 and fc00:2::/64.
Configuration Roadmap
Configure the DHCPv6 relay function on SwitchA to forward DHCPv6 packets between the DHCPv6 server and clients, so that the clients can dynamically obtain IPv6 addresses and DNS server addresses.
Ensure that the DHCPv6 and DNS servers are routable to each other before the configuration.
Procedure
- Configure SwitchA as a DHCPv6 relay agent.
# Enable the DHCP service.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] dhcp enable
# Add GE1/0/1 to VLAN 10, GE1/0/2 to VLAN 20, and GE1/0/3 to VLAN 30.
[SwitchA] vlan batch 10 20 30 [SwitchA] interface gigabitethernet 1/0/1 [SwitchA-GigabitEthernet1/0/1] port link-type access [SwitchA-GigabitEthernet1/0/1] port default vlan 10 [SwitchA-GigabitEthernet1/0/1] quit [SwitchA] interface gigabitethernet 1/0/2 [SwitchA-GigabitEthernet1/0/2] port link-type trunk [SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 20 [SwitchA-GigabitEthernet1/0/2] quit [SwitchA] interface gigabitethernet 1/0/3 [SwitchA-GigabitEthernet1/0/3] port link-type access [SwitchA-GigabitEthernet1/0/3] port default vlan 30 [SwitchA-GigabitEthernet1/0/3] quit
# Configure IPv6 addresses of VLANIF interfaces.
[SwitchA] ipv6 [SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ipv6 enable [SwitchA-Vlanif10] ipv6 address fc00:1::1 64 [SwitchA-Vlanif10] quit [SwitchA] interface vlanif 20 [SwitchA-Vlanif20] ipv6 enable [SwitchA-Vlanif20] ipv6 address fc00:3::1 64 [SwitchA-Vlanif20] quit [SwitchA] interface vlanif 30 [SwitchA-Vlanif30] ipv6 enable [SwitchA-Vlanif30] ipv6 address fc00:2::1 64 [SwitchA-Vlanif30] quit
# Enable the DHCPv6 relay function.
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] dhcpv6 relay destination fc00:3::3 [SwitchA-Vlanif10] quit [SwitchA] interface vlanif 30 [SwitchA-Vlanif30] dhcpv6 relay destination fc00:3::3 [SwitchA-Vlanif30] quit
# Configure SwitchA to function as a gateway to send the M and O flags of RA messages to clients so that the clients can obtain IPv6 addresses through DHCPv6.
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] undo ipv6 nd ra halt [SwitchA-Vlanif10] ipv6 nd autoconfig managed-address-flag [SwitchA-Vlanif10] ipv6 nd autoconfig other-flag [SwitchA-Vlanif10] quit [SwitchA] interface vlanif 30 [SwitchA-Vlanif30] undo ipv6 nd ra halt [SwitchA-Vlanif30] ipv6 nd autoconfig managed-address-flag [SwitchA-Vlanif30] ipv6 nd autoconfig other-flag [SwitchA-Vlanif30] quit
- Configure SwitchB as the DHCPv6 server.
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] dhcp enable [SwitchB] ipv6 [SwitchB] vlan 20 [SwitchB-vlan20] quit [SwitchB] interface gigabitethernet 1/0/2 [SwitchB-GigabitEthernet1/0/2] port link-type trunk [SwitchB-GigabitEthernet1/0/2] port trunk allow-pass vlan 20 [SwitchB-GigabitEthernet1/0/2] quit [SwitchB] interface vlanif 20 [SwitchB-Vlanif20] ipv6 enable [SwitchB-Vlanif20] ipv6 address fc00:3::3 64 [SwitchB-Vlanif20] quit [SwitchB] dhcpv6 pool pool1 [SwitchB-dhcpv6-pool-pool1] address prefix fc00:1::/64 [SwitchB-dhcpv6-pool-pool1] excluded-address fc00:1::1 [SwitchB-dhcpv6-pool-pool1] dns-server fc00:4::1 [SwitchB-dhcpv6-pool-pool1] quit [SwitchB] dhcpv6 pool pool2 [SwitchB-dhcpv6-pool-pool2] address prefix fc00:2::/64 [SwitchB-dhcpv6-pool-pool2] excluded-address fc00:2::1 [SwitchB-dhcpv6-pool-pool2] dns-server fc00:4::1 [SwitchB-dhcpv6-pool-pool2] quit [SwitchB] ipv6 route-static :: 0 fc00:3::1
- Configure the DHCPv6 client (Windows 7 is used as an example of the operating system on the PC).
- Right-click Network on the desktop and choose Properties. The Network and Sharing Center window then is displayed.
- Click Local Area Connection. The Local Area Connection Status window then is displayed.
- Click Properties. The Local Area Connection Properties window then is displayed.
- Select Internet Protocol Version 6 (TCP/IPv6) and click Properties. In the Internet Protocol Version 6 (TCP/IPv6) Properties window that is displayed, select Obtain an IPv6 address automatically and Obtain DNS server address automatically, and click OK.
- Verify the configuration.
# Run the display dhcpv6 relay command on SwitchA to check the DHCPv6 relay configuration.
[SwitchA] display dhcpv6 relay -------------------------------------------------------------------------------- Interface Mode Destination -------------------------------------------------------------------------------- Vlanif10 Relay FC00:3::3 Vlanif30 Relay FC00:3::3 -------------------------------------------------------------------------------- Print count : 2 Total count : 2
# Run the display dhcpv6 pool command on SwitchB to check configuration information about the DHCPv6 address pool.[SwitchB] display dhcpv6 pool DHCPv6 pool: pool1 Address prefix: FC00:1::/64 Lifetime valid 172800 seconds, preferred 86400 seconds 4 in use, 0 conflicts excluded-address FC00:1::1 1 excluded addresses Information refresh time: 86400 DNS server address: FC00:4::1 conflict-address expire-time: 172800 renew-time-percent : 50 rebind-time-percent : 80 Active normal clients: 4 Logging : Disable DHCPv6 pool: pool2 Address prefix: FC00:2::/64 Lifetime valid 172800 seconds, preferred 86400 seconds 2 in use, 0 conflicts excluded-address FC00:2::1 1 excluded addresses Information refresh time: 86400 DNS server address: FC00:4::1 conflict-address expire-time: 172800 renew-time-percent : 50 rebind-time-percent : 80 Active normal clients: 2 Logging : Disable Total of dhcpv6 pool : 2
# Run the display dhcpv6 pool pool1 allocated address and display dhcpv6 pool pool2 allocated address commands on SwitchB to check the assignment of IPv6 addresses in the DHCPv6 address pool.[SwitchB] display dhcpv6 pool pool1 allocated address Address Valid Expires Left ------------------------------------------------------------------------------- FC00:1::2 172800 2013-09-06 03:09:02 166610 FC00:1::3 172800 2013-09-06 03:09:02 166610 FC00:1::4 172800 2013-09-06 03:09:02 166610 FC00:1::5 172800 2013-09-06 03:09:02 166610 ------------------------------------------------------------------------------- Total : 4
[SwitchB] display dhcpv6 pool pool2 allocated address Address Valid Expires Left ------------------------------------------------------------------------------- FC00:2::2 172800 2013-09-06 03:09:02 166610 FC00:2::3 172800 2013-09-06 03:09:02 166610 ------------------------------------------------------------------------------- Total : 2
Configuration Files
SwitchA configuration file
# sysname SwitchA # ipv6 # vlan batch 10 20 30 # dhcp enable # interface Vlanif10 ipv6 enable ipv6 address FC00:1::1/64 undo ipv6 nd ra halt ipv6 nd autoconfig managed-address-flag ipv6 nd autoconfig other-flag dhcpv6 relay destination FC00:3::3 # interface Vlanif20 ipv6 enable ipv6 address FC00:3::1/64 # interface Vlanif30 ipv6 enable ipv6 address FC00:2::1/64 undo ipv6 nd ra halt ipv6 nd autoconfig managed-address-flag ipv6 nd autoconfig other-flag dhcpv6 relay destination FC00:3::3 # interface GigabitEthernet1/0/1 port link-type access port default vlan 10 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 20 # interface GigabitEthernet1/0/3 port link-type access port default vlan 30 # return
SwitchB configuration file
# sysname SwitchB # ipv6 # vlan batch 20 # dhcp enable # dhcpv6 pool pool1 address prefix FC00:1::/64 excluded-address FC00:1::1 dns-server FC00:4::1 # dhcpv6 pool pool2 address prefix FC00:2::/64 excluded-address FC00:2::1 dns-server FC00:4::1 # interface Vlanif20 ipv6 enable ipv6 address FC00:3::3/64 # interface GigabitEthernet1/0/2 port link-type trunk port trunk allow-pass vlan 20 # ipv6 route-static :: 0 FC00:3::1 # return