Setting Routes in Linux
 

Setting Routes in Linux

 

This post was last updated on November 3rd, 2020 at 06:03 pm

(Static Routes Page: static-routes.html)

These methods of changing the route table don’t last accross reboots. Listed below are methods to make any of these changes permanent.

Checking the route table in Linux

netstat -rn
route

Adding and Removing a Network in Linux

route add -net 10.10.10.0/24 gw 192.168.0.1
route del -net 10.10.10.0/24 gw 192.168.0.1

Adding and Removing a specific host in Linux

route add -host 10.10.10.45 gw 192.168.0.1
route del -host 10.10.10.45 gw 192.168.0.1

Adding a Default GW in Linux

route add default gw 192.168.0.1
route del default gw 192.168.0.1

Note: The old gw will still remain and may need to be taken out for the system to function properly.

Routes are made permanent in Red Hat Linux by adding routes to /etc/sysconfig/static-routes

Checking the route table in Windows NT

route print

Adding and Removing a network in Windows NT

route add 10.10.10.0 mask 255.255.255.0 192.168.0.1
route delete 10.10.10.0 mask 255.255.255.0 192.168.0.1

Adding and Removing a specific host in Windows NT

route add 10.10.10.45 192.168.0.1
route delete 10.10.10.45 192.168.0.1

Adding a Default GW in Windows NT

route add 0.0.0.0 mask 255.255.255.255 192.168.0.1
or
route add 0.0.0.0 192.168.0.1
or
route -p add 0.0.0.0 192.168.0.1
route delete 0.0.0.0
or
route delete 0.0.0.0 mask 255.255.255.255
or
route delete 0.0.0.0 mask 255.255.255.255 192.168.0.1

Routes are made permanent in Windows NT by using “-p” with the route add command. Here is an example:

route -p add 10.10.10.45 192.168.0.1

prev next


Previous Linux Boot Process
Next Using vi in Linux
 

About author

shibaa987
shibaa987 269 posts

Linux kernel developer and a firmware developer with an experience of 10+ years.

View all posts by this author →

You might also like

Networking 0 Comments

How To Setup Network File System (NFS) In Linux?

This post was last updated on August 1st, 2020 at 09:37 pmNFS or Network file system is a distributed filesystem protocol. It allows a remote host to mount filesystem over

Networking 0 Comments

How To Copy A File/Directory From Local To Remote Machine In Linux / FreeBSD?

This post was last updated on August 1st, 2020 at 04:20 pmThere are various ways to copy a file or directory from remote to local or local to the remote

Networking 0 Comments

Manual NIC Setup

This post was last updated on June 3rd, 2020 at 04:16 pmManually setting up a network interface. This can come in handy if you need networking but don’t have any

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply