Jeremy’s IT Lab lecture video:
Commands
Commands List
DHCP Show Commands
15. DHCP
Link to original
- show ip dhcp binding
-->
Shows all DHCP clients which are currently assigned IP addressesDHCP Global Config Commands
DHCP Global
Link to original
- ip dhcp excluded-address low-address high-address
-->
Specifies the range of addresses that won’t be given to DHCP clients- ip dhcp pool pool-name
-->
Initiates a DHCP pool and enters DHCP pool configuration mode or enters DHCP pool configuration if the pool already exists
- network ip-address { /prefix-length
|
subnet-mask }-->
Specifies the subnet of addressed to be assigned to clients (Except the excluded addresses)- lease time { days hours minutes
|
infinite }-->
Specifies the DHCP IP address lease time- default-router ip-address
-->
Specifies the default gateway that the DHCP clients should use- dns-server ip-address
-->
Specifies the DNS server that DHCP clients should use- domain-name domain-name
-->
Specifies the domain name of the network- option 43 ip ip-address
-->
Enables Option 43 for DHCP clients, which can be used to tell the APs the IP address of their WLCDHCP Interface Commands
DHCP Interface
Link to original
- ip helper-address ip-address
-->
Configures the current interface as a DHCP relay agent (meant to be used on the interface that’s connected to the DHCP clients)- ip address dhcp
-->
Tells the router to get an IP address from the DHCP server for this specific interfaceWindows IP-related Commands
IP Configuration Commands
IP Configuration Commands
Link to original
- Windows: ^networking-commands-windows
- General
- arp -a
-->
Shows the ARP list- Ping host-name/ip-address [-n number-of-pings]
-->
Pings the host or IP address with the specified number of pings- nslookup domain-name
-->
Performs a DNS query to look up the domain name’s actual IP address- ipconfig
- ipconfig (General) ^ipconfig-general-windows
- ipconfig
-->
Shows basic IP config info- ipconfig /all
-->
Shows detailed IP config info- ipconfig (DNS) ^ipconfig-dns-windows
- ipconfig /displaydns
-->
Displays information about the DNS cache- ipconfig /flushdns
-->
Deletes the DNS cache- ipconfig (DHCP) ^ipconfig-dhcp-windows
- ipconfig /renew
-->
Gets a new IP address via DHCP- ipconfig /release
-->
Releases the PC’s DHCP learned IP address
DHCP Info
DHCP General Information
Dynamic Host Configuration Protocol (DHCP) is a protocol that allows hosts to automatically/dynamically learn various aspects of their network configuration without manual configuration, including information such as:
- IP address
- Subnet mask
- Default gateway
- DNS server
- DHCP is typically used for ‘client devices’, while devices like routers, servers and etc, are manually configured
- DHCP servers run on port 67 while DHCP clients run on port 68.
What devices are usually DHCP servers?
- In small networks (like homes and small offices), the router usually acts as the DHCP server.
- In large networks, a dedicated server usually running Windows/Linux acts as the DHCP server.
DHCP server leasing
DHCP servers ‘lease’ IP addresses to clients.
This means that any IP addresses assigned to clients are not permanent, and the client must give up the address at the end of the lease.
DHCP DORA Steps
For a DHCP client to contact and get information from the DHCP server, it has to go through four steps sometimes called ‘DORA’ for short:
- DHCP Discover
- DHCP Offer
- DHCP Request
- DHCP Ack
1. DHCP Discover
A DHCP Discover is the first message that clients send when they are looking for a DHCP server to connect to. Some of the message properties are:
- It is a broadcast message
- The source MAC is the client’s MAC address
- The destination MAC is the broadcast MAC address (ffff.ffff.ffff)
- The source IP is 0.0.0.0
- The destination IP is the broadcast IP address (255.255.255.255)
The message contains some general information about the client for the DHCP server to use, like whether the client wants the response messages sent back to be unicast or broadcast, or if the client would like a specific IP address.
2. DHCP Offer
The DHCP Offer message is sent by the DHCP server after receiving a DHCP Discover message. It offers an IP address to the client. Some of the message properties are:
- It can be a broadcast or a unicast message.
- The source MAC is the server’s MAC address
- The destination MAC is the client’s MAC address, which the server learned from the Discover message.
- The source IP is the IP address of the server
- The destination IP is the IP address that’s being offered to the client
3. DHCP Request
The DHCP Request is a message that is sent from the client to a DHCP server, informing the server that it is requesting the IP address that has been previously offered to it. Some of the message properties are:
- It is a broadcast message
- The source MAC is the client’s MAC address
- The destination MAC is the broadcast MAC address (ffff.ffff.ffff)
- The source IP is 0.0.0.0
- The destination IP is the broadcast IP address (255.255.255.255)
In the DHCP Request message, the client uses an option called ‘Option 54 - DHCP Server Identifier’ to indicate which DHCP server it is communicating with.
4. DHCP Ack
The DHCP Ack message is sent by the DHCP server as a response to the DHCP Request, informing the client that it has accepted its request, and will provide it with the requested IP address. Some of the message properties are:
- It can be a broadcast or a unicast message.
- The source MAC is the server’s MAC address
- The destination MAC is the client’s MAC address, which the server learned from the Discover message.
- The source IP is the IP address of the server
- The destination IP is the IP address that’s being offered to the client
How does a client tell the servers if it wants a unicast or broadcast response?
The client informs the servers if it wants a unicast or broadcast response through the “Bootp flag” that’s contained in the DHCP Discover message.
- If the Bootp flag value is 0x0000 then the response will be unicast.
- If the Bootp flag value is 0x8000 then the response will be broadcast.
Why would the client want a unicast or broadcast response?
Some clients may be configured in a way that does not let them accept unicast packets unless an IP address has already been assigned to them. In that case, the DHCP server is instructed to send the Offer message as a broadcast.
DHCP DORA + Release Table and Summary Image
Step | Location --> Location | Message Type |
---|---|---|
Discover | Client --> Server | Broadcast |
Offer | Server --> Client | Broadcast or Unicast |
Request | Client --> Server | Broadcast |
Ack | Server --> Client | Broadcast or Unicast |
Release | Client --> Server | Unicast |
![]() |
---|
DORA Summary Image |
DHCP Relay
Smaller networks may opt to use one of the router’s as a DHCP server, but in bigger networks, a centralized DHCP server is often used. This is when DHCP Relays are used.
- Having a centralized DHCP server means that the server won’t be able to receive the clients’ broadcast DHCP messages. (Broadcast messages don’t leave the local subnet)
- To fix this issue, we can configure routers to act as a DHCP relay agent.
- A relay agent will forward the client’s broadcast DHCP messages to the remote centralized DHCP server in the form of unicast messages.
![]() |
---|
DHCP Relay Example |
DHCP and Windows OS
There are a few commands you can use on Windows to view DHCP information, as well as release and renew DHCP leases.
ipconfig /all
- Shows the IP configuration settings on Windows, including:
- The current IP address and whether it’s ‘preferred’ or not (An IP address being preferred means that it has been assigned to the device by DHCP previously)
- The lease obtain and expiration dates
- The current DHCP server
- Shows the IP configuration settings on Windows, including:
ipconfig /release
- Sends a DHCP Release message to the DHCP server, informing it that it’d like to release the current IP address. The DHCP server will now consider this IP address to be free and usable by other devices.
- Some of the Release message’s properties are:
- It is a unicast message.
- The source MAC is the client’s MAC address
- The destination MAC is the server’s MAC address
- The source IP is the current IP address configured on the device
- The destination IP is the IP address of the DHCP server
ipconfig /renew
- Initiates a communication with a DHCP server by following the DORA steps.
- By the end of it, the client will have received an IP address from the server.
DHCP Server Configuration in Cisco IOS
DHCP Show Command
There’s one show command to see the hosts which have been assigned an IP through the DHCP protocol
show ip dhcp binding
- Shows the hosts that have been assigned an IP address from the DHCP server
- Displays information about the hosts including:
- IP address
- Client ID / MAC address / Username
- Lease expiration date
DHCP Server Configuration
DHCP server configuration is done through some commands in global config mode, and a few through DHCP-config mode.
- Global Config
ip dhcp excluded-address LOW-ADDRESS HIGH-ADDRESS
- Specifies the range of addresses that won’t be given to DHCP clients
ip dhcp pool POOL-NAME
- Initiates a DHCP pool and enters DHCP pool configuration mode or enters DHCP pool configuration if the pool already exists
- DHCP Config
network IP-ADDRESS { /PREFIX-LENGTH | SUBNET-MASK }
- Specifies the subnet of addressed to be assigned to clients (Except the excluded addresses)
dns-server IP-ADDRESS
- Specifies the DNS server that DHCP clients should use
domain-name DOMAIN-NAME
- Specifies the domain name of the network
default-router IP-ADDRESS
- Specifies the default gateway that the DHCP clients should use
lease TIME { days hours minutes | infinite }
- Specifies the DHCP IP address lease time
DHCP Router Relay Agent Configuration
To configure a router to be a DHCP relay agent, you’d have to enter the configuration mode of an interface that’s connected to clients and use the following command:
ip helper-address IP-ADDRESS
- Configures the current interface as a DHCP relay agent.
- It will then forward DHCP Discover messages to the DHCP server in the form of unicast messages. (Instead of being broadcast)