BiagioParuolo
23.04.2009, 09.48
Buongiorno,
ho configurato sotto PROXMOX una VM in KVM mode WIN ed una in OpenVZ Linux.
Tutto è ok. Ho configurato anche gli script, al boot, per ii routing su vmbr0 per le VM in KVM mode.
Configurazione.
OpenVZ: basta inserire l'ip fail-over nel setup della VM in PROXMOX. LA skeda di rete deve esser di tipo venet
KVM:
1) bisogna sull'host # ip route add YOUR_IP_FAILOVER dev vmbr0
2) Sulla VM:
On the guest, if it's Linux:
# ifconfig eth0 YOUR_IP_FAILOVER/32 up # configure interface
# ip route add default dev eth0 # add default route
# echo "nameserver 213.186.33.99" > /etc/resolv.conf # configure DNS^
If it's a different OS (Windows, *BSD, ...), we have to change the commands to have the same effect.
Commands to use with Windows OS:
* configure windows with IP failover. Netmask (255.255.255.255) won't be accepted, so put temporarly "255.255.255.0"
* change netmask with registry editor to avoid problems in the future:
o click on "start" - > "execute"
o write "regedit" and confirm
o search in HKEY_LOCAL_MACHINE\SYSTEM\ key "SubnetMask" with "255.255.255.0" value and change it to "255.255.255.255"
NB: In the current version, there's a known bug, connu, KVM instances don't reeceive unique MAC address. You have to change it with the second virtual KVM server, and it can be done in the configuration file /etc/qemu-server/NNN.conf, NNN being VPS number, and add "macaddr=52:54:00:12:xx:xx" in "network" line. Eg, replace xx:xx with your VPS number to avoid double allocation.
----
Ho modificato lo script indicato da Bago, per il routing al boot
#!/usr/bin/env bash
# Questo script aggiunge il routing per gli IP failover assegnati alle macchine dedicate.
# Basic support for IRIX style chkconfig
###
# chkconfig: 235 49 08
# description: Aggiunge il routing per gli IP assegnati alle macchine dedicate
###
# Basic support for the Linux Standard Base Specification 1.3
# Used by insserv and other LSB compliant tools.
### BEGIN INIT INFO
# Provides: proxmox-Routing
# Required-Start: $network $syslog proxmox
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 6
# Short-Description: Aggiunge il routing per gli IP assegnati alle macchine dedicate
# Description: Aggiunge il routing per gli IP assegnati alle macchine dedicate
### END INIT INFO
# BEGINNING_OF_UTIL_DOT_SH
#!/bin/sh
proxmox_routes_start() {
echo "Starting proxmox Routes... "
while [ "$v" != "1" ];
do
v=$(ifconfig | grep -c vmbr0)
echo "Waiting for vmbr0"
if [ "$v" != "1" ]; then sleep 5; fi
done
if [ -e /etc/proxmox/routes.conf ]; then
for address in `egrep -v "^#" /etc/proxmox/routes.conf | awk '{ print $1 }'`; do
/sbin/ip route add $address dev vmbr0
done
fi
sysctl -p /etc/sysctl.conf
echo "Routes have been added"
}
proxmox_routes_stop() {
echo "Stopping proxmox Routes..."
if [ -e /etc/proxmox/routes.conf ]; then
for address in `egrep -v "^#" /etc/proxmox/routes.conf | awk '{ print $1 }'`; do
/sbin/ip route del $address dev vmbr0
done
fi
echo "Done"
}
case "$1" in
start)
proxmox_routes_start
;;
stop)
proxmox_routes_stop
;;
restart)
proxmox_routes_stop
sleep 1
proxmox_routes_start
;;
*)
echo "Usage: check {start|stop|restart}"
exit 1
esac
exit 0
----
e quindi sotto debian , per farlo inserire come script di boot, eseguire:
chmod 755 /etc/init.d/
ho configurato sotto PROXMOX una VM in KVM mode WIN ed una in OpenVZ Linux.
Tutto è ok. Ho configurato anche gli script, al boot, per ii routing su vmbr0 per le VM in KVM mode.
Configurazione.
OpenVZ: basta inserire l'ip fail-over nel setup della VM in PROXMOX. LA skeda di rete deve esser di tipo venet
KVM:
1) bisogna sull'host # ip route add YOUR_IP_FAILOVER dev vmbr0
2) Sulla VM:
On the guest, if it's Linux:
# ifconfig eth0 YOUR_IP_FAILOVER/32 up # configure interface
# ip route add default dev eth0 # add default route
# echo "nameserver 213.186.33.99" > /etc/resolv.conf # configure DNS^
If it's a different OS (Windows, *BSD, ...), we have to change the commands to have the same effect.
Commands to use with Windows OS:
* configure windows with IP failover. Netmask (255.255.255.255) won't be accepted, so put temporarly "255.255.255.0"
* change netmask with registry editor to avoid problems in the future:
o click on "start" - > "execute"
o write "regedit" and confirm
o search in HKEY_LOCAL_MACHINE\SYSTEM\ key "SubnetMask" with "255.255.255.0" value and change it to "255.255.255.255"
NB: In the current version, there's a known bug, connu, KVM instances don't reeceive unique MAC address. You have to change it with the second virtual KVM server, and it can be done in the configuration file /etc/qemu-server/NNN.conf, NNN being VPS number, and add "macaddr=52:54:00:12:xx:xx" in "network" line. Eg, replace xx:xx with your VPS number to avoid double allocation.
----
Ho modificato lo script indicato da Bago, per il routing al boot
#!/usr/bin/env bash
# Questo script aggiunge il routing per gli IP failover assegnati alle macchine dedicate.
# Basic support for IRIX style chkconfig
###
# chkconfig: 235 49 08
# description: Aggiunge il routing per gli IP assegnati alle macchine dedicate
###
# Basic support for the Linux Standard Base Specification 1.3
# Used by insserv and other LSB compliant tools.
### BEGIN INIT INFO
# Provides: proxmox-Routing
# Required-Start: $network $syslog proxmox
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 6
# Short-Description: Aggiunge il routing per gli IP assegnati alle macchine dedicate
# Description: Aggiunge il routing per gli IP assegnati alle macchine dedicate
### END INIT INFO
# BEGINNING_OF_UTIL_DOT_SH
#!/bin/sh
proxmox_routes_start() {
echo "Starting proxmox Routes... "
while [ "$v" != "1" ];
do
v=$(ifconfig | grep -c vmbr0)
echo "Waiting for vmbr0"
if [ "$v" != "1" ]; then sleep 5; fi
done
if [ -e /etc/proxmox/routes.conf ]; then
for address in `egrep -v "^#" /etc/proxmox/routes.conf | awk '{ print $1 }'`; do
/sbin/ip route add $address dev vmbr0
done
fi
sysctl -p /etc/sysctl.conf
echo "Routes have been added"
}
proxmox_routes_stop() {
echo "Stopping proxmox Routes..."
if [ -e /etc/proxmox/routes.conf ]; then
for address in `egrep -v "^#" /etc/proxmox/routes.conf | awk '{ print $1 }'`; do
/sbin/ip route del $address dev vmbr0
done
fi
echo "Done"
}
case "$1" in
start)
proxmox_routes_start
;;
stop)
proxmox_routes_stop
;;
restart)
proxmox_routes_stop
sleep 1
proxmox_routes_start
;;
*)
echo "Usage: check {start|stop|restart}"
exit 1
esac
exit 0
----
e quindi sotto debian , per farlo inserire come script di boot, eseguire:
chmod 755 /etc/init.d/