tested on:
hostnamectl
Static hostname: DebianLaptop
Icon name: computer-laptop
Chassis: laptop
Operating System: Debian GNU/Linux 8 (jessie)
Kernel: Linux 3.16.0-4-686-pae
Architecture: x86
i assume you have your laptop/pc LAN connected to a switch/router and your default network card is eth0.
open up two terminals:
terminal1: will listen to ALL log files for debugging of the situation
find /var/log/ -type f \( -name "*" \) ! -path '*.gz*' -exec tail -n0 -f "$file" {} +
you might very well write this to a script file and restart it several times.
terminal2:
apt-get update; apt-get install isc-dhcp-server; # install isc-dhcp-server apt-cache show isc-dhcp-server; # show info about package (isc-dhcp-server.package-description.txt) # Filename: pool/main/i/isc-dhcp/isc-dhcp-server_4.2.2.dfsg.1-5+deb70u8_i386.deb ifconfig eth0 192.168.10.1 netmask 255.255.255.0 up; # give your default NIC an ip
open up config1:
vim /etc/dhcp/dhcpd.conf
it should have this content: dhcpd.conf.txt
and:
vim /etc/default/isc-dhcp-server
should have this content:
change this line to the interface you would like the dhcp server to serve ip addresses on:
INTERFACES="eth0"
on terminal2 try to run the server:
/etc/init.d/isc-dhcp-server restart; # start/restart dhcp service
… now you should get a massive amount of information on terminal1 (debugging by following all logs)
==> /var/log/messages <== Dec 19 22:05:16 localhost, dhcpd: Internet Systems Consortium DHCP Server 4.3.1 Dec 19 22:05:16 localhost, dhcpd: Copyright 2004-2014 Internet Systems Consortium. Dec 19 22:05:16 localhost, dhcpd: All rights reserved. Dec 19 22:05:16 localhost, dhcpd: For info, please visit https://www.isc.org/software/dhcp/ Dec 19 22:05:16 localhost, dhcpd: Internet Systems Consortium DHCP Server 4.3.1 Dec 19 22:05:16 localhost, dhcpd: Copyright 2004-2014 Internet Systems Consortium. Dec 19 22:05:16 localhost, dhcpd: All rights reserved. Dec 19 22:05:16 localhost, dhcpd: For info, please visit https://www.isc.org/software/dhcp/ Dec 19 22:05:16 localhost, dhcpd: Wrote 1 leases to leases file. Dec 19 22:05:16 localhost, dhcpd: ==> /var/log/syslog <==
Dec 19 22:05:16 localhost, dhcpd: Internet Systems Consortium DHCP Server 4.3.1
Dec 19 22:05:16 localhost, dhcpd: Copyright 2004-2014 Internet Systems Consortium.
Dec 19 22:05:16 localhost, dhcpd: All rights reserved.
Dec 19 22:05:16 localhost, dhcpd: For info, please visit https://www.isc.org/software/dhcp/
Dec 19 22:05:16 localhost, dhcpd: Internet Systems Consortium DHCP Server 4.3.1
Dec 19 22:05:16 localhost, dhcpd: Copyright 2004-2014 Internet Systems Consortium.
Dec 19 22:05:16 localhost, dhcpd: All rights reserved.
Dec 19 22:05:16 localhost, dhcpd: For info, please visit https://www.isc.org/software/dhcp/
Dec 19 22:05:16 localhost, dhcpd: Wrote 1 leases to leases file.
Dec 19 22:05:16 localhost, dhcpd:
Dec 19 22:05:16 localhost, dhcpd: No subnet declaration for eth0 (no IPv4 addresses).
Dec 19 22:05:16 localhost, dhcpd: ** Ignoring requests on eth0. If this is not what
Dec 19 22:05:16 localhost, dhcpd: you want, please write a subnet declaration
Dec 19 22:05:16 localhost, dhcpd: in your dhcpd.conf file for the network segment
Dec 19 22:05:16 localhost, dhcpd: to which interface eth0 is attached. **
Dec 19 22:05:16 localhost, dhcpd:
Dec 19 22:05:16 localhost, dhcpd:
Dec 19 22:05:16 localhost, dhcpd: Not configured to listen on any interfaces!
Dec 19 22:05:16 localhost, dhcpd:
Dec 19 22:05:16 localhost, dhcpd: If you think you have received this message due to a bug rather
Dec 19 22:05:16 localhost, dhcpd: than a configuration issue please read the section on submitting
Dec 19 22:05:16 localhost, dhcpd: bugs on either our web page at www.isc.org or in the README file
Dec 19 22:05:16 localhost, dhcpd: before submitting a bug. These pages explain the proper
Dec 19 22:05:16 localhost, dhcpd: process and the information we find helpful for debugging..
Dec 19 22:05:16 localhost, dhcpd:
Dec 19 22:05:16 localhost, dhcpd: exiting.
==> /var/log/daemon.log <== Dec 19 22:05:18 localhost, isc-dhcp-server[9618]: Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. ... failed! Dec 19 22:05:18 localhost, isc-dhcp-server[9618]: failed! Dec 19 22:05:18 localhost, systemd[1]: isc-dhcp-server.service: control process exited, code=exited status=1 Dec 19 22:05:18 localhost, systemd[1]: Failed to start LSB: DHCP server. Dec 19 22:05:18 localhost, systemd[1]: Unit isc-dhcp-server.service entered failed state. ==> /var/log/syslog <==
Dec 19 22:05:18 localhost, isc-dhcp-server[9618]: Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. ... failed!
Dec 19 22:05:18 localhost, isc-dhcp-server[9618]: failed!
Dec 19 22:05:18 localhost, systemd[1]: isc-dhcp-server.service: control process exited, code=exited status=1
Dec 19 22:05:18 localhost, systemd[1]: Failed to start LSB: DHCP server.
Dec 19 22:05:18 localhost, systemd[1]: Unit isc-dhcp-server.service entered failed state.
which in my case simply meant… the nic has forgotten about it’s ip, because the network cable was unplugged in and the gnome network manager has deactivated the device.
so the error messages from the logs are sometimes missleading…
after an:
ifconfig eth0 192.168.10.1 netmask 255.255.255.0 up; # give your default NIC an ip
/etc/init.d/isc-dhcp-server restart; # start/restart dhcp service
it should respond with:
[ ok ] Restarting isc-dhcp-server (via systemctl): isc-dhcp-server.service.
if everything works fine and a dhcp client connects to your laptop-pc-dhcp-server you can read in the logs:
==> /var/log/daemon.log <==
Dec 19 22:10:30 localhost, NetworkManager[695]: (eth0): link connected
==> /var/log/messages <== Dec 19 22:10:30 localhost, kernel: [13095.544852] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx Dec 19 22:10:30 localhost, kernel: [13095.544906] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready ==> /var/log/syslog <==
Dec 19 22:10:30 localhost, NetworkManager[695]: (eth0): link connected
Dec 19 22:10:30 localhost, kernel: [13095.544852] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx
Dec 19 22:10:30 localhost, kernel: [13095.544906] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
==> /var/log/kern.log <== Dec 19 22:10:30 localhost, kernel: [13095.544852] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx Dec 19 22:10:30 localhost, kernel: [13095.544906] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready ==> /var/log/daemon.log <== Dec 19 22:10:32 localhost, avahi-daemon[719]: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::5e26:aff:fe18:905e. Dec 19 22:10:32 localhost, avahi-daemon[719]: New relevant interface eth0.IPv6 for mDNS. Dec 19 22:10:32 localhost, avahi-daemon[719]: Registering new address record for fe80::5e26:aff:fe18:905e on eth0.*. ==> /var/log/syslog <== Dec 19 22:10:32 localhost, avahi-daemon[719]: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::5e26:aff:fe18:905e. Dec 19 22:10:32 localhost, avahi-daemon[719]: New relevant interface eth0.IPv6 for mDNS. Dec 19 22:10:32 localhost, avahi-daemon[719]: Registering new address record for fe80::5e26:aff:fe18:905e on eth0.*. ==> /var/log/messages <== Dec 19 22:10:33 localhost, dhcpd: DHCPDISCOVER from 00:1e:06:30:cf:9b via eth0 ==> /var/log/syslog <== Dec 19 22:10:33 localhost, dhcpd: DHCPDISCOVER from 00:1e:06:30:cf:9b via eth0 ==> /var/log/daemon.log <== Dec 19 22:10:34 localhost, ntpd[774]: Listen normally on 39 eth0 fe80::5e26:aff:fe18:905e UDP 123 Dec 19 22:10:34 localhost, ntpd[774]: peers refreshed ==> /var/log/messages <== Dec 19 22:10:34 localhost, dhcpd: DHCPOFFER on 192.168.10.10 to 00:1e:06:30:cf:9b (odroid) via eth0 Dec 19 22:10:34 localhost, dhcpd: DHCPREQUEST for 192.168.10.10 (192.168.10.1) from 00:1e:06:30:cf:9b (odroid) via eth0 Dec 19 22:10:34 localhost, dhcpd: DHCPACK on 192.168.10.10 to 00:1e:06:30:cf:9b (odroid) via eth0 ==> /var/log/syslog <==
Dec 19 22:10:34 localhost, ntpd[774]: Listen normally on 39 eth0 fe80::5e26:aff:fe18:905e UDP 123
Dec 19 22:10:34 localhost, ntpd[774]: peers refreshed
Dec 19 22:10:34 localhost, dhcpd: DHCPOFFER on 192.168.10.10 to 00:1e:06:30:cf:9b (odroid) via eth0
Dec 19 22:10:34 localhost, dhcpd: DHCPREQUEST for 192.168.10.10 (192.168.10.1) from 00:1e:06:30:cf:9b (odroid) via eth0
Dec 19 22:10:34 localhost, dhcpd: DHCPACK on 192.168.10.10 to 00:1e:06:30:cf:9b (odroid) via eth0
so the odroid client was asigned the IP 192.168.10.10 from the dhcp-service!
CONGRATULATIONS! YOU JUST SUCCESSFULLY CONFIGURED YOUR OWN DHCP SERVER UNDER LINUX! ROCK ON!
if you want to disable the dhcp service:
update-rc.d -f isc-dhcp-server remove
If you want to enable the dhcp service:
update-rc.d isc-dhcp-server defaults
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!
