Loading...
Linux Interview Questions

DHCP Server

1. What is DHCP?
A) DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses, subnet masks, gateways, and DNS servers to clients on a network.

2. What ports does DHCP use?
A)

  • UDP 67 → Server
  • UDP 68 → Client

3. What is the difference between DHCP reservation and static IP?
A)

  • Reservation → IP assigned dynamically by DHCP but fixed to a MAC address.
  • Static IP → Manually configured on the device, independent of DHCP.

4. How do you check DHCP server logs in Linux?
A)

  • Log file: /var/log/syslog or /var/log/messages
  • For ISC DHCP: /var/lib/dhcp/dhcpd.leases

5. What is the difference between DHCP server and DNS server?
A)

  • DHCP → Assigns IP addresses dynamically.
  • DNS → Resolves domain names to IP addresses.

6. How do you troubleshoot when a client is not getting an IP from DHCP?
A)

  • Check cable/connection.
  • Verify DHCP service is running (systemctl status isc-dhcp-server).
  • Ensure IP pool has free addresses.
  • Check if relay is configured for remote subnets.
  • Look at logs with tail -f /var/log/syslog.

7. What is the default lease time in DHCP?
A)
Default lease time depends on server config (commonly 24 hours).Can be set using default-lease-time and max-lease-time in config.

DHCP Real-Time Troubleshooting Scenarios

8. Client not getting IP address
Problem: New client fails to get IP.
Troubleshooting Steps:

Check network cable or Wi-Fi connection.

Verify DHCP service is running (systemctl status isc-dhcp-server).

Check DHCP scope range in config file.

Inspect logs: tail -f /var/log/syslog.
Solution: Expand IP pool or restart DHCP service.

9. IP address conflict
Problem: Two devices have the same IP.
Troubleshooting Steps:

Check for static IP on one device.

Look for duplicate MAC binding in DHCP server.

Run arp -a to identify conflicts.
Solution: Use DHCP reservation for critical systems, avoid static IPs in DHCP range.

10. DHCP server is not responding
Problem: Client gets APIPA (169.254.x.x) address.
Troubleshooting Steps:

Verify server listening on UDP 67.

Check firewall blocking port 67/68.

Ping DHCP server from client.
Solution: Restart service or fix firewall rules.

11. DHCP relay not working across subnets
Problem: Clients in another subnet not receiving IP.
Troubleshooting Steps:

Check if relay agent (IP helper) is configured on router.

Verify correct DHCP server IP in relay config.

Use tcpdump -i eth0 port 67 or 68 to capture packets.
Solution: Configure DHCP relay correctly on router/switch.

12. Wrong gateway/DNS assigned
Problem: Clients unable to access internet.
Troubleshooting Steps:

Run ipconfig /all (Windows) or nmcli dev show (Linux) to check gateway/DNS.

Verify DHCP options 3 (router) and 6 (DNS).

Inspect config file for typos.
Solution: Correct gateway/DNS in DHCP config and restart service.

13. DHCP performance issues (high load)
Problem: Delayed IP assignment during peak hours.
Troubleshooting Steps:

Check server load with top, sar, or htop.

Monitor DHCP logs for request floods.

Use tcpdump to check packet drops.
Solution: Configure DHCP failover with a secondary server, enable rate limiting if under attack.

Leave a Reply

Your email address will not be published. Required fields are marked *