If you're running Manjaro Linux and need to setup a static IP address, this is the guide for you. In this tutorial, we'll be showing you how to configure a static IP address on your system, both from a GUI and command line interface.In this tutorial you will learn:
- How to setup a static IP via GUI (XFCE)
- How to setup a static IP via command line
|Category||Requirements, Conventions or Software Version Used|
|Other||Privileged access to your Linux system as root or via the |
|Conventions|| # - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
Static IP using a GUI tool
The Manjaro download page lists quite a few GUI options, and the distro supports many more. Depending on which GUI you're using (XFCE, KDE, GNOME, etc), the instructions for setting a static IP via GUI are going to vary a little. Since Manjaro's first recommendation is XFCE, we'll cover the instructions for setting up a static IP in XFCE on Manjaro. The instructions for other desktop environments should be similar.
- First, right click on the network icon in the right side of the taskbar.
- Then, click on 'Edit Connections'.
- In the menu that opens up, you may see just one connection or multiple if your system has more than one network interface. On the interface you'd like to configure a static IP address for, left click to highlight it and then click the cogwheel to edit.
- A new menu will open up with a few different tabs to choose from. Click on either the 'IPv4 Settings' tab or 'IPv6 Settings' tab, depending on the type of static IP address you'd like to configure.
- By default, Manjaro will be configured to obtain an IP address through DHCP. We'll need to change this option by selecting 'Manual' under the 'Method' configuration.
- Now click on 'Add' to add a new static IP address to the interface. This will allow you to type a static IP, subnet mask, and default gateway.
- Once you're happy with the changes, just click 'Save' and close the network interfaces menu. For the changes to take effect, you may need to disconnect from your current network and reconnect. Left click on the network icon in the taskbar and click disconnect.
- Finally, to use your newly configured static IP address, reconnect to the network by enabling your network interface once again. Left click the network icon and select the name of your network interface.
That's all there is to it. If you'd like to verify the changes you've made, you can right click on the network icon in your taskbar and select 'Connection information'.
Static IP using command line
If you don't shy away from cracking open a terminal, setting up a static IP from the command line is even more of a breeze and can be done in just a few steps.
- First, open a terminal and type the following command to see how your network interface is currently configured. As you can see in the screenshot below, the name of our network interface is
enp0s3. We'll need to know that for the next step, and yours may be different, so be sure to get the right name for yours.
$ ip a
- Since we're configuring a static IP, we need to temporarily disable Manjaro's
NetworkManagerservice in systemd so the changes will take effect when we're done. Type this command:
$ sudo systemctl disable --now NetworkManager.service
- Now, we need to create a new file (as root) that contains our network configuration for the
enp0s3interface. Again, the name of your network interface may be different, so be sure to check. You can use
nanoor whichever text editor you prefer to create the following file (just be sure to put the correct interface name in your file name):
$ sudo nano /etc/systemd/network/enp0s3.network
- Paste the following template into your text file, making changes as needed. This particular example will configure the interface to use IP address
192.168.1.10with subnet mask
/24in slash notation), and default gateway
192.168.1.1. We've also configured it to use Google's DNS servers. You can just remove these values and put your own.
[Match] Name=enp0s3 [Network] Address=192.168.1.10/24 Gateway=192.168.1.1 DNS=188.8.131.52 DNS=184.108.40.206
- Exit the file and be sure to save your changes when doing so. In order for these new changes to take effect, just start the
NetworkManagerservice back up with this command:
$ sudo systemctl enable --now systemd-networkd.service
If you receive an error when restarting the network service, be sure to check your configuration file for typos. Otherwise, the static IP address should now be configured. You can check by typing the following command:
$ ip a
In this guide, we saw how to setup a static IP address in Manjaro Linux. The process is pretty painless whether you choose to do it from a GUI or the command line interface. We used the XFCE desktop environment in our screenshots, but you should find the process very similar even if you're using GNOME, KDE, or some other desktop interface on your Manjaro installation.