• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

route: command not found

by admin

It is possible to configure a Linux system to act as a router. The role of a router is to pass traffic from one network segment to another, based on the network ID of packets. In order to properly direct traffic to the appropriate subnet (and prevent traffic from getting to certain subnets, too), routing table entries are configured. This is not a common configuration for Linux hosts but is important to be aware of.

The route command is used to view the routing table. The command is also used to manipulate the routing table, enabling the administrator to configure desired routes.

Examples include the following.

Command Used To
route View the current routing table on the system.
route add default gw {IP address} Configure a default gateway by its IP address. Packets will be passed to this destination if there are no other routes that match their network ID.
route add –host {IP address} reject Filter traffic destined to the specified address, which enables an administrator to control connections to a particular host. Can also be configured for an entire subnet.

Syntax

The syntax of the route command is:

# route [options]

If you encounter the below error while running the route command:

route: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
Debian apt-get install net-tools
Ubuntu apt-get install net-tools
Alpine apk add net-tools
Arch Linux pacman -S net-tools
Kali Linux apt-get install net-tools
CentOS yum install net-tools
Fedora dnf install net-tools
Raspbian apt-get install net-tools

route Command Exaxmples

1. To see the current routing table:

# route 

2. To show numerical addresses instead of trying to determine symbolic host names:

# route -n 

3. To use netstat-format for displaying the routing table:

# route -e 

4. To see the kernel routing cache:

# route -C 

5. To add the route into the system:

# route add -net 192.168.200.0 netmask 255.255.255.0 gw 192.168.200.1
# route add -host 192.168.200.10 netmask 255.255.255.254 gw 192.168.200.1
# route add -host 192.168.200.10 netmask 255.255.255.254 gw 192.168.200.1 dev eth0 

6. To add a default route via specified gateway:

# route add default ge 192.168.200.1 

7. To delete a route from the system:

# route del -net 192.168.200.0 netmask 255.255.255.0 gw 192.168.200.1
# route del -host 192.168.200.10 netmask 255.255.255.0 gw 192.168.200.1 

8. To reject a route:

# route add -host 192.168.200.10 netmask 255.255.255.254 gw 192.168.200.1 reject
# route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.200.1 reject
# route add -net 192.168.0.0 netmask 255.255.0.0 reject 

9. To see the help:

# route -h
# route --help

10. To see the version:

# route -V
# route --version 

11. To set to verbose mode:

# route -v 

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to load SELinux Module For Oracleasm
  2. expect: command not found
  3. Intel I219-LM Centos 6 network failed to start
  4. Audit rules to log reboot command executions in CentOS/RHEL
  5. Mutt, Mail and Telnet – Send mails from linux command line or terminal
  6. “No space left on device” – kdump generation issue (CentOS/RHEL)
  7. “Failed to Synchronize Cache For Repo ‘repo_name’, Ignoring This Repo” – CentOS/RHEL 8 error
  8. What are “segfault” messages in /var/log/messages file
  9. dir: command not found
  10. CentOS / RHEL 7 : How to change the verbosity of debug logs during booting

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright