How To Set Default Gateway in Pop!_OS

A gateway is essential for gaining access to the internet. An administrator can either automatically or manually configure it to access the devices on a network. Data packets must communicate with one another to be routed as they cross a network.

You can use the default gateway for traffic that is not intended for the local network. However, setting up the default gateway can be challenging for a beginner. So, in this tutorial, we will provide the complete information to set the default gateway on Pop!_OS as it is a Ubuntu-based distro.

How To Set Default Gateway in Pop!_OS

You may occasionally acquire a computer previously connected to a different network and change the gateway settings, or you may need to direct a specific machine to an additional gateway. You may have a network with several sub-networks and a gateway that serves as an intermediary.

The ip command, ip route list, or ip r, is the go-to tool for managing routes in Pop!_OS. Extremely outdated controls include ifconfig. You can check the default gateway settings and add or remove the standard gateways through the ip command.

Use the ip command and the route object to view the routes configured on a Pop!_OS computer. The list is the default action, so you can omit it even though you can add it. Even more, keystrokes can be saved using “r” for the term “route”.

ip route list


ip r

The term “default” will appear on one of the routes. The default gateway is reached via that route.

How To Remove the Default Gateway

You can remove the default gateway of the route that directs traffic. You can use the route object and delete option with the ip command. You also need to use the sudo to make changes to the routing table:

sudo ip route delete default
ip r

Once you type these commands into the Pop!_OS terminal, it will prompt you to type in the password. You have to enter your password and press enter. This will remove your default gateway.

How To Add a Default Gateway in Pop!_OS

You can add a default gateway using the add option and the route object. Here is the basic syntax you can use:

sudo ip route add default via <router> <network connection>

For example, we have a router at, so we can add a “default” route and send that traffic over the network connection “enp0s3”:

sudo ip route add default via dev enp0s3
ip r

Creating Consistent Routing Changes

The modifications we’ve made take immediate effect, but they may vanish after the reboot. You must alter a few configuration files to make your modifications permanent. The netplan tool and configuration file are available inPop!_OS.

sudo gedit /etc/netplan/01-network-manager-all.yaml

To the configuration file, insert the paragraph beginning with “ethernets”. Keep in mind that white space is crucial. A hyphen (“-“) must appear in the “- to:” line, and each subsequent level of indentation must be two spaces. This will establish a default route to the router. Substitute your network’s IP address here.

Save the document, then quit your editor. After that, use the netplan command with the apply option to put the changes into effect.

sudo netplan apply

Once the system takes up the edits, the command line will silently return to the main terminal. Now, use the netplan query with the try command to see the modifications before you apply them:

sudo netplan try

You can then test your changes throughout this time. To save the modifications, press the “Enter” key. Within two minutes, the process will time out, and your adjustments won’t be saved if you don’t press the “Enter” key. They are still in the configuration file, but you need to modify your network settings.


This article discussed the simple approaches you can try to set the default gateway on Pop!_OS. We have explained removing or adding the router or network gateway using the ip command. Furthermore, we recommend you use the router details correctly, or else you may get errors.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.