How to set up default gateway on Manjaro Linux

In Linux-based systems such as Manjaro, the default gateway is a node that permits a host device to communicate with a destination system outside of its own network. The keyword default is added with the gateway because it will be the first and default route taken unless another route is requested.

Default gateway ensures that requests are transmitted to the correct destination, even if the receiver and sender devices or systems use different network protocols. The default gateway is also used for getting access to the web pages, where the request is routed through the gateway before transmitting it on the Internet. This write-up will show you how to set up the default gateway on Manjaro Linux using its terminal and GUI.

How to set up default gateway on Manjaro Linux using terminal

In Manjaro Linux, there are various methods for checking the gateway address and the “ip route” command is one of them. The “ip route” command is utilized to modify or display the IP routing table. It permits you to add, set up, delete the specific static routes for the networks or host.

Now, open up your Manjaro terminal by pressing “CTRL+ALT+T” and execute the “ip” route command to know about your gateway address along with other essential information:

$ ip route

From the output, you can see that our default gateway address is “192.168.43.1”:

Before setting up the default gateway, you have to disable the “NetworkManager” service temporarily:

$ sudo systemctl disable --now NetworkManager.service

Now, we will create a configuration file for our network interface. The name of the network interface which you are going to configure must be included in its filename. For instance, the “enp0s3” is our network interface name, so we will create a file named “enp0s3.network” in the “systemd” directory of our Manjaro system:

$ sudo nano /etc/systemd/network/enp0s3.network

In the opened file, define the Name, Address, and DNS of the network interface. Here, we will set up “192.168.43.4” as the default gateway of our “enp0s3” interface:

[Match]
Name=enp0s3

[Network]
Address=192.168.43.10/24
Gateway=192.168.43.4
DNS=8.8.8.8
DNS=8.8.4.4

After setting up the default gateway address into the “enp0s3.network” file, press “CTRL+O” to save the “enp0s3.network” file content:

Now, restart the “NetworkManager” service so that it can take effect from the specified changes:

$ sudo systemctl enable --now systemd-networkd.service

If you have carefully performed the previously given steps, your default gateway will be changed at this point. To confirm this, again execute the “ip route” command:

$ ip route

The below-given output signifies that, on our Manjaro system, the “192.168.43.4” is successfully added as the default gateway address of the “enp0s3” network interface:

How to set up default gateway on Manjaro Linux using GUI

Manjaro Linux also provides the facility to set up the default gateway of any network device through the Graphical User Interface. If you do not want to utilize the command-line method, then go for the GUI method provided in this section.

First of all, look for the “Advance Network Configuration” programs in your Manjaro system applications:

Now, select the network interface for which you will set up the default gateway and then click on the “gear” icon to open its settings:

Move to the “IPv4 Settings” tab, and you will see that the “Method” of IPv4 Settings is set to the “Automatic(DHCP)”:

The next step is to change the IPv4 Settings “Automatic(DHCP)” method to “Manual”:

After doing so, click on the “Add” button, located at the right side of the opened window:

Pressing the “Add” button will permit you to set up the Address, Netmask, DNS, and more specifically, the “Gateway” of the selected network connection:

Here, we are setting “192.168.43.1” as the default gateway for our Wired connection:

After adding the data mentioned above, click on the “Save” button, and you are all done!

Now, hit the network icon present at the taskbar of your Manjaro system, and from its context menu, click on the “Connection Information”:

You can see in the below-given image that we have successfully set up the default gateway of our network connection to “192.168.43.1” on Manjaro Linux:

Conclusion

A default gateway is a node in an internet protocol suite-based network that acts as a router for other networks when the route specification does not match with the destination IP address. The default gateway in a small office or home is a device that links the local network to the Internet, such as a cable or DSL router. This write-up demonstrated to you the procedure of setting up the default gateway on Manjaro Linux using its terminal and GUI. Utilize any of the provided methods to add a specific IP address as the default gateway for a network interface.



from https://ift.tt/3D3vnAe

Post a Comment

0 Comments