Created
April 6, 2020 15:18
-
-
Save jimeUWOshkosh/b867ea36cac5cbbbe55b3deb49f98ca1 to your computer and use it in GitHub Desktop.
RPI intranet DHCP Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raspbian:DHCP on a inTRAnet | |
3-apr-2020 | |
$ cat /etc/os-release | |
... | |
VERSION="10 (buster)" | |
... | |
Used http://www.noveldevices.co.uk/rp-dhcp-server | |
as my starting point. | |
step1: Download any package updates and then write the changes to the local package cache | |
$ sudo apt-get update | |
Step 2: Install software | |
$ sudo apt-get install isc-dhcp-server | |
... | |
[FAIL] Starting ISC DHCP server: dhcpd[....] check syslog for diagnostics. ... failed! | |
invoke-rc.d: initscript isc-dhcp-server, action "start" failed. | |
Step 3: The DHCP server requires a static IP address and, by default, the Pi will have a DHCP one | |
Note1: /etc/network/interfaces refers you to /etc/dhcpcd.conf | |
Note2: The IP addr of this RPI is 192.168.0.40 | |
At the bottom of the file | |
$ sudo vi /etc/dhcpcd.conf | |
interface eth0 | |
static ip_address=192.168.0.40/24 | |
static routers=192.168.0.40 | |
static domain_name_servers=192.168.0.40 | |
Step 4: Edit the DHCP configuration file | |
Note3: Choose the range of addresses in your sub-net | |
At the bottom of the file | |
$ sudo vi /etc/dhcp/dhcpd.conf | |
subnet 192.168.0.0 netmask 255.255.255.0 { | |
range 192.168.0.239 192.168.0.240; | |
option routers 192.168.0.40; | |
} | |
Step 5: Set up the DHCP "defaults" file | |
Make the bottom of the file look like this | |
$ sudo vi /etc/default/isc-dhcp-server | |
#INTERFACESv4="" | |
#INTERFACESv6="" | |
DHCPDv4_CONF=/etc/dhcp/dhcpd.conf | |
DHCPDv4_PID=/var/run/dhcpd.pid | |
INTERFACESv4="eth0" | |
Step 6: Restart the DHCP daemon process using the service command: | |
$ sudo service isc-dhcp-server restart | |
USEFUL INFORMATION | |
The DHCP server keeps its current set of leases in a text file in /var/lib/dhcp/dhcpd.leases. | |
Online documentation for the DHCP server can be viewed on the Pi using man dhcpd. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment