OpenVZ Forum


Home » General » Support » Handle ip from inside VE
Handle ip from inside VE [message #22121] Sun, 21 October 2007 16:18 Go to next message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
Is there a way to add and remove VE ip from inside VE ? (may be there is special vzctl capability)
Re: Handle ip from inside VE [message #22132 is a reply to message #22121] Mon, 22 October 2007 06:17 Go to previous messageGo to next message
piavlo is currently offline  piavlo
Messages: 159
Registered: January 2007
Senior Member
dagr wrote on Sun, 21 October 2007 18:18

Is there a way to add and remove VE ip from inside VE ? (may be there is special vzctl capability)

You can use veth device instead of venet
http://wiki.openvz.org/Differences_between_venet_and_veth
http://wiki.openvz.org/Veth
Re: Handle ip from inside VE [message #22136 is a reply to message #22132] Mon, 22 October 2007 07:59 Go to previous messageGo to next message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
i checked http://wiki.openvz.org/Virtual_Ethernet_device#Making_a_veth -device_persistent

And found out problem - to make IP work i need to run on HN

ip route add 192.168.0.101 dev veth101.0

And when i move this IP to another VPS - i will need to change routes on HNs.


My goal is to exclude any need to make changes on HN side.
Lets say i have 2 VEs with db and standby: A and B . Each has main ip - ip_A and ip_B.
And also they have migrating production IP (for switchover).
What i want if to be able to migrate prod_ip from A to B and back running commands from inside VEs. (without any access to HNs ssh or else, though VEs have access to each other). Is it possible ?


P.S - Actually changing routes isnt necessary if there are no clients on same HNs which need communicate to prod_ip. In this case it would be possible just to make ifdown/ifup eth0:1 inside VEs. Still i found out problem with arp announce during ifup. I can see it via tcpdump inside VE but not on HN interface. Ie clients cant refresh their arp cache.
i have
/proc/sys/net/ipv4/conf/eth0/proxy_arp
/proc/sys/net/ipv4/conf/eth0/forwarding
/proc/sys/net/ipv4/conf/vethX/proxy_arp
/proc/sys/net/ipv4/conf/vethX/forwarding
set to 1.
I also tried to set
/proc/sys/net/ipv4/conf/.../arp_announce to 1 - but no result.
How do i make HN to retransmit arp announce ?

[Updated on: Mon, 22 October 2007 09:37]

Report message to a moderator

Re: Handle ip from inside VE [message #22138 is a reply to message #22136] Mon, 22 October 2007 10:05 Go to previous messageGo to next message
piavlo is currently offline  piavlo
Messages: 159
Registered: January 2007
Senior Member
Actually I don't know why the wiki suggests to use proxy_arp
and add static routes on the bridge device. Besides a minimal
speedup proxy_arp may give, i see no more dvantages, only disadvantages like you stated then you want to move VE from one HN to another HN, all the hosts in the LAN will need their arp entries updated.
So in my setup i have a default transparent bridging setup with
proxy_arp and forwarding disabled, thus then the the VE is moved between HNs it's transparent for the VE clients in the LAN.
The only thing you need to be careful about is to make sure
the real ethX device has the smallest mac address among
all veth's enslaved to the bridge.
See http://forum.openvz.org/index.php?t=tree&goto=22118& #msg_22118
Re: Handle ip from inside VE [message #22139 is a reply to message #22138] Mon, 22 October 2007 10:59 Go to previous messageGo to next message
dagr is currently offline  dagr
Messages: 83
Registered: February 2006
Member
i suppose proxy_arp is arp transmit feature , cause i cant ping veth ip until set proxy_arp to 1. Same when simply using veth or with bridging .

[Updated on: Mon, 22 October 2007 11:01]

Report message to a moderator

Re: Handle ip from inside VE [message #22165 is a reply to message #22139] Mon, 22 October 2007 17:58 Go to previous message
piavlo is currently offline  piavlo
Messages: 159
Registered: January 2007
Senior Member
http://en.wikipedia.org/wiki/Proxy_ARP

If it might help , this is my network configuration for bridge:
projsrv1 ~ # cat /etc/vz/vznet.conf 
#!/bin/bash

EXTERNAL_SCRIPT="/etc/vz/bin/vzbridge.add"
projsrv1 ~ # cat /etc/vz/bin/vzbridge.add 
#!/bin/bash

CONFIGFILE=/etc/vz/conf/$VEID.conf
. $CONFIGFILE
VZHOSTIF=`echo $NETIF |sed 's/^.*host_ifname=\(.*\),.*$/\1/g'`

BRIDGED_VES_REGEXP='(101|102|103)'
echo "$VEID" | egrep -e "$BRIDGED_VES_REGEXP" > /dev/null
if [ "$?" == "0" ]; then

        if [ ! -n "$VZHOSTIF" ]; then
                echo "According to $CONFIGFILE VE$VEID has no veth interface configured."
                exit 1
        fi

        ifconfig veth${VEID}.0 0
        brctl addif br0 veth${VEID}.0
        exit $?
fi

exit 0
projsrv1 ~ #

The eth0 is enslaved to br0

[Updated on: Mon, 22 October 2007 18:00]

Report message to a moderator

Previous Topic: Failover active/active Questions
Next Topic: NFS mounts disappearing from OAS servers
Goto Forum:
  


Current Time: Sat Nov 16 08:45:12 GMT 2024

Total time taken to generate the page: 0.03253 seconds