{"id":2675,"date":"2024-11-26T17:51:36","date_gmt":"2024-11-26T22:51:36","guid":{"rendered":"http:\/\/sudlatnid.com\/?p=2675"},"modified":"2024-11-26T17:51:36","modified_gmt":"2024-11-26T22:51:36","slug":"how-to-set-the-default-gateway-in-linux","status":"publish","type":"post","link":"https:\/\/www.sudlatnid.com\/?p=2675","title":{"rendered":"How to Set the Default Gateway in Linux"},"content":{"rendered":"<p>Access to the internet\u2014or any other network\u2014is governed by the default gateway. We explain what a default gateway is, and how to set and change it on your Linux computer.<\/p>\n<h2 id=\"what-is-the-default-gateway\">What Is the Default Gateway?<\/h2>\n<p>All of the devices in your home that are connected to the internet such as laptops, desktop computers, cell phones, tablets, and smart devices are actually connected to your\u00a0<a href=\"https:\/\/www.howtogeek.com\/353283\/what-is-a-local-area-network-lan\/\" target=\"_blank\" rel=\"noopener\">local area network (LAN)<\/a>.<\/p>\n<p>Because they&#8217;re on the same network, these devices can talk to one another if they need to. Most are happy to do their own thing and operate in isolation but if you have a\u00a0<a href=\"https:\/\/www.howtogeek.com\/767282\/best-printer\/\" target=\"_blank\" rel=\"noopener\">printer<\/a>, for example, or a\u00a0<a href=\"https:\/\/www.howtogeek.com\/746521\/best-nas-network-attached-storage-devices\/\" target=\"_blank\" rel=\"noopener\">network-attached storage device<\/a>, then some of your other devices will want to be able to connect to them.<\/p>\n<p>All of your network-enabled appliances connect to your router over Wi-Fi or via\u00a0<a href=\"https:\/\/www.howtogeek.com\/217463\/wi-fi-vs.-ethernet-how-much-better-is-a-wired-connection\/\" target=\"_blank\" rel=\"noopener\">a network cable<\/a>. Your\u00a0<a href=\"https:\/\/www.howtogeek.com\/722600\/best-wi-fi-routers\/\" target=\"_blank\" rel=\"noopener\">router<\/a>\u00a0is the traffic controller for your network. It directs network traffic from device to device. The traffic from each device goes to the router, the router determines which device the data is going to, and sends it on to the target device.<\/p>\n<p>Your router is the only part of your network that is actually connected to\u00a0<a href=\"https:\/\/www.howtogeek.com\/341866\/how-does-the-internet-work\/\" target=\"_blank\" rel=\"noopener\">the internet<\/a>. Everything else talks to your router and the router brokers connections out to the internet. Responses from internet-based services such as mail servers or websites are received by the router. It then forwards them to the appropriate device inside your network.<\/p>\n<p>So, as well as directing traffic around your network, your router also controls the data flow to and from the internet. It&#8217;s a traffic controller and it&#8217;s a gateway to other networks. For most people, the only other network they&#8217;re concerned with is the internet.<\/p>\n<p>The device that is sending traffic is called the originating device. On larger networks, the originating device decides which router to use. If it doesn&#8217;t specify a preference\u2014or if there is only one router\u2014the default gateway is used. On most home networks, there is usually a single router containing one gateway.<\/p>\n<div class=\"ad-odd\"><\/div>\n<h2 id=\"configuring-the-default-gateway\">Configuring the Default Gateway<\/h2>\n<p>Normally, the gateway is configured when your operating system is installed. Sometimes you might take ownership of a computer that has been used on a different network that you need to reconfigure the gateway on, or you might have a need to point a particular machine to a different gateway. Perhaps you have a network with different sub-networks and you have a gateway acting as an intermediary.<\/p>\n<p>The preferred method of working with routes in Linux is via\u00a0<a href=\"https:\/\/www.howtogeek.com\/657911\/how-to-use-the-ip-command-on-linux\/\" target=\"_blank\" rel=\"noopener\">the\u00a0<code>ip<\/code>\u00a0command<\/a>. Other commands such as ifconfig are considered deprecated.<\/p>\n<p>With the\u00a0<code>ip<\/code>\u00a0command you can find out what the default gateway setting is, and you can add or delete default gateways.<\/p>\n<div class=\"ad-even\"><\/div>\n<h2 id=\"discovering-the-default-gateway\">Discovering the Default Gateway<\/h2>\n<p>To see the routes configured on a Linux computer use the\u00a0<code>ip<\/code>\u00a0command with the\u00a0<code>route<\/code>\u00a0object. You can add the &#8220;list&#8221; option, but as &#8220;list&#8221; is the default action it can be omitted. And to further save keystrokes, &#8220;r&#8221; can be used instead of the word &#8220;route&#8221;.<\/p>\n<pre>ip route list<\/pre>\n<pre>ip r<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png\" alt=\"Finding out the default gateway using the ip command.\" width=\"644\" height=\"210\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/1-2.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>One of the routes will have the word &#8220;default&#8221; in it. That&#8217;s the default route to the default gateway.<\/p>\n<p>Sometimes routes can be added and removed automatically. Using the\u00a0<strong>ip r<\/strong>\u00a0command on the same computer produces a different result when we&#8217;ve opened a\u00a0<a href=\"https:\/\/www.howtogeek.com\/738071\/best-vpn-services\/\" target=\"_blank\" rel=\"noopener\">VPN<\/a>\u00a0connection. That creates a private\u00a0<a href=\"https:\/\/www.howtogeek.com\/791382\/what-is-a-vpn-tunnel-a-quick-look-at-vpn-security\/\" target=\"_blank\" rel=\"noopener\">tunnel<\/a>\u00a0for that network traffic.<\/p>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png\" alt=\"IP route using a private tunnel.\" width=\"644\" height=\"150\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/2-3.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>We can see the new entry has a &#8220;dev&#8221; device name of &#8220;tun0&#8221;, meaning tunnel zero.<\/p>\n<p>If you have many routes set up, it can be easier to extract the default route using\u00a0<code>grep<\/code>.<\/p>\n<pre>ip r | grep default<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png\" alt=\"Using grep to isolate the default gateway.\" width=\"644\" height=\"95\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/3-1.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<div class=\"ad-odd\"><\/div>\n<h2 id=\"removing-the-default-gateway\">Removing the Default Gateway<\/h2>\n<p>Actually, what we&#8217;re doing is removing the route that guides traffic to the default gateway. We can use the\u00a0<code>ip<\/code>\u00a0command with the\u00a0<code>route<\/code>\u00a0object and the\u00a0<code>delete<\/code>\u00a0option. To make changes to the routing table we need to use\u00a0<code>sudo<\/code>\u00a0. We&#8217;ll delete the default route and then list the routes.<\/p>\n<pre>sudo ip route delete default<\/pre>\n<pre>ip r<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png\" alt=\"Deleting the default gateway.\" width=\"644\" height=\"130\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/4-2.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>The default gateway entry has been removed.<\/p>\n<div class=\"ad-even\"><\/div>\n<h2 id=\"adding-a-default-gateway\">Adding a Default Gateway<\/h2>\n<p>To add a default gateway we use the\u00a0<code>add<\/code>\u00a0option with the\u00a0<code>route<\/code>\u00a0object.<\/p>\n<p>We&#8217;re going to add a route called &#8220;default&#8221; that directs traffic to the router at 192.168.1.1, and we&#8217;re going to send that traffic through network interface &#8220;enp0s3.&#8221;<\/p>\n<pre>sudo ip route add default via 192.168.1.1 dev enp0s3<\/pre>\n<pre>ip r<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png\" alt=\"Adding a default gateway.\" width=\"644\" height=\"170\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/5-2.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<div class=\"ad-odd\"><\/div>\n<h2 id=\"making-routing-changes-persistent\">Making Routing Changes Persistent<\/h2>\n<p>The changes we&#8217;ve made so far take instant effect, but they don&#8217;t survive\u00a0<a href=\"https:\/\/www.howtogeek.com\/411925\/how-to-reboot-or-shut-down-linux-using-the-command-line\/\" target=\"_blank\" rel=\"noopener\">a reboot of the computer<\/a>. To make your changes permanent requires modifying some configuration files. The techniques differ from Linux distro to Linux distro.<\/p>\n<h3 id=\"ubuntu\">Ubuntu<\/h3>\n<p>In\u00a0<a href=\"https:\/\/www.howtogeek.com\/763775\/what-is-ubuntu\/\" target=\"_blank\" rel=\"noopener\">Ubuntu<\/a>, you can use the\u00a0<code>netplan<\/code>\u00a0command and configuration file. Replace &#8220;gedit&#8221; with\u00a0<a href=\"https:\/\/www.howtogeek.com\/trey-these-linux-text-editors\/\" target=\"_blank\" rel=\"noopener\">the text editor of your choice<\/a>\u00a0if you prefer it or if your Ubuntu derivative doesn&#8217;t include gedit.<\/p>\n<pre>sudo gedit \/etc\/netplan\/01-network-manager-all.yaml<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png\" alt=\"Editing the network manager config file on Ubuntu.\" width=\"644\" height=\"75\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/6-1.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>Add the text starting at &#8220;ethernets&#8221; to the configuration file. Note that whitespace is important. Make sure each successive level of indentation is two spaces, and take care to include the hyphen &#8221;\u00a0<code>-<\/code>&#8221; in the &#8220;- to:&#8221; line. This will set a default route to the router at 192.168.1.1. Replace this with\u00a0<a href=\"https:\/\/www.howtogeek.com\/233952\/how-to-find-your-routers-ip-address-on-any-computer-smartphone-or-tablet\/\" target=\"_blank\" rel=\"noopener\">the IP address for your network<\/a>.<\/p>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png\" alt=\"Contents of the network manager config file\" width=\"644\" height=\"280\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/7-2.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>Save the file and close your editor.<\/p>\n<p>To apply the changes, use the\u00a0<code>netplan<\/code>\u00a0command with the\u00a0<code>apply<\/code>\u00a0option:<\/p>\n<pre>sudo netplan apply<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png\" alt=\"Applying the changes in the network manager config file.\" width=\"644\" height=\"75\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/8-1.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>Being silently returned to the command line means the changes were accepted. If you want to test the changes before they are applied, use the\u00a0<code>netplan<\/code>\u00a0command with the\u00a0<code>try<\/code>\u00a0option.<\/p>\n<pre>sudo netplan try<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png\" alt=\"Doing a dry run with the network manager config settings.\" width=\"644\" height=\"190\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/9-1.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>This gives you time to test your changes. Press the &#8220;Enter&#8221; key to commit the changes. If you don&#8217;t press the &#8220;Enter&#8221; key within two minutes the process will time out and your edits will not have been applied. They&#8217;re still in the config file, but they haven&#8217;t been applied to your network settings.<\/p>\n<h3 id=\"fedora\">Fedora<\/h3>\n<p>In\u00a0<a href=\"https:\/\/www.howtogeek.com\/782928\/what-is-fedora-linux\/\" target=\"_blank\" rel=\"noopener\">Fedora<\/a>, we need to edit the &#8220;\/etc\/sysconfig\/network&#8221; file, and either add or edit the &#8220;GATEWAY=&#8221; line.<\/p>\n<pre>sudo gedit \/etc\/sysconf\/networks<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png\" alt=\"Editing the global network setting file on Fedora.\" width=\"644\" height=\"55\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/10-1.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>The file might be empty or it might contain other settings. Either find and edit the &#8220;GATEWAY=&#8221; line or add it. Substitute the IP address for the one that is correct for your network.<\/p>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png\" alt=\"The GATEWAY= line in the network config file.\" width=\"644\" height=\"150\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/11-1.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>Save the file and close the editor.<\/p>\n<h3 id=\"manjaro\">Manjaro<\/h3>\n<p>With\u00a0<a href=\"https:\/\/www.howtogeek.com\/430556\/why-i-switched-from-ubuntu-to-manjaro-linux\/\" target=\"_blank\" rel=\"noopener\">Manjaro<\/a>\u00a0we need to edit or create a file named after the network interface you&#8217;re setting the default gateway for. The file has an extension of &#8220;.network&#8221;, and the filename is the same as the network interface.<\/p>\n<p>First, we need to stop the network manager daemon:<\/p>\n<pre>sudo systemctl stop NetworkManager.service<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png\" alt=\"Stopping the network manager daemon on Manjaro\" width=\"645\" height=\"55\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/12-1.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>We can find the name of the interface using the\u00a0<code>ip addr<\/code>\u00a0command:<\/p>\n<pre>ip addr<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png\" alt=\"Checking the IP address.\" width=\"644\" height=\"55\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/13-1.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>Our interface name is &#8220;enp0s3&#8221;.<\/p>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png\" alt=\"Finding the network interface name.\" width=\"644\" height=\"380\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/14-1.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>We&#8217;ll need to use this in the next command.<\/p>\n<pre>sudo gedit \/etc\/systemd\/network\/enp0s3.network<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png\" alt=\"Editing the interface-specific network config file.\" width=\"644\" height=\"75\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/15.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>There may already be entries in the file, or it might be completely empty. Make sure these two lines appear in the file. Substitute the IP address of the gateway and the name of the network interface to suit your computer and network.<\/p>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png\" alt=\"The Gateway= line in the interface-specific network config file.\" width=\"644\" height=\"190\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/16.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<p>Save the file and close the editor, and then restart the network manager daemon.<\/p>\n<pre>sudo systemctl start NetworkManager.service<\/pre>\n<div class=\"body-img landscape \">\n<div class=\"responsive-img image-expandable img-article-item\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png\" data-modal-id=\"single-image-modal\" data-modal-container-id=\"single-image-modal-container\" data-img-caption=\"&quot;&quot;\">\n<figure><picture><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 1024px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" media=\"(min-width: 768px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png?q=70&amp;fit=crop&amp;w=825&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" media=\"(min-width: 481px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png?q=70&amp;fit=crop&amp;w=800&amp;dpr=1\" \/><source srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" media=\"(min-width: 0px)\" data-srcset=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png?q=70&amp;fit=crop&amp;w=500&amp;dpr=1\" \/><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png\" alt=\"Starting the network manager daemon.\" width=\"644\" height=\"75\" data-img-url=\"https:\/\/static1.howtogeekimages.com\/wordpress\/wp-content\/uploads\/2022\/04\/17.png\" \/><\/picture><\/figure>\n<\/div>\n<\/div>\n<div class=\"ad-even\"><\/div>\n<h2 id=\"you-might-not-change-it-often\">You Might Not Change It Often<\/h2>\n<p>But when you need to you&#8217;ll find it is easy. Making the changes persistent across reboots is slightly more involved, but still not too difficult.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Access to the internet\u2014or any other network\u2014is governed by the default gateway. We explain what a default gateway is, and how to set and change it on your Linux computer. What Is the Default Gateway?&hellip;<\/p>\n<p><a class=\"excerpt-readmore\" href=\"https:\/\/www.sudlatnid.com\/?p=2675\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":2683,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[21],"tags":[],"class_list":["post-2675","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-ubuntu-lubuntu-linuxmint","odd"],"jetpack_featured_media_url":"https:\/\/www.sudlatnid.com\/wp-content\/uploads\/2024\/11\/How-to-Set-the-Default-Gateway-in-Linux.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/posts\/2675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2675"}],"version-history":[{"count":1,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/posts\/2675\/revisions"}],"predecessor-version":[{"id":2684,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/posts\/2675\/revisions\/2684"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=\/wp\/v2\/media\/2683"}],"wp:attachment":[{"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sudlatnid.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}