====== 24.04 DHCP Server Installation ====== We will now set up a DHCP Server and configure it to hand out a specific range of addresses and update DNS (once we set it up) Install the DHCP server package. sudo apt install isc-dhcp-server It will fail on startup as it is not configured yet.- stop the service systemctl stop isc-dhcp-server.service Configure the interface to listen on nano /etc/default/isc-dhcp-server Change the parameter for "interfaces" # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACESv4="br0" INTERFACESv6="" Configure / copy keys for Dynamic DNS updates and set permissions cp /etc/bind/rndc.key /etc/dhcp/ddns-keys chown root:root /etc/dhcp/ddns-keys/rndc.key chmod 640 /etc/dhcp/ddns-keys/rndc.key Configure /etc/dhcp/dhcpd.conf nano /etc/dhcp/dhcpd.conf The following sample config file sets up the following parameters. * Hands out IP addresses in the range 10.3.100.1 10.3.100.200; * Set a lease time of 8hours * Sets the following clients default settings ** default router = 10.3.1.1 ** domain-name-servers 10.3.200.1; ** domain-name "scottworld.net"; ** routers 10.3.1.1; ** broadcast-address 10.3.255.255; ** It reserves a number of addresses by mac address for certain devices / hosts. Its will also attempt to dynamically update DNS with new clients. (When we configure it) # dhcpd.conf # # Sample configuration file for ISC dhcpd # # Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as # configuration file instead of this file. # # option definitions common to all supported networks... option domain-name "scottworld.net"; option domain-name-servers 10.3.200.1; default-lease-time 28800; max-lease-time 86400; # The ddns-updates-style parameter controls whether or not the server will # attempt to do a DNS update when a lease is confirmed. We default to the # behavior of the version 2 packages ('none', since DHCP v2 didn't # have support for DDNS.) ddns-update-style standard; include "/etc/dhcp/ddns-keys/rndc.key"; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. authoritative; # Definition of RFC 4833 Timezone Options option tz-posix-string code 100 = string; option tz-database-string code 101 = string; # Global options option domain-name "scottworld.net"; option domain-name-servers 10.3.200.1; option ntp-servers 10.3.200.1; option time-servers 10.3.200.1; option time-offset 0; option tz-posix-string "GMT0BST,M3.5.0/01:00,M10.5.0/01:00"; option tz-database-string "Europe/London"; # Dynamic DNS zones zone scottworld.net. { primary 10.3.200.1; key rndc-key; } zone 3.10.in-addr.arpa. { primary 10.3.200.1; key rndc-key; } # Address scopes subnet 10.3.0.0 netmask 255.255.0.0 { range 10.3.100.1 10.3.100.200; option routers 10.3.1.1; ddns-updates on; ddns-domainname "scottworld.net."; ddns-rev-domainname "in-addr.arpa."; } # ------------ Network (10.3.1.x) -------------------- host WAPLoft { hardware ethernet 98:9b:cb:24:e1:dd; fixed-address 10.3.1.2; } host WAPLounge { hardware ethernet 2c:3a:fd:23:b0:1d; fixed-address 10.3.1.3; } # ------------ Servers (10.3.200.x) -------------------- host mars { hardware ethernet DC:A6:32:19:ED:C1; fixed-address 10.3.200.2; } host comet { hardware ethernet 1c:c1:de:33:00:48; fixed-address 10.3.200.3; } # ------------ IOT (10.3.50.x) -------------------- host ddhomerun { hardware ethernet 00:18:DD:23:17:4F; fixed-address 10.3.50.1; } host envoy { hardware ethernet 00:1d:c0:73:eB:32; fixed-address 10.3.50.2; } host scottscreen { hardware ethernet 78:5d:c8:E3:4d:f7; fixed-address 10.3.50.3; } host Lounge-main { hardware ethernet 80:64:6f:8f:2e:be; fixed-address 10.3.50.4; } host Dining-main { hardware ethernet E8:68:E7:44:B2:EF; fixed-address 10.3.50.5; } host patio { hardware ethernet 2C:F4:32:B8:01:9D; fixed-address 10.3.50.6; } host porch { hardware ethernet 70:03:9F:6B:29:12; fixed-address 10.3.50.7; } host yamaha { hardware ethernet BC:30:D9:61:AD:CF; fixed-address 10.3.50.8; } host roku { hardware ethernet 08:05:81:2E:42:D4; fixed-address 10.3.50.9; } host Landing-main { hardware ethernet 70:03:9F:5C:59:36; fixed-address 10.3.50.10; } host amazon-c01e642c8 { hardware ethernet 3C:5C:C4:B4:32:80; fixed-address 10.3.50.12; } host amazon-5f60112a9 { hardware ethernet 1C:4D:66:32:FA:D9; fixed-address 10.3.50.13; } host Chromecast { hardware ethernet A4:77:33:B6:6F:7A; fixed-address 10.3.50.14; } host Lounge-larry { hardware ethernet D8:F1:5B:FB:31:73; fixed-address 10.3.50.15; } host Lounge-floor { hardware ethernet D8:F1:5B:FB:31:78; fixed-address 10.3.50.16; } host Dining-uplighter2 { hardware ethernet D8:F1:5B:FB:31:6C; fixed-address 10.3.50.18; } host PowerCord1 { hardware ethernet D8:F1:5B:FB:31:7C; fixed-address 10.3.50.19; } host mame { hardware ethernet d8:f1:5b:fb:31:8b; fixed-address 10.3.50.20; } host Lounge-colin { hardware ethernet d8:f1:5b:fb:31:80; fixed-address 10.3.50.21; } host Dining-uplighter1 { hardware ethernet d8:f1:5b:fb:32:21; fixed-address 10.3.50.22; } host MiniR2 { hardware ethernet 80:64:6f:8f:84:13; fixed-address 10.3.50.23; } host cyd { hardware ethernet e0:5a:1b:e3:52:68; fixed-address 10.3.50.24; } host FrontCam { hardware ethernet ec:71:db:01:b9:70; fixed-address 10.3.50.30; } host BackCam { hardware ethernet ec:71:db:25:f2:09; fixed-address 10.3.50.31; } host DoorBell { hardware ethernet 38:e7:c0:c3:61:56; fixed-address 10.3.50.32; } #host HotWaterRelay { # hardware ethernet d8:f1:5b:fb:32:1b; # fixed-address 10.3.50.33; #} host ipPhone { hardware ethernet c0:74:ad:5e:62:e4; fixed-address 10.3.50.40; } # ------------ PCs (10.3.101.x) -------------------- host mimas { hardware ethernet FC:AA:14:E2:72:21; fixed-address 10.3.101.3; } host printer { hardware ethernet 18:60:24:53:13:ED; fixed-address 10.3.101.100; } host asteroid { hardware ethernet 52:54:00:96:47:a8; fixed-address 10.3.101.2; } host saturn { hardware ethernet 74:56:3c:41:29:98; fixed-address 10.3.101.1; } Restart DHCP server and test systemctl restart isc-dhcp-server.service