How to add persistent/permanent routes in windows and linux
We can add static route in the system using route add command from the command prompt or terminal. But these routes gets erased when we reboot the system. To make your route's persistent even after reboot. follow below command on Windows or Linux
On Windows :
In Command Prompt, Run command as below
C:\> route -p add 192.168.1.0 mask 255.255.255.0 172.16.193. 100 metric 1
-p switch will make the route persistent on windows.
On Linux :
- Open Terminal , with root privileges create/edit below file to add the route details as below
2. Add the route details like below and save the file.
192.168.1.0/24 via 172.16.193.100
3. Restart the network service by running " /etc/init.d/network restart ". Now you should be able connect the systems under 192.168.1.0/24 network through 172.16.193.100 gateway.
Note : if your ip address is configured to eth1 port then you would have to create " route-eth1 " file at "/etc/sysconfig/network-scripts/ " with route details in it.