Tutorials/Tips

How to change the default route in 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:  17 alternatives to your default image viewer on Fedora

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:  Why you should disable autofill on your browsers

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.

Subscribe to LinuxBSDos.com

Subscribe to receive the latest articles in your Inbox

Trust me, you'll not be spammed...

Please share:

We Recommend These Vendors and Free Offers

Register now for Blockchain & Cryptocurrency Con 2018, international conference on blockchain technnology in Dallas, TX (USA), Feb. 23-24, 2018. A 50% discount for students.

Best WhatsApp Plus features in Gbwhatsapp latest APK download

Best binary auto trading software reviews by 7binaryoptions.com

Google has got competition, because Presearch is building a blockchain-based search engine controlled by the community. At $0.15 a token, you can participation in Lot 3 of the token sale by clicking here

Open Money is building a solution that will run mainstream software on blockchain tech. Click here to get free tokens that will be the digital currency of the platform

Launch an SSD VPS in Europe, USA, Asia & Australia on Vultr's KVM-based Cloud platform starting at $5:00/month (15 GB SSD, 768 MB of RAM).


Leave a Comment

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

*