How To Add New Route In Ubuntu, Linux?


I have a box with Ubuntu Linux and I want to add new route to my box. Because I want to access external network from a different interface and network. How can I add new route to my Ubuntu, Debian, Fedora, CentOS Linux box? Because ip-tools is the same for all of this linux distributions.

Display Existing Routing Table

First we should display existing routing table. Our target network should not intersect existing routing information.

Add New Route

We will add new route to the network.

  • ip route add  is our command to add new route
  • is target network which is destination range
  • via specifies the next hoop which should be directly connected to our system network.
  • dev ens3 specifies our interface which is same network with

Check New Route

This is a route action but we should check the status of the route

Ok goof there is no problem. We can make ping or traceroute test too.

LEARN MORE  How Prompt for Input in Bash

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)