I am setting up a DHCP server on Debain (virtual machine) on Ubuntu 12.04 host, but unable to get it up and running.
My configuration is like this,
dhcpd.conf
ddns-update-style none;
option domain-name "xyz.com";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 172.16.101.0 netmask 255.255.255.0 { range 172.16.101.10 172.16.101.20; #option broadcast-address 172.16.101.255; #option subnet-mask 255.255.255.0; option routers 172.16.101.1;
}For interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth2
auto eth2
iface eth2 inet dhcp/etc/default/isc-dhcp-server
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth2"but everytime I restart dhcp service it says,
root@debian1:/home/user# /etc/init.d/isc-dhcp-server restart
Stopping ISC DHCP server: dhcpd failed!
Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. ... failed! failed!What is wrong with this configuration?
22 Answers
Are you trying to have a system get an address for itself via DHCP? That's a bad idea for very many reasons.
You need a DHCP server running outside of this system.
I believe the isc-dhcp-server is failing because no interface is on the same subnet as your specified DHCP scope. eth2 cannot fufill this criteria because it has no IP address. And if it had an IP address ... it wouldn't need to get one via DHCP. You can see why what you are doing makes no sense.
Do a tail -n 30 /var/log/syslog after you try to start it again to be exactly sure.
As the only problem is VM connectivity and your router provides IP configuration of your LAN then switch off the dhcpd so it would not start at boot.
Then start VirtualBox, open Settings of your VM and click on Network. In the Attached to dropdown list select Bridged Adapter.
Then click OK and start your VM.
Your guest OS should get the address from the router.
22