- Automating DHCP Server configuration with Bash
- Client Configuration is not mentioned here as it has to be done manually
- As of now you have to manually install the DHCP package with
sudo apt install isc-dhcp-server
-
You can directly use the code or clone the repo
bash AutoDHCPilot.sh
-
It will ask for details to that to be filled out by user and configuration will be automated
- Provide Domain Name
- Provide Subnet (eg. 192.168.80.0)
- Provide Option Routers (eg. 192.168.80.1)
- Provide IP Pool with Starting and Ending IP address
- Provide Domain Name
-
At the end it will show which IP has been assigned yet.
- First check the network interface of client machine (eg. ens33, eth0)
- Open the Interfaces file
sudo nano /etc/network/interfaces
And enter the following details
auto <interface-name> iface <interface-name>inet dhcp
- Once done restart the network or reboot the system
systemctl restart networking
dhclient -4