Open In App

How to add route in Ubuntu?

Last Updated : 10 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Route in Ubuntu is the major communication means between various networks. If you want to send internet packets from one communication medium to another, you have to use the Linux Route. The Route is the fundamental path or series between the routers in computers. There are many times when you should add Route in Ubuntu.

While working on the Network Model, there are times when you plan to add different nodes with cable. However, you can add two nodes or computers by Configuring Route on Linux. And if you are using a Linux Operating System like Ubuntu, you can simply join routes by adding a New Route in Ubuntu.

This article will highlight some important methods & commands to Start a New Route on Ubuntu without having any issues.

To know more about Route, its features, and the Working Process, check the article What is Routing? on GeeksforGeeks.

How to Add Route in Ubuntu?

To add route in Ubuntu, the following guidelines can be followed. We will start with the most useful Linux Command Route.

Method 1: Add Route on Ubuntu using Route Command

Open Terminal & execute the following command in the pattern that is given. Here, we are going to add the Default Route to the system. So, in place of the Host Name, we have mentioned the Default.

Command: route add <Host Name> gw <Gateway Number>

1--Route

Method 2: Add Route on Ubuntu using IP Command

In the Terminal, paste the following command. This command will take the IP Command along with the Route Command.

Command: ip route add <Destination Address> dev <Interface Name>

2--IP

Method 3: Add Route on Ubuntu using NMCLI Command

On the Terminal, execute the command mentioned here. In this case, the NMCLI Command from the Network Manager will be used instead of IP & Route commands.

Command: nmcli connection modify <Connection Name> ipv4.addresses "<Destination Address>"

3--NMCLI

So, these are the three simple commands you need to execute on the Linux Terminal to Add Route on Ubuntu. Now for you, adding route in Ubuntu becomes easy. The best way to add a route to Ubuntu is to use the Route Command. It takes a lot less time to configure your New Route Added on Ubuntu.

Frequently Asked Questions to Add Route on Ubuntu

How to add a route on Ubuntu?

To add a route on Ubuntu, the following steps should be executed properly.

  1. Open Ubuntu Terminal.
  2. Execute the command route and add <Host Name> gw <Gateway Number>
  3. The route will be added to the system within a few minutes.

What is a route on Ubuntu?

The Route is the interface on Linux like Ubuntu by which we can access the Kernel of Linux. The Routing Table that is present in the Linux Kernel can be modified once you can access the Route in Linux. This is highly used in the Network Configuration Settings on Linux.

Why is it necessary to add the route to Ubuntu?

The Addition of a Route on Linux sometimes becomes more necessary for any Network Expert. Every route provides access to some IP Address locally. However, if you want to access some address outside of your normal route, you have to add the route to the system for that purpose.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads