OpenVZ Forum


Home » General » Support » multiple NICs on Different Networks with different default gateways
multiple NICs on Different Networks with different default gateways [message #2749] Wed, 19 April 2006 14:29 Go to next message
zerodni is currently offline  zerodni
Messages: 5
Registered: April 2006
Junior Member
From: *tnwebhost.com
I have a Openvz host box that has 3 NICs in it on three different networks. I'm trying to setup vps's to connect to different default gateways depending on what ip address i have given them. For example one vps is setup with a ip address of 192.168.1.25 with the default gateway of that network being 192.168.1.1 and another vps is setup with the ip address 192.168.2.25 with the default gateway of that network being 192.168.2.1. When i setup the vps now i can connect to them from the out side world no problem. But inside the vps i cant ping out if the the vps network is different than the network where i setup my default gateway on the host. For example my default gateway on the host is setup with 192.168.1.1 and the vps on 192.168.1.25 can get out but the vps on 192.168.2.25 can't ping out but i can ping in to both of them from the out side network

Thanks for any Help that you can give me
Re: multiple NICs on Different Networks with different default gateways [message #2774 is a reply to message #2749] Thu, 20 April 2006 08:10 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

From: *sw.ru
I suppose you need SRC routing:
http://forum.openvz.org/index.php?t=msg&goto=1631&&a mp;a mp;srch=src+routing#msg_1631

does it help?


http://static.openvz.org/userbars/openvz-developer.png

[Updated on: Thu, 20 April 2006 08:11]

Report message to a moderator

Re: multiple NICs on Different Networks with different default gateways [message #2782 is a reply to message #2774] Thu, 20 April 2006 15:53 Go to previous messageGo to next message
zerodni is currently offline  zerodni
Messages: 5
Registered: April 2006
Junior Member
From: *tnwebhost.com
that would work for one ip but im really looking for a way to have all vps with the ip of 192.168.2 as their network go to the gateway of 192.168.2.1 with out having to setup a route on the host for every ip address used on the gateway that solution would work if it was just one vps that need to have a different default gateway but there will be lots of vps being created and destroyed on the three different networks and keeping up with the ip src routes by hand would not be feasible the main thing im looking for is all vps on this subnet of 192.168.2.0 will go to the gateway of 192.168.2.1 and the same for the 192.168.1.0 going to the gateway of 192.168.1.1 i tried something like this
http://www.debian-administration.org/articles/377
but it messed up something in openvz

Thanks
Re: multiple NICs on Different Networks with different default gateways [message #2794 is a reply to message #2782] Fri, 21 April 2006 08:38 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

From: *sw.ru
what prevents you from netmask?
just specify not a single IP, but IP/netmask
Or did I get something wrong?


http://static.openvz.org/userbars/openvz-developer.png
Re: multiple NICs on Different Networks with different default gateways [message #2808 is a reply to message #2794] Fri, 21 April 2006 15:29 Go to previous messageGo to next message
zerodni is currently offline  zerodni
Messages: 5
Registered: April 2006
Junior Member
From: *tnwebhost.com
the main reason is that i have have three backbones that the server is connected to and i want to have vps on each backbone and having no connection to the others for example i want to make a vps on the the 192.168.1.1 network because that will be a box on the trusted network on its own backbone for example a T1 line then make another vps on the 192.168.2.1 network that is the oc-48 line and another vps on the 192.168.3.1 network that is a T-3 line and if the T1 dies i don't want the servers setup on the oc-48 line to stop working just because i have the t-1 line set as my default gateway. and i want to make allot of these vps on the different networks as needed

Thanks for all your help
Re: multiple NICs on Different Networks with different default gateways [message #2829 is a reply to message #2808] Sat, 22 April 2006 08:16 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

From: *7ka.mipt.ru
do you want VPS using T1 to switch to oc-48/T3 if T1 dies?
if not, this is exactly what I suggested.

you setup a rules, so that:
1. all IPs 192.168.1.0/24 go through 192.168.1.1 (T1)
2. all IPs 192.168.2.0/24 go through 192.168.2.1 (oc-48)
2. all IPs 192.168.3.0/24 go through 192.168.3.1 (T3)
and that's it.

The only changes to the proposed scheme I gave you are required if you want T1 users to be able to switch to backup line, e.g. oc-48 or T3 in case of failure.


http://static.openvz.org/userbars/openvz-developer.png
Re: multiple NICs on Different Networks with different default gateways [message #2880 is a reply to message #2829] Mon, 24 April 2006 18:20 Go to previous messageGo to next message
zerodni is currently offline  zerodni
Messages: 5
Registered: April 2006
Junior Member
From: *tnwebhost.com
not so much as im looking for vps that are on the t1 network to work by them selves and the the oc line vps to work by themselves because for some reason when the t1 is unplugged the vps on the oc line stop working because of the host system being set to have the t1 as the default gateway basically im trying to build 2 separate networks inside of the vps host system.

Thanks for all you help
Re: multiple NICs on Different Networks with different default gateways [message #2881 is a reply to message #2880] Mon, 24 April 2006 20:06 Go to previous messageGo to next message
Antarion is currently offline  Antarion
Messages: 17
Registered: December 2005
Location: Huerth
Junior Member
From: *inaddr.intergenia.de
I've been working on a similar setup for quite a while now, heres what i've got - it already comes pretty close to what i want. Just remember, these are my first steps with iproute2 and routing in general Very Happy

My hostnode does have two NIC's, eth0 which does have a vlan covering the 62.75.xxx.yyy/24 range, eth1 which does have a vlan covering the 217.172.xxx.yyy/24 range.

Heres my CURRENT setup:

# flush everything
ip route flush cache

# set default routes for table 1 & 2
ip route add default via 62.75.xxx.1 dev eth0 tab 1
ip route add default via 217.172.xxx.1 dev eth1 tab 2


# add IP's within 62.75.xxx.0/24 to be used by VE's
ip rule add from 62.75.xxx.0/24 tab 1 priority 500

# Routing to VE's in the other "vlan"
# otherwise loop between hostnode
# and our default gateway (?!?!)
ip rule add from 62.75.xxx.0/24 iif venet0 lookup main

# add IPs within 217.172.xxx.0/24 to be used by VE's
ip rule add from 217.172.xxx.0/24 tab 2 priority 600

# Routing to VE's in the other "vlan"
# otherwise loop between hostnode
# and our default gateway (?!?!)
ip rule add from 217.172.xxx.0/24 iif venet0 lookup main

# ---- not sure if this is needed ----
ip route del default
ip route del default
ip route add default via 217.172.xxx.1 dev eth1

Maybe that helps, if you've got any suggestions let me know please! Smile

-Torsten
Re: multiple NICs on Different Networks with different default gateways [message #3592 is a reply to message #2881] Tue, 06 June 2006 14:07 Go to previous messageGo to next message
zerodni is currently offline  zerodni
Messages: 5
Registered: April 2006
Junior Member
From: *tnwebhost.com
i was just wondering what the output is from the route command with this configuration

Thanks
Jacob
Re: multiple NICs on Different Networks with different default gateways [message #4656 is a reply to message #2749] Thu, 20 July 2006 17:44 Go to previous message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

From: 216.208.38*
This thread is summarised on wiki:Source based routing.

Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Previous Topic: add several ips
Next Topic: *SOLVED* Moving default NIC
Goto Forum:
  


Current Time: Sat Apr 20 22:34:12 GMT 2019