Example: Configuring static IP address assignment

Network configuration

As shown in Figure 19, Switch B (DHCP client) and Switch C (BOOTP client) obtain the IP address, DNS server address, and gateway address from Switch A (DHCP server).

The client ID of VLAN-interface 2 on Switch B is 0030-3030-662e-6532-3030-2e30-3030-322d-4574-6865-726e-6574.

The MAC address of VLAN-interface 2 on Switch C is 000f-e200-01c0.

Figure 19: Network diagram

Procedure


[IMPORTANT: ]

IMPORTANT:

By default, interfaces on the device are disabled (in ADM or Administratively Down state). To have an interface operate, you must use the undo shutdown command to enable that interface.


  1. Specify an IP address for VLAN-interface 2 on Switch A.

    <SwitchA> system-view
    [SwitchA] interface vlan-interface 2
    [SwitchA-Vlan-interface2] ip address 10.1.1.1 25
    [SwitchA-Vlan-interface2] quit
    
  2. Configure the DHCP server:

    # Create DHCP address pool 0.

    [SwitchA] dhcp server ip-pool 0
    

    # Configure a static binding for Switch B.

    [SwitchA-dhcp-pool-0] static-bind ip-address 10.1.1.5 25 client-identifier 0030-3030-662e-6532-3030-2e30-3030-322d-4574-6865-726e-6574
    

    # Configure a static binding for Switch C.

    [SwitchA-dhcp-pool-0] static-bind ip-address 10.1.1.6 25 hardware-address 000f-e200-01c0
    

    # Specify the DNS server address and the gateway address.

    [SwitchA-dhcp-pool-0] dns-list 10.1.1.2
    [SwitchA-dhcp-pool-0] gateway-list 10.1.1.126
    [SwitchA-dhcp-pool-0] quit
    [SwitchA]
    

    # Enable DHCP.

    [SwitchA] dhcp enable
    

    # Enable the DHCP server on VLAN-interface 2.

    [SwitchA] interface vlan-interface 2
    [SwitchA-Vlan-interface2] dhcp select server
    [SwitchA-Vlan-interface2] quit
    

Verifying the configuration

# Verify that Switch B can obtain IP address 10.1.1.5 and all other network parameters from Switch A. (Details not shown.)

# Verify that Switch C can obtain IP address 10.1.1.6 and all other network parameters from Switch A. (Details not shown.)

# On the DHCP server, display the IP addresses assigned to the clients.

[SwitchA] display dhcp server ip-in-use
IP address       Client identifier/    Lease expiration      Type
                 Hardware address
10.1.1.5         0030-3030-662e-6532-  Jan 21 14:27:27 2014  Static(C)
                 3030-2e30-3030-322d-
                 4574-6865-726e-6574
10.1.1.6         000f-e200-01c0        Unlimited             Static(C)