| [*SOLVED*] Assigning IP from within a VE [message #31194] |
Fri, 20 June 2008 14:36  |
seanfulton
Messages: 105 Registered: May 2007
|
Senior Member |
|
|
Folks, I have spent nearly a year struggling with VETH (instead of venet) to try to create an environment that would allow me to use heartbeat between two VEs in order to provide automated fail-over of services within a VE.
I got as far as getting VETH and a bridge working, quagga running inside the VE, but was unable to set an IP address within the VE that I could pass via RIP to the fail-over VE in the event of a service failure.
Last night I found a very simple solution on another list and have a working configuration up in less than an hour.
For the benefit of anyone who has searched this list in need of a similar solution, I have copied and pasted below a solution written by Dr. Michael Schwartzkopff of MultiNET Services GmbH. I hope you find it useful.
Here is a link to the original thread:
http://www.gossamer-threads.com/lists/linuxha/users/47495
Hi,
the problem is that a virtual machine cannot change its IP address by its own.
As far as I understood OpenVZ this always has to be done by the host with
vzctl set <machine> --ipaddr ....
This os of course a little problem if the virtual machine wants to control it
cluster IP address. Therefor I modified the IPaddr2 resource agent that it
communicates with the host to change its own IP address. In function
add_interface() of the resource agent I added:
echo "101 add 192.168.189.33" | /bin/nc 192.168.189.199 7564
and corresponding:
echo "101 del 192.168.189.33" | /bin/nc 192.168.189.199 7564
in function delete_interface
On the host side (192.168.188.199) I have a server listing on port 7564. The
program vzip.sh is very simple:
#!/bin/bash
read vps operation ip
echo "on " $vps " do " $operation " " $ip >> /tmp/log.log
CMD="/usr/sbin/vzctl set $vps --ip$operation $ip"
echo $CMD >> /tmp/log.log
$CMD
This program is startet by inetd with the following line in inetd.conf:
vzip stream tcp nowait root /root/vzip.sh
and
vzip tcp/7564
in /etc/services
I know the is a very rude solution and need much improvement to be
generalized. But it works for me. If there is any interest by others I could
improve it further so more people could use it. Please mail me.
Cheers,
--
Dr. Michael Schwartzkopff
MultiNET Services GmbH
Addresse: Bretonischer Ring 7; 85630 Grasbrunn; Germany
Tel: +49 - 89 - 45 69 11 0
Fax: +49 - 89 - 45 69 11 21
mob: +49 - 174 - 343 28 75
mail: misch[at]multinet.de
web: www.multinet.de
|
|
|
|
|
|