Site icon TechNewsBoy.com

How to configure a DHCP server on Rocky Linux

Jack Wallen shows you how to configure Rocky Linux 9 as a DHCP server for your local area network.

Image: Gorodenkoff/Adobe Stock

Rocky Linux has become one of the de facto standard replacements for CentOS. Not only is it a drop-in replacement for RHEL, but the maintainer Gregory Kurtzer has made it clear Rocky Linux will always be available and will never be owned by a company that could bring down the distribution.

And for anyone who’s used RHEL or CentOS, Rocky Linux will be instantly familiar and can serve you and your company with ease.

SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)

Let’s take a look at one way Rocky Linux can serve you as a DHCP server. I’m going to walk you through the process of installing and configuring the DHCP server on this open source operating system. It shouldn’t take you but a few minutes to get this up and running.

What you’ll need to deploy the DHCP server

The only things you’ll need to are a running instance of Rocky Linux and a user with sudo privileges. Ready? Let’s get to work.

How to install the DHCP server software

Rocky Linux doesn’t ship with the DHCP server installed, so we’ll take care of that now. Log in to your Rocky Linux instance, open a terminal window and issue the command:

sudo dnf install dhcp-server -y

Once that’s installed, you can now move on to the configuration.

How to configure the DHCP server on Rocky Linux

Before we start to configure the DHCP server, you’ll need to know the name of the interface you’ll be using. To discover that name, issue the command:

ip a

You should at least see two listings, one for the loopback — which will use the address 127.0.0.1 — and the other for your LAN-facing network device. For example, mine is enp0s3.

Next, open the DHCP server configuration file with the command:

sudo nano /etc/dhcp/dhcpd.conf

The section you need to concentrate on will look like this:

default-lease-time 900;
max-lease-time 10800;

authoritative;

subnet 192.168.200.0 netmask 255.255.255.0 {
range 192.168.200.50 192.168.200.99;
option routers 192.168.20.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.20.1;
}

You’ll want to make sure to configure this section according to your network topology. After configuring this section, save and close the file.

How to open the firewall

We now have to open the firewall for the DHCP server. First, add the rule for the firewall with:

sudo firewall-cmd --add-port=67/udp --permanent

Now, reload the firewall to apply the new rule with:

sudo firewall-cmd --reload

How to start and enable the DHCP service

With everything taken care of, you can now start and enable the service with a single command:

sudo systemctl enable --now

At this point, your Rocky Linux server is capable of serving up DHCP addresses. One thing to keep in mind, however, is that you want to make sure the configuration of this DHCP server doesn’t conflict with any other device that hands out network addresses. Such a conflict would cause problems on your LAN, so either disable any other device that would do so or configure the IP address range for the Rocky Linux DHCP server beyond that of any other device handing out addresses.

And that’s all there is to it. You now have a DHCP server up and running, served up by a powerhouse OS. Enjoy those IP addresses.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

For all the latest Technology News Click Here 

 For the latest news and updates, follow us on Google News

Read original article here

Denial of responsibility! TechNewsBoy.com is an automatic aggregator around the global media. All the content are available free on Internet. We have just arranged it in one platform for educational purpose only. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials on our website, please contact us by email – abuse@technewsboy.com. The content will be deleted within 24 hours.
Exit mobile version