Linux route Add Command Examples

https://‮ual.www‬tturi.com
Linux route Add Command Examples

The route command in Linux is used to display and manipulate the IP routing table. It is often used to add static routes to the routing table or to modify existing routes.

Here are some examples of using the route command to add a static route:

  1. To add a route to the default gateway:
route add default gw 192.168.1.1

This will add a route to the default gateway at IP address 192.168.1.1.

  1. To add a route to a specific network:
route add -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.1.1

This will add a route to the network 10.0.0.0/8 with a gateway at IP address 192.168.1.1.

  1. To add a route to a specific host:
route add -host 10.0.0.5 gw 192.168.1.1

This will add a route to the host with IP address 10.0.0.5 with a gateway at IP address 192.168.1.1.

Note that these routes will only be added temporarily and will be lost after a reboot. To make the routes persistent, you can add the route commands to the system startup scripts.

For more information about the route command and its options, you can consult the man page by running man route in the terminal.

Created Time:2017-10-30 10:17:42  Author:lautturi