LinuxQuestions.org

LinuxQuestions.org (http://www.linuxquestions.org/questions/index.php)
-   Linux - Networking (http://www.linuxquestions.org/questions/forumdisplay.php?f=3)
-   -   multiple gateways on a server. (http://www.linuxquestions.org/questions/showthread.php?t=4175450793)

Gil@LQ 02-19-2013 08:26 AM

multiple gateways on a server.
 
hi,

i'm running CentOS 6.3, pc has 2 nic,

192.168.80.10 --nic 1 connected to my lan
192.168.1.10 --nic 2 connectedt wifi router (internet)

Linux router
192.168.60.254 ---nic 1
192.168.70.254 ---nic 2
192.168.80.254 ---nic 3
192.168.90.254 ---nic 4


my situation is , i'm running squid on it so working fine, i have to add a hdd to this pc and turn in to NAS for my lan 192.168.80.0/24. every thing seems fine. Bad luck is i have i have to provide NAS connectivity to 192.168.90.0/24 network..

in my network we use a linux gateway server with 4 lan cards for each network. if a pc from 192.168.80.0 has to ping 192.168.90.0 network , traffic has to go via 192.168.20.254 (linux router)

Since i have to use 192.168.1.1 as default gw for internet which is wifi routers ip, i can't use 192.168.80.254 as gateway and this NAS server can't communicate 90 series network,

so please tel me how to use two gateways (192.168.80.254 and 192.168.1.1 ) in one system

can iptables help sending traffic to 90 series network via 192.168.80.254 (my network gateway)...

Thank you very much in advance.

acid_kewpie 02-19-2013 08:44 AM

Can't quite get my head around what you're LAN looks like (where id thie 192.168.20.0 subnet come from?) but I doubt it matters. You can easily add a route to 192.168.90.0/24:

route add -net 192.168.90.0 netmask 255.255.255.0 gw 192.168.80.254

Job done. You can also set up a routing file to persistently store this

http://www.centos.org/docs/5/html/5....ic-routes.html

Gil@LQ 02-20-2013 05:34 AM

1 Attachment(s)
hi acid_kewpie,

you really rock, yesterday i've gone throug IP ROUTE, seen route add also, but i added around 10-15 time, so messed up entirely and working fine, now.
Quote:

sorry fo 192.168.20.0, it supposed to be 192.168.80.254 (one nic out of four attached to linux router)
, i added rest of the three networks to it.

Quote:

route add -net 192.168.90.0 netmask 255.255.255.0 gw 192.168.80.254
route add -net 192.168.60.0 netmask 255.255.255.0 gw 192.168.80.254
route add -net 192.168.70.0 netmask 255.255.255.0 gw 192.168.80.254
And also to make them persistant, i gone through your link but found little confused ,so followed

http://unixfoo.blogspot.in/2009/05/c...-route-in.html

Quote:

GATEWAY0=192.168.80.254
NETMASK0=255.255.255.0
ADDRESS0=192.168.60.0

GATEWAY1=192.168.80.254
NETMASK1= 255.255.255.0
ADDRESS1=192.168.70.0

GATEWAY2=192.168.80.254
NETMASK2= 255.255.255.0
ADDRESS3=192.168.90.0
but when i searched to know more aboue route add, some of them mentioned dev eth0 / eth1 etc...

if you don't mind, can you tell me what exactly thig command does, because they given workaround not the real descritpion.

attached pic gives you clear picutre, please find it and let me know any other best way there to do it.

thank you very much....


All times are GMT -5. The time now is 12:44 AM.