Linux DHCP Server: Difference between revisions

From Braindisconnect
Jump to navigationJump to search
No edit summary
Line 8: Line 8:
'''Example using file names:'''<br>
'''Example using file names:'''<br>
dhcpd -t –cf /etc/dhcp/dhcpd.conf
dhcpd -t –cf /etc/dhcp/dhcpd.conf
syntax is good and should report errors in the config
syntax is good and should report errors in the config
<br><br>
dhcpd -t /etc/dhcp/dhcpd.conf
dhcpd -t /etc/dhcp/dhcpd.conf
  /etc/default/isc-dhcp-server: interface name too long (is 28)
  /etc/dhcp/dhcpd.conf: interface name too long (is 20)
  Reports the error because there is an issue with your syntax for the dhcpd command... add the -cf to clear the error  
Reports the error because its interpreting the /etc/dhcp/dhcpd.conf as an interface.<br>
The 20 is the character count of "/etc/dhcp/dhcpd.conf" and not the file contents.<br>
add the -cf to clear the error  
dhcpd -t –cf /etc/dhcp/dhcpd.conf


==== DHCP failing to start ====
==== DHCP failing to start ====

Revision as of 13:46, 25 February 2016

Errors

interface name too long

dhcpd -t
or
dhcpd -t –cf <file and location>

Example using file names:
dhcpd -t –cf /etc/dhcp/dhcpd.conf syntax is good and should report errors in the config

dhcpd -t /etc/dhcp/dhcpd.conf

/etc/dhcp/dhcpd.conf: interface name too long (is 20)

Reports the error because its interpreting the /etc/dhcp/dhcpd.conf as an interface.
The 20 is the character count of "/etc/dhcp/dhcpd.conf" and not the file contents.
add the -cf to clear the error

dhcpd -t –cf /etc/dhcp/dhcpd.conf

DHCP failing to start

Check your messages log:
tail -f /var/log/message

Mar 14 19:50:49 server dhcpd: No subnet declaration for eth1 (172.16.31.254).
Mar 14 19:50:49 server dhcpd: ** Ignoring requests on eth1.  If this is not what
Mar 14 19:50:49 server dhcpd:    you want, please write a subnet declaration
Mar 14 19:50:49 server dhcpd:    in your dhcpd.conf file for the network segment
Mar 14 19:50:49 server dhcpd:    to which interface eth1 is attached. **
Mar 14 19:50:49 server dhcpd: 
Mar 14 19:50:49 server dhcpd: 
Mar 14 19:50:49 server dhcpd: Not configured to listen on any interfaces!

cat /etc/network/interfaces

~
# To Router Interface
auto eth1
iface eth1 inet static
       address 172.16.31.254
       netmask 255.255.255.0
       network 172.16.31.0
       broadcast 172.16.31.255

This issue is because the interface set for DHCP does have the subnet defined in a declaration statement in dhcp.conf.

At the very least declare the subnet even if you do not plan on serving DHCP to that particular subnet.

subnet 172.16.31.0 netmask 255.255.255.0 {
}