switch# configure terminal
switch(config)# ip dhcpd enable
switch(config)# dhcp pool a
switch(config-dhcp)# default-router 192.168.1.1
switch(config-dhcp)#dns-server 8.8.8.8
switch(config-dhcp)# lease 1000
switch(config-dhcp)# network 192.168.1.0/24 vlanif1
phenomenon:
Clients including PC1-PC100 can obtain correct IP addresses from
the DHCP server (SW 1).
Note: An L3 interface of the same VLAN shall be configured for the
DHCP server in the VLAN, so that the DHCP server can distribute IP
addresses to clients in the VLAN.
4.8
DHCP relay
Function Brief
If the DHCP client and the DHCP server on the same physical
network segment, the client can correctly obtain the IP address of dynamic
allocation. If they are not in the same physical network, they need DHCP
Relay Agent (relay agent). DHCP Relay agent can be removed to the
necessary of DHCP server should be in each physical segment, It can
deliver messages to the DHCP server that is not in the same physical
subnet,it can also send a message back to the DHCP client that is not in the
same physical subnet.
4.8.1
ip helper-address
Command Description
ip helper-address A.B.C.D
//This command is used to enable the DHCP relay.