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?
Q:2 What should I check in the DHCPv2 response to confirm correct configuration?
Q:3 What if the file /tmp/last_config_response.json is missing?
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?
Q:2 What do start='101' and limit='100' indicate in the output?
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?
Q:2 After starting the dnsmasq service, how do I confirm that it has started successfully?
Q:3 What to do if "Permission denied" appears when running the service start command?
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?
Q:2 What to do if you don't get a reply in the ping test?
Q:3 What is the alternative if the ifconfig command is not available?
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