I am planning to upgrade the network infrastructure, and want to make the process as painless
as possible. First, I start by changing all the servers to get their network infrastructure from Machine A,
the "DHCP Server". Instead of having cryptic names like Machine A or Machine B, I am assigning functional names
to the machines. The IP addresses of the machines remain unchanged.
Old Hostname | New Hostname | Purpose |
---|---|---|
Machine A | router.dundermifflin.com | Main Router |
Machine B | dns0.dundermifflin.com | Primary DNS and NTP |
Machine C | web0.dundermifflin.com | Primary Web Server |
Machine D | web1.dundermifflin.com | Secondary Web Server |
Machine E | nfs.dundermifflin.com | File Server |
Machine F | dns1.dundermifflin.com | Secondary DNS |
All machines (Machines B-F) would take DNS Servers, NTP, IP address, gateway, hostname from the DHCP server AKA Machine A. This would make it easier for me in the future when I will configure DNS and NTP servers, I just have to change the config on Machine A and all other machines would honor the change.
Install ISC DHCP on Machine A.
Next, I changed the hostname for Machine A manually, by editing the /etc/hostname file.
Now, let's configure the DHCP server.
Before I start configuring, there are a few things to note. There are some configs which should be common
between all the machines aka "global" and some that are specific to the machine. For example, all machines
should have the same DNS, NTP servers and lease time. However, the gateway is different for DMZ and
LAN machines. Keeping this in mind, let's move on to the configuration.
I'm setting the DHCP lease time to be 10 minutes, which means, all the DHCP Clients would
update configuration from DHCP server every 10 minutes.
For now, I am setting 128.138.240.1, 128.138.130.30 as the DNS servers. I will change this to Machine B
and Machine F once I configure B & F as DNS servers.
I'm also setting NTP servers to be 132.163.97.1, 132.163.96.1 for now. I will change this to Machine A once
I configure Machine A as an NTP server.
/etc/dhcp/dhcpd.conf:
Let's get those LAN and DMZ subnets up and running! Currently, I'm configuring 100 usable IP addresses for each subnet, but we can always expand as the organization grows. Additionally, I am designating Machine A as the default gateway since it serves as the router for traffic between these machines. Specifically, the LAN subnet is linked to Machine A with the IP address 10.21.32.1, while the DMZ subnet is connected to Machine A using the IP address 100.64.26.1.
I'm now setting the DHCP server to first send an ICMP echo request to the IP address it is currently trying to dynamically allocate and wait 100 ms for a reply. This is just an added safety mechanism I'm implementing so that the DHCP server does not allocate an IP address that is currently in use. If a response is heard, the server must not respond and the lease time mustbe abandoned for another 10 minutes.
Now, let's configure Machines B-F to obtain their network configuration and hostname from Machine A using DHCP.
Debian Clients:
1. Use the "systemctl status networking" service to manage interfaces: This command allows you to check the status of the networking service on Debian systems. It's essential for managing network interfaces and their configurations.
2. Update the "/etc/network/interfaces" file to use DHCP configuration: The "/etc/network/interfaces" file contains network interface configurations on Debian systems. By changing the configuration from static to DHCP, the interface will now obtain its network settings dynamically from the DHCP server.
From:
To:
Redhat Clients:
1. Use "systemctl status NetworkManager" to manage interfaces: Similar to Debian, this command checks the status of the NetworkManager service on Redhat systems. NetworkManager is a daemon that manages network connections and devices.
2. Update the "/etc/NetworkManager/system-connections/ens192.nmconnection" file to use automatic configuration: This file contains configuration settings for the specified network connection. By changing the method to "auto," the interface will automatically obtain its network settings via DHCP.
From:
To:
1. Remove the "/etc/hostname" file to ensure dynamically assigned hostnames are used: This file typically contains the static hostname of the system. By removing it, the system will use the hostname assigned by the DHCP server.
2. Comment out the line in "/etc/dhcp/dhclient.conf" that sets the host-name: This line instructs the DHCP client to send its current hostname to the DHCP server. By commenting it out, the client will not send its hostname, allowing the DHCP server to assign one dynamically.
Comment out the line in "/etc/chrony/chrony.conf" to pick up NTP servers from DHCP:
The "2.pool.ntp.org" line typically specifies a default NTP server. By commenting it out, the client will use the NTP servers provided by the DHCP server instead.
The "/etc/resolv.conf" file contains DNS resolver configuration. NetworkManager automatically updates this file with DNS server information obtained from DHCP, ensuring that the client uses the correct DNS servers specified by the DHCP server.
In the realm of network infrastructure, simplicity reigns supreme. By setting up an ISC DHCP server on Machine A and configuring clients accordingly, we've taken a significant step towards efficient network management.
With DHCP, the process of assigning IP addresses, DNS servers, and other network parameters becomes a breeze. By automating these tasks, we free up valuable time and resources for other endeavors.
Let's appreciate the beauty of automation. Here's to networks that run smoothly and effortlessly, allowing us to focus on what truly matters! Cheers.