RE: [vserver]

About this list Date view Thread view Subject view Author view Attachment view

From: Martin Josefsson (
Date: Mon Feb 25 2002 - 13:49:09 EST

On Mon, 25 Feb 2002, Wray Cason wrote:

> > > I have servers with multiple ethernet interfaces. I have
> > > found that without
> > > a NAT workaround, I can't get proper default routing for all
> > > vservers as
> > > some are bound to the interface with the actual default
> > > gateway and other
> > > aren't and therefore can't reach the default gateway. Is
> > > this a question
> > > that is being addressed? Alternatively, am I missing
> > > something? Thanks.
> >
> > Sorry, I'm not an expert on this area but you can select which
> > ethernet interface a vs binds to via the /etc/vservers/ conf
> > file. I'd have thought that you can set the default gateway
> > within each vs or it would be picked up from the eth settings?
> >
> > J
> Can default routes be set within each vserver? That would be exactly what I
> need. That can't be done as far as I know. The base server routing is
> useless since the vserver is made unaware of all networks except the one it
> is bound to.

No you can't set default routes in vserver
what you need is somewhat more advanced routing in the real server.

say that you have eth0 which is the default interface for which you have a
default gateway configured and now you want a vserver to use eth1 instead,
then maybe somethine like this can help.

ip rule add from <ipthevserverisusing> table 200

ip route add <network on that interface> dev eth1 table 200
ip route add default via <default gateway for this interface> dev eth1 table 200

replace <ipthevserverisusing> with the ipaddress the vserver is using.
<network on that interface> is something like
<default gateway for this interface> is maybe ? replace with
actual default gateway.

if you have several vserver that should use eth1 but diffrent ipaddresses
and those addresses are located in the same subnet you can add more
'ip rule' rows, one for each ip.

and if you have vserver that use an ipaddress on eth1 that's part of
another subnet you have to add all these 3 rules but change the table
number from 200 to something diffrent, say 201.

I hope this helps.


Never argue with an idiot. They drag you down to their level, then beat you with experience.

About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.4 : Mon Aug 19 2002 - 12:01:01 EDT