How to Enable Networking in Arch Linux (Guide)

Setting up a network connection is a vital part of configuring an effective system. This is a post installation network connection guide.

This video will show you how to change your host name and enable the DHCP client.

Introduction

Arch Linux will, in most cases, automatically configure a network connection for the Live Installation Image. However, once the operating system has been installed on the system, networking has to be manually enabled. This guide will show you exactly how to do that.

Enabling Networking

Changing the Hostname

The first thing we are going to do is change the system’s hostname, which is “archlinux” by default. To do that, alter the following files like so, replacing “sudoadmins” with whatever hostname you’d like to have.

echo "sudoadmins" >> /etc/hostname
echo "sudoadmins" >> /etc/hosts

Now you can safely restart the system and you’ll see your new hostname in the prompt.

Enabling the DHCP Client

The next step is to start and enable your network interface to work for the DHCP client. To do that, first determine the name of your network device.

ip link

Ignoring loop devices, there will be one other device entry, typically. If there is more than one then feel free to configure whichever one you like or both.

As you can see from the screenshot, I’ve determined that enp0s3 is the device that I need to enable. So, next I use systemctl to enable and start the service.

systemctl enable dhcpcd@enp0s3.service
systemctl start dhcpcd@enp0s3.service

Enable configures the service so that it will start automatically on boot and start simply starts the service immediately. As you can see in the screenshot, I use systemctl status in order to check the service before starting and enabling it. I do this to confirm that my problem is indeed that the service is not running or enabled, rather than something else. Keep this in mind as a possible diagnostic measure to take in case you have connection problems in the future.

Make Sure it Works

Lastly, I use the ping command in order to check if I now have a working connection. I cross check my connection with Google and receive no errors.

Conclusion

Congratulations! If you have followed this guide successfully then you have established a working connection and may now update and install packages with pacman.