How to change the default route in Linux

add IP route Linux

This is just a short article that shows how to change the default network route in Linux. Before I show how to do it, hoping that it helps somebody, let me tell you how I found myself in a situation where I was forced to change it.

If all you care about is how to change the route and not what led to the decision to change it, you may scroll to the end of the article.

Changing the default route in Linux is something I’ve never had to do on any desktop distribution in ages, but since yesterday afternoon, crazy stuff has been happening in my local network. My ISP is Verizon and I subscribe to their FiOS Internet service. I’ve never had a problem with it until yesterday afternoon when it just stopped working. I couldn’t connect to the Internet.

I spent the better part of an hour trying to figure out what the heck was going on, but nothing I tried worked. I could ping the router from any computer and connect to its web management interface, but that was about it. From the router itself I could ping and run a traceroute to any IP on the Internet, but I could not surf the Web. I gave up after an hour and called tech support. I succeeded in scheduling an appointment with a Verizon technician for Sunday afternoon and resigned to not having Internet access for two days. Not good, but what else can I do?

Related Post:  How to add an entry for a Linux distribution in Windows' boot menu

About six hours later, Internet access started working on its own. I didn’t even touch anything. Afterwards, I noticed that every computer on the network was getting an IP address in the 192.168.1.100 and higher range, something that has never happened in more than the six years I’ve been using Verizon FiOS. I figured that I have to investigate what’s going on, but there are other important matters that I have to attend to. So I shelved it for a later time.

Aside from my VoIP service, Internet access has been working just fine until a few hours ago when I installed Ubuntu 14.04 server in VMPlayer. apt-get update was failing because the system couldn’t connect to the Internet. My main computer running Fedora 20 KDE is working fine, but the Ubuntu server running as a guest OS on it was not. I booted up another computer running Ubuntu 14.10 desktop, but it too could not connect to the Internet.

Related Post:  Your choice of NTP applications in Linux

What in the name of Tux is going on!

Just then I decided to check something I should have checked all along – the routing table. Perhaps it could tell me something. And it did. The default route was not what it’s supposed to be (see Figure 1). IP address 192.168.1.5 does not even belong to any device on the network. Something doesn’t smell right. But the best I can do now is change the default route to point to the correct IP.

So here’s how you change the default route in Linux: sudo ip route change default via IP-address dev eth0 proto static (replace IP-address with the IP of your router).

add IP route Linux
Figure 1: Changing the default route in Ubuntu or any other Linux distribution

That solved an immediate problem, but I think there’s something not quite right in my network. I’ve gotta find out what. More on this later, if I find something that’s worth writing about.

Share:

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn

Hola! Did you notice that LinuxBSDos.com no longer run network ads?  Yep, no more ads from the usual suspects that track and annoy you across the Internet. But since I still need to pay to keep the site running, feel free to make a small donation by PayPal or your favorite cryptocurrency.

  • Bitcoin
  • Ethereum
  • Xrp
  • Bitcoin cash
  • Bitcoin sv
  • Litecoin
  • Binance coin
  • Cardano
  • Ethereum classic
Scan to Donate Bitcoin to bc1qzvlte2m224zkayhdc7fdfjkp2rsgt0l5a496ua

Donate Bitcoin to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin

Scan to Donate Ethereum to 0x0F4362DFF77F3Ba0Dc637F5f3Eba35D09a2fA60C

Donate Ethereum to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum

Scan to Donate Xrp to r4ggjvL36njsMCYTkJ3S7cTHscPsMsSGQv

Donate Xrp to this address

Scan the QR code or copy the address below into your wallet to send some Xrp

Scan to Donate Bitcoin cash to qrs0dedzp9t55af3nfwypydghp29r0xguy9s20fz2k

Donate Bitcoin cash to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin cash

Scan to Donate Bitcoin sv to 15K9TLyVDBtLuG9cYvXCX9SSkq9C9oUKHK

Donate Bitcoin sv to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin sv

Scan to Donate Litecoin to LetJ9QQMb7u2LMZ9Tu6rtHwcBcQFW98fbG

Donate Litecoin to this address

Scan the QR code or copy the address below into your wallet to send some Litecoin

Scan to Donate Binance coin to bnb1ga8trq08ssqepd90v6225nzfgy448pu5pw8gxp

Donate Binance coin to this address

Scan the QR code or copy the address below into your wallet to send some Binance coin

Scan to Donate Cardano to addr1qx2354yw49etstfljpdhwja3ajjlt487lg95vu9ngy2q6vu4rf2ga2tjhqknlyzmwa9mrm997h20a7stgectxsg5p5esq5l7d9

Donate Cardano to this address

Scan the QR code or copy the address below into your wallet to send some Cardano

Scan to Donate Ethereum classic to 0xcD6CC972a2297FcafACDcfE042C55C69516a9264

Donate Ethereum classic to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum classic

Subscribe for updates. Trust me, no spam!

Sponsored links

1. Attend Algorithm Conference, a top AI and ML event.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.

Upcoming events

One Response

  1. Good gravy and excellent missive. I have very similar issues and have spent perhaps thirty hours trying to find a fix.

    I am running MX-Linux 19.2; Mint 20; and Manjaro 18 and they all
    have the same “can not connect to the Internet” conflict. For some reason, our Internet provider, Century Link, started changing our IP address, from 192 to 175 and all of the OSs would lose connect ability.
    Even Dows 7, eventual gave up the ghost.

    I knew our IP address well because of a monitoring program which tracked any device on our network.

    This is a real bad issue since it can involve numerous items – hardware; installation; Internet provider; software; settings. Why over the past two weeks our IP address changes between these two different numbers I do not know, however, it is a major headache in not only losing Internet service but trying to find a fix.

    As I was reading your piece, I was hoping it was identifying a similar issue
    which has hounded me. Oh, I should mention my wife’s WIFI experienced no service outage, so it was strictly the Ethernet issue.

    Two days since the IP address has remained fixed, with our old IP address,
    so I hoping that the problem has fixed itself; if not I will try your suggestion.

    BTW, thanks for dating your article; it is all too often not done.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest

On social media
Via my newsletter

Partner links

1. Attend Algorithm Conference, a top AI and ML event for 2021.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.
Hacking, pentesting distributions

Linux Distributions for Hacking

Experts use these Linux distributions for hacking, digital forensics, and pentesting.

Categories
Archives

The authors of these books are confirmed to speak during

Algorithm Conference

T-minus AI

Author was the first chairperson of AI for the U.S. Air Force.

The case for killer robots

Author is the Director of the Center for Natural and Artificial Intelligence.

Why greatness cannot be planned

Author works on AI safety as a Senior Research Scientist at Uber AI Labs.