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
Connection Information menu on Manjaro Linux
Connection Information menu on Manjaro Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Manjaro Linux
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - 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.


SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


In XFCE, you can simply right click on the network icon in your taskbar and open "Connection Information."

Click the network icon and then Connection Information
Click the network icon and then 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.

Menu showing all the configured network settings for the current interface
Menu showing all the configured network settings for the current interface

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
Viewing network information via command line
Viewing network information via command line

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:

  1. To get started, simply search for "network" inside your application launcher to find the app that controls your networking settings.

    Search for and open the network settings application
    Search for and open the network settings application
  2. 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.

    Configure the current connection or add a new one
    Configure the current connection or add a new one
  3. 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.

    Either configure the IPv4 or IPv6 settings or both
    Either configure the IPv4 or IPv6 settings or both
  4. 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.

    Configure automatic DHCP or manual static IP
    Configure automatic DHCP or manual static IP
  5. When you're done, click Save for the changes to take effect and close this menu.

    Add the static IP address information and click Save
    Add the static IP address information and click Save

You can also switch between DHCP and a static IP address via the command line by opening a terminal and following the steps below.

  1. To configure a static IP address, first we need to temporarily disable the NetworkManager service:
    $ sudo systemctl disable --now NetworkManager.service
    


  2. 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 a command 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
    
  3. 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=8.8.8.8
    DNS=8.8.4.4
  4. Save your changes and exit the file. Then start the NetworkManager up again for the changes to take effect:
    $ sudo systemctl enable --now systemd-networkd.service
    
  5. 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 NetworkManager service.
    $ 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).

To see your public IP address, use wget or curl to execute one of the following commands in terminal:

# echo $(wget -qO - https://api.ipify.org)
OR
# echo $(curl -s https://api.ipify.org)

Conclusion

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.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions