• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

Route Command in linux with examples

249

Route Add Command in Linux with examples

Routing is the basic design for internet protocol. This protocol helps in transferring packet to the right machines. A router controls the traffic and sends packet to the destination network. Route add command in Linux is explained in this article with an example.

Options

-A is used to specify the specific address family.
-F option is used for the kernel' s FIB routing table.
-C option is used to operate the kernel' s routing cache.

-v option is used for verbose operation.
-n displays the numerical addresses.
-e option is used to display the routing table in netstat-format.
-arp Manipulate the system ARP cache.
-ifconfig View or modify the configuration of network interfaces.
-ip Display and manipulate information about routing, devices, policy routing and tunnels. netstat&mdash Print information about network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
-ee option will generate a very long line from the routing table with all parameters.
-del Delete a route.
-add add a new route.
-net the target is a network.
-host the target is a host.
-netmask NM to add a network route, the netmask is to be used.
-gw GW route packets via a gateway.
Set up a static route to the gateway to make sure that the specified gateway should be available.

Examples of Route add command

To fetch the information about the routing table

[root@linuxhelp ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.5.1     0.0.0.0         UG    1024   0        0 eno16777736
192.168.5.0     0.0.0.0         255.255.255.0   U     0      0        0 eno16777736


To add network

Use route command along with the net switch, the subnet mask and gateway values to add a network.

[root@linuxhelp ~]# route add -net 192.168.5.0 netmask 255.255.255.0 gw 192.168.5.1 eno16777736
[root@linuxhelp ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.5.1     0.0.0.0         UG    1024   0        0 eno16777736
192.168.5.0     192.168.5.1     255.255.255.0   UG    0      0        0 eno16777736
192.168.5.0     0.0.0.0         255.255.255.0   U     0      0        0 eno16777736


To add particular ip address

By using &ndash host along with the router command to add a particular IP address.

[root@linuxhelp ~]# route add -host 192.168.5.191 gw 192.168.5.1 eno16777736
[root@linuxhelp ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.5.1     0.0.0.0         UG    1024   0        0 eno16777736
192.168.5.0     192.168.5.1     255.255.255.0   UG    0      0        0 eno16777736
192.168.5.0     0.0.0.0         255.255.255.0   U     0      0        0 eno16777736
192.168.5.191   192.168.5.1     255.255.255.255 UGH   0      0        0 eno16777736

Tags:
michael
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

How to navigate to man page for the route?

A

You can navigate by entering "man router" command from command line.

Q

It is possible to track Wifi?

A

No. you can route only wired Networks

Q

How to display the numerical address using Route command?

A

To display the numerical address use this commands
Syntax: "route -n"
-n displays the numerical addresses.

Q

What is the command to view the verbose using route commands?

A

By using this command you can view the verbose
Syntax: " route -v"

Q

How to delete a route?

A

Use "-del" to delete the route.

Related Tutorials in Route Command in linux with examples

Related Tutorials in Route Command in linux with examples

Route Command in linux with examples
Route Command in linux with examples
Jul 22, 2016
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Jayce ?
What are the types of table used in IPtables

What are the various types of table used in IPtables and how to use that for my server security?

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.