Deploying DHCP Server
Setup Details |
Platform: Ubuntu 20.04 LTS Software used: isc-dhcp-server, webmin Domain: corp.zeta.tech Realm: CORP DHCP - Sample for Hyderabad Office DHCP Server Locations -Bengaluru: - Diamond District: Microsoft DHCP - 172.16.64.51 - 172.16.64.52 - AMR Tech Park: isc-dhcp-server - 172.25.20.27 - Harman Office: -Mumbai: - Plex: Microsoft DHCP - 172.16.64.51 - 172.16.64.52 -Hyderabad: - My Home Twitza: isc-dhcp-server - 172.25.65.22 - 172.25.65.23 ------------------------- User Details admin user: itadmin Pwd: qwedsa@123 |
Pre-requisites
All Zeta offices will use isc-dhcp server for providing IP Addresses to the hosts connecting to LAN or wifi networks. At some places, DHCP servers are stand-alone while at some locations, dhcp services are running along with dns services on the same server
- Ubuntu server 20.04 LTS, fully patched
- User account with sudo access
- Internet Access
Setup DHCP Server
There are two steps to setup DHCP server.
- Install DHCP Server and edit the configuration file to suit zeta infrastructure
- Bind interfaces that will listen to dhcp requests from hosts
Install isc-dhcp-server
- For installing isc-dhcp: ssh into the dhcp server using the credentials and run the following commands
$ sudo apt update && sudo apt upgrade -y $ sudo apt install isc-dhcp-server
- Check if the service has started.
$ sudo systemctl status isc-dhcp-server.service
- If it has not, then restart the service and check the status. If it still shows as inactive, try re-starting the server, else re-install the isc-dhcp server
$ sudo systemctl restart isc-dhcp-server.service
- After installing the isc-dhcp server, there is two main configuration files that need to be modified
- /etc/dhcp/dhcpd.conf
- /etc/default/isc-dhcp-server
- Make changes to /etc/dhcp/dhcpd.conf. Make a copy of the original file by renaming the original file as something else as a backup in case there are any issues with the configurations
$ sudo cp -prav /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf_ORG
- Open /etc/dhcp/dhcpd.conf in an editor and make following changes
# option definitions common to all supported networks... option domain-name "corp.zeta.tech"; option domain-name-servers 172.25.65.22; default-lease-time 600; max-lease-time 7200; #ddns update ddns-update-style none; #Make this server authoritative authoritative; ## For User LAN ## subnet 172.25.66.0 netmask 255.255.254.0 { range dynamic-bootp 172.25.66.21 172.25.67.254; option domain-name-servers 172.25.65.20; option domain-search "corp.zeta.tech"; option subnet-mask 255.255.254.0; option routers 172.25.66.1; option broadcast-address 172.25.67.255; default-lease-time 600; max-lease-time 7200; #printer static ipaddress host hyd-printer { hardware ethernet c0:18:03:9b:c4:40; fixed-address 172.25.66.11; } host spectra-ctlr { hardware ethernet bc:c6:1a:01:24:97; fixed-address 172.25.66.14; } host cardreader { hardware ethernet 00:be:43:93:a1:de; fixed-address 172.25.66.10; } } ## FOR WIFI ## subnet 172.25.68.0 netmask 255.255.252.0 { range 172.25.68.21 172.25.71.254; option domain-name-servers 172.25.65.20; option domain-search "corp.zeta.tech"; option subnet-mask 255.255.252.0; option routers 172.25.68.1; option broadcast-address 172.25.71.255; default-lease-time 600; max-lease-time 7200; } ## Server Network ## subnet 172.25.65.0 netmask 255.255.255.0 { }
- Save the file and exit the editor
Bind DHCP interface
For DHCP server to release IP addresses, the server needs to know on which interface it has to listen for dhcp requests. Bind the interface by modifying the file /etc/default/isc-dhcp-server file. Open the file in the editor and make the below change
# Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACESv4="eth0"
In our case we have only one interface on which multiple requests are made.
- Save the file and restart the isc-dhcp server
$ sudo systemctl restart isc-dhcp-server
DHCP server is now installed and configured.
Webmin Installation
Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely. Latest webmin will be installed by using the webmin repositories
Adding repository
Make a copy of the original sources.list file and then add the webmin repository -
$ sudo cp -prav /etc/apt/sources.list /etc/apt/sources.list_ORG
Add the webmin repository by opening /etc/apt/sources.list file in an editor and adding the below line at the end of the file
deb http://download.webmin.com/download/repository sarge contrib
Update and add the signing key
$ sudo apt update $ sudo wget -q -O- http://www.webmin.com/jcameron-key.asc | sudo apt-key add
Install webmin
$ sudo apt install webmin
Start using Webmin
- By default webmin gets installed listening to port 10000
- Open a browser and browse https://<ip-address>:10000
Webmin is now installed
DHCP Servers in other locations
- There is no difference in the configuration files of the DHCP servers in other locations except for IP address changes.
- Whenever a new DHCP server needs to set up,
- copy /etc/dhcp/dhcpd.conf file to the new server,
- bind the dhcp interface by modifying /etc/default/isc-dhcp-server file
- make relevant IP address changes
- The DHCP server in the new location will be ready