There’s a lot of network configuration that can be done on Manjaro Linux. Configuring DHCP, static IP addresses, default gateway, DNS, firewall, and other network settings can all be done from either GUI or command line. In this guide, we’ll show you a few methods for configuring the networking on your own system.
In this tutorial you will learn:
- How to access network information
- How to configure DHCP or static IP address
- How to configure default gateway, DNS, and other settings
- How to check public IP address
|Category||Requirements, Conventions or Software Version Used|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Accessing Network Information
First, it’s handy to be able to see how the networking settings are currently configured on your computer. This can tell you things like your system’s IP address, which network you’re connected to, etc.
For a GUI method, the instructions will vary slightly because it depends on which desktop interface you’re running. Manjaro provides a few official GUI options and has support for many more, but the top Manjaro download comes with the XFCE desktop environment. In the screenshots below, we’ll be using XFCE, but the instructions should be quite similar whether you’re using KDE, GNOME, or some other desktop.
In XFCE, you can simply right click on the network icon in your taskbar and open “Connection Information.”
The menu that pops up will show you your local IPv4 and IPv6 address, the current network interface, subnet mask, default gateway (called “route” in this menu), primary DNS server, and maximum network speed. If you’re connected to a WiFi network, it will also list what type of security it’s using.
If you’d like to see your network information via the command line method, all you need to do is open a terminal and issue the following command. This should work on pretty much any Linux distribution.
$ ip a
The first network listed here is the loopback, but below that you can see the network our PC is currently connected to, as well as its pertinent information.
Setting DHCP or Static IP Address and Other Settings
DHCP is a protocol that Manjaro (or any network device) can use to retrieve an assigned IP address from your router. Basically, this means the router hands out an IP address for your computer to use. This is configured by default on most any system, and is also the default behavior of Manjaro. Using DHCP also means that your IP is likely to change every once in a while.
There are times when you may want to keep a permanent IP address, like if your computer is accessed from other devices on the network via IP address. Obviously, having a static, non-changing IP address would make things more convenient in a scenario like that. To switch between DHCP and a static IP address via GUI (specifically XFCE in this example), follow these steps:
- To get started, simply search for “network” inside your application launcher to find the app that controls your networking settings.
- In the Network Connections menu, you can add or delete connections by using the plus and minus icons. This is mostly applicable if you have multiple network interfaces on your PC. What’s more likely is that you’ll want to configure your current connection, which you can do by highlighting it and clicking on the cogwheel icon.
- In the connection editing menu, click on the IPv4 or IPv6 settings tab, depending on which type of static IP you would like to configure.
- Under “Method,” you can either choose “Automatic” for DHCP or “Manual” for a static IP. If you’re configuring DHCP, you can just make the selection and close out of this menu. If you want a static IP, make your selection and click the “Add” button to fill out the static IP address, subnet mask, default gateway, and DNS servers you plan to use.
- When you’re done, click Save for the changes to take effect and close this menu.
You can also switch between DHCP and a static IP address via the command line by opening a terminal and following the steps below.
- To configure a static IP address, first we need to temporarily disable the
$ sudo systemctl disable --now NetworkManager.service
- Next, create a new file under systemd’s network directory. This file must contain the name of the network interface you’re configuring. That can be obtained with the
ip acommand as explained earlier. In our case, the network name is
enp0s3, so we will create the following file:
$ sudo nano /etc/systemd/network/enp0s3.network
- In this file, we’ll need to paste the code below. Of course, you can configure these values however you need.
[Match] Name=enp0s3 [Network] Address=192.168.1.10/24 Gateway=192.168.1.1 DNS=184.108.40.206 DNS=220.127.116.11
- Save your changes and exit the file. Then start the
NetworkManagerup again for the changes to take effect:
$ sudo systemctl enable --now systemd-networkd.service
- If you need to revert back to DHCP, all you need to do is delete the file we created earlier (or rename it to something that doesn’t contain the interface name), and then restart the
$ sudo mv /etc/systemd/network/enp0s3.network /etc/systemd/network/oldconfig $ sudo systemctl restart NetworkManager.service
Check Public IP Address
If you’re reading this guide and trying to configure your network settings, you may also want to know how to check your public IP address, which is going to be different from the local IP address that we configured earlier (unless you have a publicly facing network interface, which is only likely on a server).
# echo $(wget -qO - https://api.ipify.org) OR # echo $(curl -s https://api.ipify.org)
All of the network settings on Manjaro are configured from the same area, so you can quickly setup DHCP, static IP, default gateway, DNS, etc. In this guide, we learned how to configure the network settings via GUI and command line. We also saw how to ascertain current network information, as well as our system’s public IP address.