Linux Route Add
ip route add 80.74.17.9 via 80.74.16.60 dev eth0
ip route add 10.10.1.0/24 via 192.168.250.2 dev eth2
ip route add 10.10.9.0/24 via 192.168.250.2 dev eth2
!
sudo route add 10.10.9.0/24 gw 192.168.250.2 dev eth2
sudo /etc/init.d/iptables save
!
Show ip route table:
ip route
Edit File :
cd /etc/rc.d/
Use the following command to check the present routes.
netstat -r
netstat -rnsudo ip route show
sudo ip route -n
sudo ip route show table localsudo ip route show cache
sudo ip -s route show cache
sudo ip -s route get 172.20.4.0
Removing a specific route and emptying a routing table with ip route flush:
sudo ip route flushsudo ip route flush 172.20.4.0/24
Adding routes to the startup:-
All these added routes will be lost whenever we restart the pc, in order to make these route entries permanent ot to make sure that these comes back automatically whenever a pc is restarted, issue the following commands.
Vi /etc/rc.local
And insert the following command, save the file and exit.
route add -net 192.56.76.0 netmask 255.255.255.0 dev eth1
Route add –net 192.168.1.0/24 gw 192.168.1.1
Route add –host 192.168.1.1/32 gw 192.156.1.1
Rc.local is run every time your pc is restarted.
On Linux Gentu, you will find the routing tables under path : /etc/conf.d
edit file local.start
sudo vi /etc/conf.d/local.start