Setting Routes in Linux

Setting Routes in Linux

 

This post was last updated on May 27th, 2020 at 04:15 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

Sibananda Sahu
Sibananda Sahu 186 posts

A Linux Kernel Developer and a Firmware Developer by profession. Have worked with few big companies: BROADCOM Corporation, Cypress Semiconductor, LSI Corporation, TOSHIBA Corporation, Western Digital; on various cutting edge technologies and product lines, such as: RAID storage Driver, SSD Firmware, WLAN Firmware etc. Having more than 9 years of experience in Software Engineering domain. Now, took a pledge to educate all aspirant students to teach about Linux Kernel Development.

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

Administration 0 Comments

SAMBA in Linux – Administration Checklist

This post was last updated on May 27th, 2020 at 05:04 pm Contents1 Samba startup guide checklist:2 Getting SWAT to work in RH70 Samba startup guide checklist: This applies to

Networking 0 Comments

How to Use ifconfig to set MAC address in Linux, Unix, FreeBSD etc.

This post was last updated on July 9th, 2020 at 05:08 pmLinux has a built-in command ifconfig that is used to configure wired network interfaces. In this article I am

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply