Table of Contents
In this article, we will looks at the steps to install route command on Linux. route command is a part of net-tools package which is available as an open source package and can be downloaded easily through yum command line tool. This package also contains other important tools like ifconfig, arp, ipmaddr, iptunnel etc.
route command is a very useful tool to manage the routing table in the System. Please note that when we are talking route then we are specifically talking about managing static routes in the System.
Install Route command in Linux
Also Read: How to Add the Swap Space in Linux (RedHat/CentOS 7/8) Using Best Methods
Step 1: Prerequisites
a)You need to have a running RedHat/CentOS 7/8 System.
b)You should have sudo
access to run all the privilege commands.
c)You should have yum
command installed in your system.
Step 2: Update Your System
Before installing route command in Linux you need to first update your system using yum update -y
command as shown below.
[root@localhost ~]# yum update -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.piconets.webwerks.in * epel: mirrors.piconets.webwerks.in * extras: mirrors.piconets.webwerks.in * updates: mirrors.piconets.webwerks.in Resolving Dependencies --> Running transaction check ---> Package NetworkManager.x86_64 1:1.18.0-5.el7_7.2 will be updated ---> Package NetworkManager.x86_64 1:1.18.4-3.el7 will be an update ---> Package NetworkManager-libnm.x86_64 1:1.18.0-5.el7_7.2 will be updated ---> Package NetworkManager-libnm.x86_64 1:1.18.4-3.el7 will be an update ---> Package NetworkManager-team.x86_64 1:1.18.0-5.el7_7.2 will be updated ---> Package NetworkManager-team.x86_64 1:1.18.4-3.el7 will be an update ---> Package NetworkManager-tui.x86_64 1:1.18.0-5.el7_7.2 will be updated ---> Package NetworkManager-tui.x86_64 1:1.18.4-3.el7 will be an update ---> Package acl.x86_64 0:2.2.51-14.el7 will be updated ---> Package acl.x86_64 0:2.2.51-15.el7 will be an update ---> Package bash.x86_64 0:4.2.46-33.el7 will be updated ---> Package bash.x86_64 0:4.2.46-34.el7 will be an update ---> Package bind-export-libs.x86_64 32:9.11.4-9.P2.el7 will be updated ---> Package bind-export-libs.x86_64 32:9.11.4-16.P2.el7_8.2 will be an update
NOTE:
root
user to run all the below commands.You can use any user with sudo
access to run all these commands. For more information Please check Step by Step: How to Add User to Sudoers to provide sudo
access to User.Step 3: Install Net-Tools Package
After updating the System, now you need to install net-tools
package using yum install -y net-tools
command as shown below.
[root@localhost ~]# yum install -y net-tools Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile epel/x86_64/metalink | 9.3 kB 00:00:00 * base: mirrors.piconets.webwerks.in * epel: mirrors.piconets.webwerks.in * extras: mirrors.piconets.webwerks.in * updates: mirrors.piconets.webwerks.in base | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/6): base/7/x86_64/group_gz | 153 kB 00:00:01 (2/6): epel/x86_64/group_gz | 95 kB 00:00:01 (3/6): epel/x86_64/updateinfo | 1.0 MB 00:00:01 (4/6): epel/x86_64/primary_db | 6.8 MB 00:00:03 (5/6): extras/7/x86_64/primary_db | 165 kB 00:00:02 (6/6): base/7/x86_64/primary_db | 6.1 MB 00:00:04 Resolving Dependencies --> Running transaction check ---> Package net-tools.x86_64 0:2.0-0.25.20131004git.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================== Installing: net-tools x86_64 2.0-0.25.20131004git.el7 base 306 k Transaction Summary ======================================================================================================================================================================== Install 1 Package Total download size: 306 k Installed size: 917 k Downloading packages: net-tools-2.0-0.25.20131004git.el7.x86_64.rpm | 306 kB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1 Verifying : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1 Installed: net-tools.x86_64 0:2.0-0.25.20131004git.el7 Complete!
Step 4: Test Your Installation
After successful installing net-tools
package you can quickly verify the installation using rpm
command as shown below. You can query the rpmdb
to check if the package is installed or not.
[root@localhost ~]# rpm -qa | grep -i net-tools net-tools-2.0-0.25.20131004git.el7.x86_64
Step 5: Check Your Route using route command
Now that package is successfully installed, you can verify the route command by simply running route -n
command to show all the current available routes in the System.
[root@localhost ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 enp0s3 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3
Popular Recommendations:-
How to Cleanup Failed Actions from PCS Status of Cluster
How to Enable or Disable SELinux Temporarily or Permanently on RedHat/CentOS 7/8
10 Popular Examples of sudo command in Linux(RedHat/CentOS 7/8)
How to Install and Use telnet command in Linux (RedHat/Linux 7/8) using 5 Easy Steps