In Figure 1, SwitchA functions as a BOOTP client and needs to dynamically obtain an IP address, DNS server address, and gateway address from a DHCP server (SwitchB).
The configuration roadmap is as follows:
# Create VLAN 10 and add GE0/0/1 to VLAN 10.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan 10 [SwitchA-vlan10] quit [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type trunk [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 [SwitchA-GigabitEthernet0/0/1] quit
# Enable the BOOTP client function on VLANIF 10.
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ip address bootp-alloc
# Enable DHCP.
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] dhcp enable [SwitchB] dhcp server bootp [SwitchB] dhcp server bootp automatic
# Create VLAN 10 and add GE0/0/1 to VLAN 10.
[SwitchB] vlan 10 [SwitchB-vlan10] quit [SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] port link-type trunk [SwitchB-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 [SwitchB-GigabitEthernet0/0/1] quit
# Configure VLANIF 10 to work in global address pool mode.
[SwitchB] interface vlanif 10 [SwitchB-Vlanif10] ip address 192.168.1.1 24 [SwitchB-Vlanif10] dhcp select global [SwitchB-Vlanif10] quit
# Create an address pool and set corresponding attributes.
[SwitchB] ip pool pool1 [SwitchB-ip-pool-pool1] network 192.168.1.0 mask 24 [SwitchB-ip-pool-pool1] gateway-list 192.168.1.126 [SwitchB-ip-pool-pool1] dns-list 192.168.1.2 [SwitchB-ip-pool-pool1] excluded-ip-address 192.168.1.2 [SwitchB-ip-pool-pool1] quit
# On interface VLANIF 10, run the display this command to view the BOOTP client configuration.
[SwitchA-Vlanif10] display this # interface Vlanif10 ip address bootp-alloc # return
[SwitchA-Vlanif10] quit
# After VLANIF 10 obtains an IP address, run the display dhcp client command on SwitchA to view the status of the BOOTP client on VLANIF 10.
[SwitchA] display dhcp client BOOTP client lease information on interface Vlanif10 : Current machine state : Bound Internet address assigned via : BOOTP Physical address : 0018-8201-0987 IP address : 192.168.1.254 Subnet mask : 255.255.255.0 Gateway ip address : 192.168.1.126 Lease obtained at : 2008-11-06 23:04:47 DNS : 192.168.1.2
# Run the display ip pool command on SwitchB to view the address pool configuration.
[SwitchB] display ip pool name pool1 Pool-name : pool1 Pool-No : 0 Lease : 1 Days 0 Hours 0 Minutes Domain-name : 192.168.1.2 DNS-server0 : - NBNS-server0 : - Netbios-type : - Position : Local Status : Unlocked Gateway-0 : 192.168.1.126 Network : 192.168.1.0 Mask : 255.255.255.0 VPN instance : -- Logging : Disable Conflicted address recycle interval: - Address Statistic: Total :253 Used :1 Idle :251 Expired :0 Conflict :0 Disabled :1 ----------------------------------------------------------------------------- Start End Total Used Idle(Expired) Conflict Disabled ----------------------------------------------------------------------------- 10.20.20.1 10.20.20.254 253 1 251(0) 0 1 -----------------------------------------------------------------------------
SwitchA configuration file
#
sysname SwitchA
#
vlan batch 10
#
interface Vlanif10
ip address bootp-alloc
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
return
SwitchB configuration file
#
sysname SwitchB
#
vlan batch 10
#
dhcp enable
#
dhcp server bootp
dhcp server bootp automatic
#
ip pool pool1
gateway-list 192.168.1.126
network 192.168.1.0 mask 255.255.255.0
dns-list 192.168.1.2
#
interface Vlanif10
ip address 192.168.1.1 255.255.255.0
dhcp select global
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
return