Re: [vserver] How to ensure that host gets the primary ip address?

From: Herbert Poetzl <herbert_at_13thfloor.at>
Date: Wed 30 Jun 2010 - 11:21:56 BST
Message-ID: <20100630102156.GJ654@MAIL.13thfloor.at>

On Wed, Jun 30, 2010 at 09:35:39AM +0200, Thomas Gebhardt wrote:
> Hello,

> somehow I got into the situation that the ip address of the
> Host is secondary and a VServer gets the primary address:

that basically means that the host IP was removed from
the interface (at some point) and added back at a time
where the guest was already running (or at least the
guest IP was configured)

> # ip addr ls
> ...
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
> state UP qlen 1000
> link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
> -> inet <vserver1-ip>/24 brd <brdcast-ip> scope global eth0
> inet <vserver2-ip>24 brd <brdcast-ip> scope global secondary eth0
> -> inet <host-ip>/24 brd <brdcast-ip> scope global secondary eth0
> inet <vserver3-ip>/24 brd <brdcast-ip> scope global secondary eth0
> ...
> ...
> 4: vlan71@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
> state UP
> link/ether 00:04:23:d6:b4:a8 brd ff:ff:ff:ff:ff:ff
> inet <vserver6-ip>/25 brd <brdcast2-ip> scope global vlan71
> ...

> * I have the sysctl setting "net.ipv4.conf.all.promote_secondaries=1",
> so the host will not get offline when I shutdown vserver1.
> * The hostname of the host resolves to host-ip.

sounds good :)

> Nethertheless, ssh connections from the host get vserver1-ip as
> its src address, obviously because vserver1-ip is the primary
> ip address of the eth0 interface.

yep, expected behaviour ...

> I can fix this by the BindAddress directive in ssh_config,
> but this is just a workaroud for ssh and I don't know
> whether other services will be affected, too.

> A much cleaner solution would be to "pin" the primary role
> to the host ip.

well, just avoid bringing down the host IP when guests
are running (guest IPs are configured) and you should
be fine, the first one will be primary and stay primary

> Any idea how to achieve that and/or how to swap the primary
> and secondary role of the ip adresses in my current situation?

the same way you got into that situation, remove the
'primary' and the next secondary will become primary.
do that till the host-ip is the lucky winner, then add
back the guest IPs to make the guest services happy again

best,
Herbert

> Thanks, Thomas
Received on Wed Jun 30 11:23:41 2010

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Wed 30 Jun 2010 - 11:23:46 BST by hypermail 2.1.8