This post gives a step by step guide on how to setup a static route. This post will not have any in-depth details, so it is just for newbies just like myself.
First step is going to the root
#su -l
Then you have to go to the following directory which contains details about interfaces as well as about the routes,
#cd /etc/sysconfig/network-scripts/
You can use the 'Tab' key to autofill the commands in linux cli as well as the directory names :) which often makes your life easier.
Now since we are in the correct location what we have to do is adding the route to a special file with the name 'ifcnfg-route'. I will use the 'vi editor' for this task.
#vi route-eth0
This file can be blank if your linux os does not have any routing configured.
Now you need to know basic commands in 'vi editor' in order to edit this document and save it. When I first use the 'vi editor' it was pretty confusing, but going googling 'vi commands' gave me enough insight about this editor. After getting to know all the commands it will be a pretty easy editor to use. :)
So there we just need to put a small entry,
<destination network> via <gateway to be used>
example:
10.1.60.0 via 10.1.1.254
But make sure that the gateway ip-address is available in your networks.
Then save the editor and exit.
Make sure you restart your interfaces after doing any modification.
#/etc/init.d/network restart
Finally, check your configuration by typing
#route -n
If your entry is displayed in the output, then you did it correctly :)
Thank you.
Pradeepa
No comments:
Post a Comment