Keywords: DHCP SERVER IOS pool client-identifier excluded-address helper-address spantree portfast
A customer wanted to migrate DHCP SERVER to the MSFC of a 6509 switch, and the requirements were quite complicated:
1. Assign addresses to clients of multiple VLANs at the same time
Some of the addresses inside are manually allocated
3. Specify gateways, Wins servers, etc. for customers
The validity period for 2 address rental is 1 day, and the other is 3 days.
5. Assign the specified IP address to a specific user by MAC address
The final configuration is as follows:
ip dhcp excluded-address 10.1.1.1 10.1.1.19 //Addresses not used for dynamic address allocation
ip dhcp excluded-address 10.1.1.240 10.1.1.254
ip dhcp excluded-address 10.1.2.1 10.1.2.19
!
ip dhcp pool global//global is pool name, specified by the user
network 10.1.0.0 255.255.0.0//Dynamic allocated address segment
domain-name //Configure domain suffix for client
dns-server 10.1.1.1 10.1.1.2//Configure dns server for client
netbios-name-server 10.1.1.5 10.1.1.6//Configure wins server for client
netbios-node-type h-node//Configure node mode for the client (affects the smooth interpretation of name, such as h-node= first explain through wins server...)
lease 3//Address rental period: 3 days
ip dhcp pool vlan1
network 10.1.1.0 255.255.255.0
//This pool is a subpool of global, and will inherit domain-name and other options from global pool
default-router 10.1.1.100 10.1.1.101 //Configure the default gateway for the client
!
ip dhcp pool vlan2 // pool configured for another VLAN
network 10.1.2.0 255.255.255.0
default-router 10.1.2.100 10.1.2.101
lease 1
!
ip dhcp pool vlan1_john//Always assigning...address to machines with MAC address...
host 10.1.1.21 255.255.255.0
client-identifier.6384//client-identifier=01 plus client network card address
!
ip dhcp pool vlan1_tom
host 10.1.1.50 255.255.255.0
client-identifier 010010.3ab1.eac8
Related DHCP debugging commands:
no service dhcp//stop DHCP service [default is to enable DHCP service]
sh ip dhcp binding //Show address allocation status
show ip dhcp conflict//Show address conflict
debug ip dhcp server {events | packets | linkage}//Observe the working status of the DHCP server
If the DHCP client cannot assign an IP address, there are two common reasons. The first case is that the port connecting to the client is not set to Portfast. After the MS client is turned on, check that the network card connection is normal. Link is UP, and then it starts to send DHCPDISCOVER request. At this time, the switch port is undergoing spanning tree calculation, which usually takes 30-50 seconds to enter the forwarding state. If the MS client does not receive the DHCP SERVER response, it will set an IP address of 169. to the network card. The solution is to set the switch port to Portfast mode: CatOS(4000/5000/6000): set spantree portfast mod_num/port_num enable; IOS(2900/3500): interface ...; spanning-tree portfast.
Another situation is that the DHCP server and the DHCP workstation are not on the same VLAN. At this time, it is usually solved by setting ip helper-address:
interface vlan1
ip address 10.1.1.254 255.255.255.0//Assuming the DHCP server address is 10.1.1.8
interface Vlan2
ip address 10.1.2.254 255.255.255.0
ip helper-address 10.1.1.8 //Suppose this is the VLAN where the DHCP client resides
Reference page:
DHCP Configuring[[The Link End.]]
DHCP Commands
ip helper-address
portfast