Monday, February 9, 2009

how to add multiple gateway's in linux

I saw in windows we can add more gateways the same can we do in linux with command:

linux# route add -net 0.0.0.0/0 gw your_gateway_ip

we can check our routing table with command:
linux# route -n
or
linux# ip route sh

in OpenSuse 11.0 you can read about command "insserv", that is very useful when you want to make a script that is loaded at boot time

OpenSuse 11.0 Example:
---
Make file
linux# vi /etc/init.d/gateway

add there:
#!/bin/sh
route add -net 0.0.0.0/0 gw your_gateway_ip
-- save and close the file

and do also
linux# chmod a+x /etc/init.d/gateway

After that make it to start at boot time: (we cannot put it in /etc/init.d/boot.local because the NIC's aren't up)
linux# insserv -v -d /etc/init.d/gateway

For more details look in documentation.

No comments:

Post a Comment