DHCP Troubleshooting
This document explains how to fix issues with DHCP on CE devices. DHCP is a system that automatically assigns IP addresses to devices and connects them to a network, making it easier to manage a network. When DHCP is not working, devices can disconnect from the network. This guide will help you check if DHCP is working properly and find possible issues on CE devices.
Troubleshooting Steps
- Cloud
- UCI
- Run-Time
- Testing
- Log
Cloud Configuration Verification
This section details how to check the configurations made in the cloud. The commands below can be used to verify the cloud configuration.
Access the CE Terminal
Log into the CE device and gain root access:
sudo su -
Verify DHCPv2 Configuration
If the device implements DHCPv2, examine its current settings. This command displays the most recently configured settings, as shown in the example response.
cat /tmp/last_config_response.json | jq '.service.dhcpV2'
The given one is just an example output; when this command is run, it will show something like this.
Example Response
{
"eth3": {
"sharedNetworkName": "dhcpServer_eth3",
"subnet": "172.10.2.0/24",
"dnsServer": "172.10.2.1",
"defaultRouter": "172.10.2.1",
"dhcpRanges": [
{
"start": "172.10.2.51",
"stop": "172.10.2.101"
}
]
}
}
This command will extract and display the last configuration response using DHCPv2 configuration.
Q:1 How can I verify if DHCPv2 configuration is applied on the device?
Run the command: cat /tmp/last_config_response.json | jq '.service.dhcpV2'. If the output displays DHCPv2 details (such as subnet, DNS server, default router, and ranges), it means the configuration has been applied. Additionally, check if client devices connected to the LAN are receiving IPs within the defined DHCP range — this confirms the configuration is active.
Q:2 What should I check in the DHCPv2 response to confirm correct configuration?
Verify the following key fields in the JSON output: subnet → Ensure it matches the intended network (e.g., 172.10.2.0/24). dnsServer → Confirm it points to the correct DNS server (often the gateway). defaultRouter → Should match the gateway IP for the subnet. dhcpRanges → Check that the start and stop IPs are within the subnet and correctly defined (e.g., 172.10.2.51 to 172.10.2.101). If all these values align with your intended configuration, the DHCPv2 setup is correct.
Q:3 What if the file /tmp/last_config_response.json is missing?
If the file is missing, it means the device has not yet received or saved the latest cloud configuration. Steps to resolve: Ensure the CE device is online and properly synced with the cloud controller. Trigger a configuration push from the cloud management platform. Check logs (/var/log/) to confirm if configuration updates are being received. If the file still doesn’t appear, restart the CE device or reapply the configuration from the cloud.
UCI Show Configuration Verifiction
This section focuses on verifying the DHCP configuration stored in the UCI system.
Verify Network Configuration Details
To check the DHCP network settings, use the command given here. This command displays the UCI settings of the DHCP network. To check DHCP for a specific interface, use the following command. For example, to view the configuration for eth3, use uci show dhcp.eth3, replacing eth3 with the desired interface name.
uci show dhcp.eth3
The given one is just an example output; when this command is run, it will show something like this.
Example Response
dhcp.eth3=dhcp
dhcp.eth3.interface='eth3'
dhcp.eth3.leasetime='12h'
dhcp.eth3.start='101'
dhcp.eth3.limit='100'
dhcp.eth3.dhcpv4='server'
dhcp.eth3.dhcpv6='server'
dhcp.eth3.ra='server'
dhcp.eth3.ra_slaac='1'
dhcp.eth3.ra_flags='managed-config' 'other-config'
Q:1 Can you view the push configuration of all the interfacers at once?
Yes, you can view the configuration of all DHCP interfaces together by running: uci show dhcp. This command displays the DHCP configuration for every interface (LAN, WAN, eth0, eth3, etc.) in one consolidated output. Using uci show dhcp is helpful when you want to verify the overall DHCP setup across multiple interfaces instead of checking them individually.
Q:2 What do start='101' and limit='100' indicate in the output?
These parameters define the DHCP address pool for the interface: start='101' → The first IP address in the DHCP pool starts at offset 101 from the base network address. For example, if the subnet is 192.168.1.0/24, the first DHCP-assigned IP will be 192.168.1.101. limit='100' → The DHCP server can assign up to 100 IP addresses starting from the defined start point. In the above example, the pool would range from 192.168.1.101 to 192.168.1.200. Together, these values define the scope of dynamic IPs available for client devices on that interface.
Run time Configuration Verification
Use the following commands to verify the runtime status of DHCP and manage the dnsmasq service.
/etc/init.d/dnsmasq status
When this command is run, an output similar to the example below appears.
Example Response:
running
To manually start or stop the dnsmasq service, use the following commands.
/etc/init.d/dnsmasq start
/etc/init.d/dnsmasq stop
Q:1 Which command should be used to manually start the dnsmasq service?
To manually start the dnsmasq service, use: /etc/init.d/dnsmasq start
Q:2 After starting the dnsmasq service, how do I confirm that it has started successfully?
Run the following command: /etc/init.d/dnsmasq status. If the output shows running, it confirms that the dnsmasq service has started successfully.
Q:3 What to do if "Permission denied" appears when running the service start command?
This error occurs because the command requires elevated privileges. To resolve it, run the command with sudo: sudo /etc/init.d/dnsmasq start. If already logged in as root (sudo su -), ensure you have the correct permissions and that the init script is executable.
Testing Verification
This section focuses on verifying the DHCP configuration through testing.
Check CE LAN Configuration and DHCP Status
First, confirm that the CE device has a proper LAN IP address set, such as 172.10.2.1, and that the DHCP server is turned on. This ensures that connected client devices can receive IP addresses automatically.
On the CE interface:
- Make sure the LAN IP is correctly shown in the interface settings.
- Check if the DHCP service is enabled and a valid IP address range is defined, like 172.10.2.51 - 172.10.2.101.
Verify IP Assignment on the Client Device
Once the client device is connected to the CE LAN (via cable or Wi-Fi), check if it has received an IP address within the configured DHCP range. This confirms that the client is properly connected and able to communicate with the network.
Run the following command on the client:
The ifconfig command is used to view network interface names, IP addresses, status, DHCP range, and subnet mask. To check information about a specific interface, use the command with the interface name. The command for that is ifconfig interface name for i.e(ifconfig eth0).
ifconfig
Running the ifconfig command helps verify whether the interface's IP address falls within the DHCP range.
Check Internet Connectivity from Client
Run the ping test:
The ping command can be used to check internet connectivity and verify access via a browser.
ping 8.8.8.8
The given one is just an example output; when this command is run, it will show something like this.
Example Response
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=113 time=63.279 ms
64 bytes from 8.8.8.8: seq=1 ttl=113 time=49.643 ms
64 bytes from 8.8.8.8: seq=2 ttl=113 time=82.592 ms
Q:1 How to check if a client device gets an IP from DHCP?
Connect the client device to the CE LAN (via cable or Wi-Fi). Run the command: ifconfig. or specify the interface, e.g.: ifconfig eth0. Verify that the assigned IP address falls within the configured DHCP range (e.g., 172.10.2.51 – 172.10.2.101). If the IP is within this range, it confirms the client received its IP from the DHCP server.
Q:2 What to do if you don't get a reply in the ping test?
If ping 8.8.8.8 does not return a response: Check if the client has a valid IP address and default gateway. Verify that the CE device itself has internet connectivity. Ensure firewall rules or traffic policies are not blocking ICMP packets. Try pinging the gateway IP (e.g., ping 172.10.2.1) to confirm local connectivity. If local ping works but external ping fails, check WAN configuration or ISP connectivity.
Q:3 What is the alternative if the ifconfig command is not available?
On modern Linux distributions, ifconfig may not be installed by default. Use: ip addr show. On Windows, use: ipconfig. On macOS, ifconfig is still available, but networksetup can also be used for detailed interface info.
Log Verification
System Log Inspection
Run the following command to check the system log for any DHCP-related errors or warnings.
logread | grep dhcp
The given one is just an example output; when this command is run, it will show something like this.
Example Response
Jun 19 09:30:29 manual-testing dnsmasq-dhcp[1]: IPv6 router advertisement enabled
Jun 19 09:30:29 manual-testing dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 0 names
Jun 19 09:30:29 manual-testing dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c.4116 - 0 names
Jun 19 09:30:31 manual-testing dnsmasq-dhcp[1]: DHCP, IP range 172.30.2.101 -- 172.30.2.200, lease time 12h
Jun 19 09:30:31 manual-testing dnsmasq-dhcp[1]: DHCPv6, IP range ::1000 -- ::ffff, lease time 12h, template for eth3
Jun 19 09:30:31 manual-testing dnsmasq-dhcp[1]: DHCPv4-derived IPv6 names on eth3
Jun 19 09:30:31 manual-testing dnsmasq-dhcp[1]: router advertisement on eth3
Jun 19 09:30:31 manual-testing dnsmasq-dhcp[1]: IPv6 router advertisement enabled
Jun 19 09:30:31 manual-testing dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 2 names
Jun 19 09:30:31 manual-testing dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses
Jun 19 09:56:43 manual-testing hiclouds_config.sh[10866]: configuring dhcpV2
Jun 19 09:56:52 manual-testing dnsmasq-dhcp[1]: DHCP, IP range 172.30.2.101 -- 172.30.2.200, lease time 12h
Jun 19 09:56:52 manual-testing dnsmasq-dhcp[1]: DHCPv6, IP range ::1000 -- ::ffff, lease time 12h, template for eth3
Jun 19 09:56:52 manual-testing dnsmasq-dhcp[1]: DHCPv4-derived IPv6 names on eth3
Jun 19 09:56:52 manual-testing dnsmasq-dhcp[1]: router advertisement on eth3
Jun 19 09:56:52 manual-testing dnsmasq-dhcp[1]: IPv6 router advertisement enabled
Jun 19 09:56:52 manual-testing dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 2 names
Jun 19 09:56:52 manual-testing dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses
Jun 19 10:00:26 manual-testing netifd: eth0 (3736): udhcpc: sending renew to server 172.20.10.1
Jun 19 10:00:26 manual-testing netifd: eth0 (3736): udhcpc: lease of 172.20.10.4 obtained from 172.20.10.1, lease time 3600
Jun 19 10:06:22 manual-testing hiclouds_config.sh[4391]: configuring dhcpV2
Jun 19 10:06:32 manual-testing dnsmasq-dhcp[1]: DHCP, IP range 172.30.2.101 -- 172.30.2.200, lease time 12h
Jun 19 10:06:32 manual-testing dnsmasq-dhcp[1]: DHCPv6, IP range ::1000 -- ::ffff, lease time 12h, template for eth3
Jun 19 10:06:32 manual-testing dnsmasq-dhcp[1]: DHCPv4-derived IPv6 names on eth3
Jun 19 10:06:32 manual-testing dnsmasq-dhcp[1]: router advertisement on eth3
Jun 19 10:06:32 manual-testing dnsmasq-dhcp[1]: IPv6 router advertisement enabled
Jun 19 10:06:32 manual-testing dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 2 names
Jun 19 10:06:32 manual-testing dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses
Jun 19 10:06:51 manual-testing hiclouds_config.sh[8401]: configuring dhcpV2
Jun 19 10:06:59 manual-testing dnsmasq-dhcp[1]: DHCP, IP range 172.30.2.101 -- 172.30.2.200, lease time 12h
Jun 19 10:06:59 manual-testing dnsmasq-dhcp[1]: DHCPv6, IP range ::1000 -- ::ffff, lease time 12h, template for eth3
Jun 19 10:06:59 manual-testing dnsmasq-dhcp[1]: DHCPv4-derived IPv6 names on eth3
Jun 19 10:06:59 manual-testing dnsmasq-dhcp[1]: router advertisement on eth3
Jun 19 10:06:59 manual-testing dnsmasq-dhcp[1]: IPv6 router advertisement enabled
Jun 19 10:06:59 manual-testing dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 2 names
Jun 19 10:06:59 manual-testing dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses
Jun 19 10:30:26 manual-testing netifd: eth0 (3736): udhcpc: sending renew to server 172.20.10.1
Jun 19 10:30:26 manual-testing netifd: eth0 (3736): udhcpc: lease of 172.20.10.4 obtained from 172.20.10.1, lease time 3600
Jun 19 11:00:26 manual-testing netifd: eth0 (3736): udhcpc: sending renew to server 172.20.10.1
Jun 19 11:15:27 manual-testing netifd: eth0 (3736): udhcpc: sending renew to server 172.20.10.1
Jun 19 11:15:27 manual-testing netifd: eth0 (3736): udhcpc: lease of 172.20.10.4 obtained from 172.20.10.1, lease time 3600
Q:1 What output is likely to be obtained after running this command?
When you run: logread | grep dhcp. The output will typically show: DHCPv4 and DHCPv6 ranges (e.g., DHCP, IP range 172.30.2.101 -- 172.30.2.200, lease time 12h). Router advertisements for IPv6. Lease assignments showing which client devices obtained IPs from the DHCP server. Configuration events like configuring dhcpV2 when updates are applied. Together, these logs confirm that the DHCP service is running, ranges are defined, and clients are being served addresses correctly.