چارەسەری لاب / Services
DHCP not giving an IP address
Packet Tracer · GNS3 · Cisco IOS · دوایین پشکنین
network and default-router, that the excluded range doesn't cover the whole pool, and, when the server is in another subnet, that the gateway interface has ip helper-address pointing at it.لەم پەڕەیەدا
What you see
In Packet Tracer the PC says DHCP request failed and falls back to 169.254.x.x. In GNS3 a VPCS says Can't find dhcp server. A real Windows PC also picks a 169.254 address.
Why it happens
DHCP starts with a broadcast. Broadcasts don't cross routers. So either the server is in the same VLAN as the PC, or the router in front of the PC has to forward the request with ip helper-address. After that, the server needs a pool for the PC's subnet with free addresses in it.
Check it
- On the router running DHCP,
show ip dhcp pool. Is there a pool for this subnet, and are addresses "leased" or all zero? show ip dhcp bindingshows which PCs got an address.show ip dhcp conflictlists addresses the server refused to hand out because something already uses them.show running-config | include excludedand check the excluded range.- On the switch,
show vlan brief: is the PC's port in the VLAN you think?
Fix: a DHCP pool on the router
Exclude the addresses you use for the gateway and servers first, then make the pool. The network must match the PC's subnet, and default-router must be the gateway of that VLAN.
ip dhcp excluded-address 192.168.10.1 192.168.10.10
ip dhcp pool VLAN10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
dns-server 8.8.8.8
A common slip: ip dhcp excluded-address 192.168.10.1 192.168.10.254 excludes the whole pool, so the server has nothing to give.
Fix: the DHCP server is in another subnet
Put ip helper-address on the interface that the PCs use as their gateway, not on the interface facing the server. With router-on-a-stick that is the subinterface; on a Layer 3 switch it is the SVI.
interface g0/0.10
ip helper-address 10.0.0.5
interface g0/0.20
ip helper-address 10.0.0.5
The server also needs a pool for each of those subnets, and a route back to them.
Fix: Packet Tracer Server-PT
On a Server-PT, go to Services > DHCP, turn the service On, fill in Default Gateway, DNS Server, Start IP Address and the mask, and click Save (or Add for a second pool). Forgetting Save is easy to do.
Then renew the PC
On the PC command prompt in Packet Tracer:
ipconfig /release
ipconfig /renew
Or switch the PC's IP Configuration to Static and back to DHCP. If the switch port was still orange (spanning tree), the first request can time out. See link stays orange.