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 Make Python Run As Fast As Julia

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:  How to create a guest user account on Ubuntu 10.04

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 runs network ads?  Yep, no more ads from the usual suspects that track 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.

Subscribe for updates. Trust me, no spam!

Mailchimp Signup Form

Sponsored links

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

Leave a Reply

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

Get the latest

On social media
Via my newsletter
Mailchimp Signup Form

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.

Anastasia Marchenkova

An invitation from Anastasia Marchenkova

Hya, after stints as a quantum researcher at Georgia Tech Quantum Optics & Quantum Telecom Lab, and the University of Maryland Joint Quantum Institute, I’m now working on superconducting qubit quantum processors at Bleximo. I’ll be speaking during Algorithm Conference in Austin, Texas, July 16 – 18, 2020. Meet me there and let’s chat about progress and hype in quantum computing.