Manjaro Linux

How do I use DHCP on Manjaro

Two methods exist for assigning the IP address to host devices in computer networking. Manual configuration and assignment of the IP address is the first option. In Manual or Static network configuration, the host’s IP address does not change until a system administrator or a user configures it manually. However, when an organization network has more than 2000 hosts, assigning a static IP address to each of them becomes tedious and inefficient. In such a case, you can use the Dynamic Host Configuration Protocol or DHCP to ensure that correct IP addresses are assigned to the network hosts, regardless of their network size. In the same network, the IP addresses of the hosts will not conflict with each other if you go for the option to use DHCP on your Manjaro system. It also maintains track of all assigned IP addresses and then compares them to the MAC addresses of the hosts.

On your Manjaro system, if you want to use DHCP as an IP address assignment method, we have got you covered. This guide will demonstrate setting up DHCP on Manjaro using the terminal and GUI. So, let’s start!

How to access network information on Manjaro

On your Manjaro system, you can utilize the terminal for accessing the information related to the network interfaces, such as their name, IP address, IPv4 method, and connection status. For this purpose, open up your Manjaro terminal by pressing “CTRL+ALT+T” and execute the “ip” command with the “a” option:

$ ip a

The “ip” command is the networking tool you can use to configure network variables or assign IP addresses to a network. In our case, we have executed the “ip” command to check out the IP address of our “enp0s3” network interface:

From the above-given output, you can see that the IP address for the “enp0s3” interface is “192.168.0.104”. You can also view the details of the configured network connection through the Manjaro GUI. To do so, right-click on the “Network icon,” which is present at your system panel:

Now, from the opened pop-up menu, select the connection information option:

After doing so, view your connection information and note down its IPv4 address:

How to set up DHCP on Manjaro using terminal

On Arch Linux systems such as Manjaro, “netctl” is a command-line-based utility used to manage and configure the network connection through their profiles. This section will teach you how to set up DHCP using the netctl command in your Manjaro terminal. So, if you do not have “netctl” then execute the following command:

$ sudo pacman -S netctl

From the “/etc/netctl/examples” directory, we will copy the profile of “ethernet-dhcp” to the “/etc/netctl/enp0s3” directory with the help of “cp” command:

$ sudo cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/enp0s3

Now, edit the “/etc/netctl/enp0s3” file in your nano editor:

$ sudo nano /etc/netctl/enp0s3

The “/etc/netctl/enp0s3” file with the default settings will somehow look like this:

Next, change the interface name from “eth0” to “enp0s3”:

Interface=enp0s3

After doing so, press “CTRL+O” to save the added changes in the “/etc/netctl/enp0s3” file:

Till this point, we have configured the method of “enp0s3” as DHCP. Now, utilize the provided commands for enabling and starting the “dhcpd” service:

$ sudo systemctl enable dhcpcd

$ sudo systemctl start dhcpcd

Now the Dynamic IP address will be assigned automatically. Again, click on the “Network Icon” and open up the “Connection Information”:

You can see that the IP address of our network connection is dynamically changed to “192.168.0.105”:

How to set up DHCP on Manjaro using GUI

Manjaro also offers its user the option to set up and use the DHCP using its GUI. If you want to avail this facility, then open up the “Advanced Network Configuration” utility from the system applications:

In the opened network connection menu, select the network interface for which you want to use the DHCP and then click on the “Gear” icon, which is present at the bottom-left of the window:

Now, look for the “Method” option under the “IPv4 Settings” tab:

Open up the drop-down menu of “Method” and select the “Automatic DHCP,” and click on the “Save” button:

The specified action will configure the DHCP as IPv4 method of our Wired connection:

Conclusion

Dynamic Host Configuration Protocol or DHCP permits a server to assign an IP address and configure other information such as their default gateway and subnet mask to a host in a network. On the Manjaro system, the use of DHCP eliminated the need for a system administrator to manually configure the IP addresses for the systems joining the network so that the IP addresses do not clash. This guide teaches how to set up DHCP on Manjaro using the terminal and the GUI. Try it out on your Manjaro system and be free from the manual IP address assignment.

About the author

Sharqa Hameed

I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.