When your device within the local network seeks to communicate with external destinations, all data traffic passes through this gateway. Hence, setting up the default gateway for your system ensures that your computer can communicate to the internet and other devices properly. In this guide, we will briefly explain the methods to set the default gateway on Fedora Linux.
How to Setup the Default Gateway on Fedora Linux
You can follow two different commands that you can use to setup the default gateway without getting any error.
The Ip Command
Run the following command to check your current network configuration:
Let’s use the network interface “lo” with the specified gateway IP. Now, set the default gateway by running the following command:
For example, the network interface is “lo” and the gateway IP is “127.0.0.1.
Finally, verify the new default gateway configuration by executing the following command:
The Nmcli Command
First, list your network connections to identify the name of the network interface for the configuration.
Now, check the name of the connection and run the following command to set the default gateway on it:
Replace CONNECTION_NAME with the name of your network connection and GATEWAY_IP with the IP address of your desired gateway.
Once you are done, finalize the changes by running the following command:
Verify that the default gateway has been set correctly using the following command:
Configuring a default gateway on your Fedora Linux system is fundamental in ensuring that your network connectivity functions smoothly. You can set the default gateway on Fedora Linux through the given commands. Moreover, we recommend using the methods correctly. Otherwise, you may make your system vulnerable to third-party attacks.