Ubuntu 16.04: Install isc-dhcp-server and run DHCP server

Table of Contents

1 Install isc-dhcp-server

Install isc-dhcp-server with apt.

$ sudo apt install -y isc-dhcp-server

2 /etc/dhcp/dhcpd.conf

Define domain name, DHCP server IP address and gateway IP address. Mapping MAC address 52:54:00:e9:ee:38 to IP address

$ cat /etc/dhcp/dhcpd.confsubnet netmask { option domain-name “my.net”; option domain-name-servers,; option routers;}host debian-8 { hardware ethernet 52:54:00:e9:ee:38; fixed-address;}

3 Run isc-dhcp-server

Run isc-dhpc-server with systemd.

$ sudo systemctl enable isc-dhcp-server$ sudo systemctl restart isc-dhcp-server

4 Execution result

Checking IP address on MAC address 52:54:00:e9:ee:38 machine.

$ /sbin/ifconfigeth0 Link encap:Ethernet HWaddr 52:54:00:e9:ee:38 inet addr: Bcast: inet6 addr: fe80::5054:ff:fee9:ee38/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:311 errors:0 dropped:0 overruns:0 frame:0 TX packets:187 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:41640 (40.6 KiB) TX bytes:26614 (25.9 KiB)lo Link encap:Local Loopback inet addr: Mask: inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)$ cat /etc/resolv.conf# Generated by NetworkManagersearch my.netnameserver

Ubuntu 16.04 needs edit to edit NetworkManager.conf for generating /etc/resolv.conf with DHCP server infomation.

$ sudo diff -uprN /etc/NetworkManager/NetworkManager.conf{.org,}— /etc/NetworkManager/NetworkManager.conf.org 2016-04-28 01:07:32.015679999 +0900+++ /etc/NetworkManager/NetworkManager.conf 2016-04-28 01:07:45.307679999 +0900@@ -1,6 +1,6 @@ [main] plugins=ifupdown,keyfile,ofono-dns=dnsmasq+#dns=dnsmasq [ifupdown] managed=false$ sudo systemctl restart network-manager

Android | Linux | SDL - Narrow Escape