From: Herbert Poetzl (herbert_at_13thfloor.at)
Date: Wed 19 Nov 2003 - 04:48:01 GMT
On Wed, Nov 19, 2003 at 01:14:58AM +0100, Thomas Hug wrote:
> hi,
>
> On Tue, 18 Nov 2003 20:04, Herbert Poetzl wrote:
>
> > > Is it then possible to install a vserver with another default gateway, eg.
> > > the server has IP address 192.168.3.61, netmask 255.255.255.0 - and uses
> > > default gateway 192.168.3.1 instead ?
> >
> > yes, just setup a separate routing table for
> > the 192.168.3.61 and similar addresses with
> > a default gateway to 192.168.3.1 ...
> >
> > iproute2 magic on the host, nothing else is
> > required ...
>
> is it also possible to make pakets leaving the vserver look like they
> came from the virtual server and not from the host itself?
>
> if i connect out of a virtual host onto some other box, it thinks i'm
> coming from the rootserver...
the following example script shows how to setup
routing based on the 'source' via different tables
(this also allows the get the 'right' address in
different servers, at least it works for me ;)
EXTNET1="aaa.bbb.ccc.0/28"
EXTDEV1="eth0"
EXTDG1="aaa.bbb.ccc.1"
ip route add $EXTNET1 dev $EXTDEV1 table extern1
ip route add default via $EXTDG1 dev $EXTDEV1 table extern1
ip rule add from $EXTNET1 table extern1
EXTNET2="ddd.eee.fff.0/24"
EXTDEV2="eth0"
EXTDG2="ddd.eee.fff.42"
ip route add $EXTNET2 dev $EXTDEV2 table extern2
ip route add default via $EXTDG2 dev $EXTDEV2 table extern2
ip rule add from $EXTNET2 table extern2
ip route delete default
additionally you need:
/etc/iproute2/rt_tables:
11 extern1
12 extern2
each vserver has then a setup like this
IPROOT="eth0:aaa.bbb.ccc.17"
IPROOTMASK="255.255.255.224"
IPROOTBCAST="aaa.bbb.ccc.63"
IPROOTDEV="eth0"
or this ...
IPROOT="eth0:ddd.eee.fff.213"
IPROOTMASK="255.255.255.0"
IPROOTBCAST="ddd.eee.fff.255"
IPROOTDEV="eth0"
HTH,
Herbert
PS: maybe this should get into some docu?
> -tom
> _______________________________________________
> Vserver mailing list
> Vserver_at_list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver
_______________________________________________
Vserver mailing list
Vserver_at_list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver