Hi folks, Each time booting up the host, VE (guest) starts automatically. However VE can't connect Internet. I have to run on host; [Host]# brctl addif br0 veth101.0 [Host]# vzctl exec 101 dhclient eth0 Then VE can access Internet. [Host]# vzctl exec 101 ping -c3 google.com PING google.com (72.14.207.99) 56(84) bytes of data. 64 bytes from eh-in-f99.google.com (72.14.207.99): icmp_seq=1 ttl=237 time=237 ms 64 bytes from eh-in-f99.google.com (72.14.207.99): icmp_seq=2 ttl=237 time=237 ms 64 bytes from eh-in-f99.google.com (72.14.207.99): icmp_seq=3 ttl=237 time=240 ms --- google.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 10803ms rtt min/avg/max/mdev = 237.328/238.381/240.166/1.268 ms Is there any way to make network connected automatically on booting the VM? Can I set fixed IP on VE Please advise. TIA Pointer would be appreciated. B.R. satimis
You need to use EXTERNAL_SCRIPT= in /etc/vz/vznet.conf http://wiki.openvz.org/Virtual_Ethernet_device#Making_a_brid ged_veth-device_persistent
piavlo wrote on Thu, 21 August 2008 23:35 You need to use EXTERNAL_SCRIPT= in /etc/vz/vznet.conf http://wiki.openvz.org/Virtual_Ethernet_device#Making_a_brid ged_veth-device_persistent Hi piavlo, Thanks for your advice. [Host]# vzctl --version vzctl version 3.0.22 I suppose to follow; method for vzctl version <= 3.0.22 http://wiki.openvz.org/Virtual_Ethernet_device#Making_a_brid ged_veth-device_persistent [Host]# ls -l /etc/vz/conf/ total 20 -rw-r--r-- 1 root root 228 2008-04-21 22:19 0.conf -rw-r--r-- 1 root root 1831 2008-08-21 23:35 101.conf -rw-r--r-- 1 root root 1810 2008-08-21 12:32 101.conf.origin.20080821 -rw-r--r-- 1 root root 1539 2008-04-21 22:19 ve-light.conf-sample -rw-r--r-- 1 root root 1515 2008-04-21 22:19 ve-vps.basic.conf-sample [Host]# locate CTID.conf No printout I can't find this file? [Host]# vzlist -a VEID NPROC STATUS IP_ADDR HOSTNAME 101 3 running - satimis-desktop32 VE 101 is running [Host]# lsmod | grep vzeth vzethdev 14080 0 vzmon 41224 5 vzethdev,vznetdev,vzrst,vzcpt vzdev 4484 4 vzethdev,vznetdev,vzdquota,vzmon [Host]# ls /vz/template/cache/ ubuntu-8.04-i386-minimal.tar.gz [Host]# ls /etc/vz/dists/ | grep ubuntu ubuntu-5.1.conf ubuntu.conf Which of them shall I use? [Host]# grep CONFIGFILE /etc/vz/vz.conf CONFIGFILE="vps.basic" Can I follow; Configuring container creation http://wiki.openvz.org/Configuring_container_creation to run; [Host]# vzctl create CTID creating CTID.conf ??? If YES, then whether I have to stop VE 101 running first? TIA B.R. satimis
Hi, excuse for misleading: /etc/vz/conf/CTID.conf - is the configuration file of your container (/etc/vz/conf/101.conf in our case).
maratrus wrote on Fri, 22 August 2008 23:22 Hi, excuse for misleading: /etc/vz/conf/CTID.conf - is the configuration file of your container (/etc/vz/conf/101.conf in our case). Hi maratrus, I found this file on the VM. [Host]# ls /etc/vz/conf/ 0.conf ve-vps.basic.conf-sample 101.conf ve-light.conf-sample Thanks B.R. satimis
piavlo wrote on Thu, 21 August 2008 23:35 You need to use EXTERNAL_SCRIPT= in /etc/vz/vznet.conf http://wiki.openvz.org/Virtual_Ethernet_device#Making_a_brid ged_veth-device_persistent Hi piavlo, Thanks for your URL. Performed following test but failed; [Host]# nano /etc/vz/conf/101.conf adding following at the end; CONFIG_CUSTOMIZED="yes" VZHOSTBR="br0" [Host]# nano /usr/sbin/vznetaddbr adding following script; #!/bin/bash # /usr/sbin/vznetaddbr # a script to add virtual network interfaces (veth's) in a CT to a bridge on CT0 CONFIGFILE=/etc/vz/conf/$CTID.conf . $CONFIGFILE VZHOSTIF=`echo $NETIF |sed 's/^.*host_ifname=\(.*\),.*$/\1/g'` if [ ! -n "$VZHOSTIF" ]; then echo "According to $CONFIGFILE CT$CTID has no veth interface configured." exit 1 fi if [ ! -n "$VZHOSTBR" ]; then echo "According to $CONFIGFILE CT$CTID has no bridge interface configured." exit 1 fi echo "Adding interface $VZHOSTIF to bridge $VZHOSTBR on CT0 for CT$CTID" /sbin/ifconfig $VZHOSTIF 0 echo 1 > /proc/sys/net/ipv4/conf/$VZHOSTIF/proxy_arp echo 1 > /proc/sys/net/ipv4/conf/$VZHOSTIF/forwarding /usr/sbin/brctl addif $VZHOSTBR $VZHOSTIF exit 0 [Host]# chmod 0500 -c /usr/sbin/vznetaddbr mode of `/usr/sbin/vznetaddbr' changed to 0500 (r-x------) [Host]# nano /etc/vz/vznet.conf adding following; #!/bin/bash EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr" [Host]# vzctl stop 101 Stopping VE ... VE was stopped VE is unmounted [Host]# vzctl start 101 Starting VE ... VE is mounted Setting CPU units: 1000 Configure meminfo: 65536 Set hostname: satimis-desktop32 File resolv.conf was modified Configure veth devices: veth101.0 /usr/sbin/vznetcfg: 20: source: not found VE start in progress... [Host]# brctl show bridge name bridge id STP enabled interfaces br0 8000.000ea6f9a35b no eth0 [Host]# vzctl exec 101 ping -c3 yahoo.com ping: unknown host yahoo.com On googling I found following thread; http://git.openvz.org/?p=vzctl;a=commit;h=a0805eb9ad354899e002f11507e0e3791cf3909f http://bugzilla.openvz.org/show_bug.cgi?id=894 # cp -p /usr/sbin/vznetcfg /usr/sbin/vznetcfg.origin.20080824 - [ -f "$VZNETCFG" ] && source "$VZNETCFG" (delete this line) + [ -f "$VZNETCFG" ] && ."$VZNETCFG (add this line) made change according to advice on above thread but still failed. [Host]# vzctl stop 101 Stopping VE ... VE was stopped VE is unmounted [Host]# vzctl start 101 Starting VE ... VE is mounted Setting CPU units: 1000 Configure meminfo: 65536 Set hostname: satimis-desktop32 File resolv.conf was modified Configure veth devices: veth101.0 /usr/sbin/vznetaddbr: line 6: /etc/vz/conf/.conf: No such file or directory According to /etc/vz/conf/.conf CT has no veth interface configured. /usr/sbin/vznetcfg exited with error VE start failed Stopping VE ... VE was stopped VE is unmounted Also found following thread; http://www.proxmox.com/forum/archive/index.php/t-423.html unfortunately it was discontiued. Please help. TIA B.R. satimis
I think that you should change $CTID to $VEID in all your custom scripts. Probably the naming scheme has changed with vzctl versions newer than 3.0.22 from VE to CT. This is what i've setup #!/bin/bash CONFIGFILE=/etc/vz/conf/$VEID.conf . $CONFIGFILE VZHOSTIF=`echo $NETIF |sed 's/^.*host_ifname=\(.*\),.*$/\1/g'` if [ ! -n "$VZHOSTIF" ]; then echo "According to $CONFIGFILE VE$VEID has no veth interface configured." exit 1 fi if [ ! -n "$BRIDGEDEV" ]; then echo "According to $CONFIGFILE VE$VEID veth interface is not enslaved to any bridge." exit 1 fi ifconfig veth${VEID}.0 0 brctl addif ${BRIDGEDEV} veth${VEID}.0 exit $?
piavlo wrote on Sun, 24 August 2008 21:00 I think that you should change $CTID to $VEID in all your custom scripts. Probably the naming scheme has changed with vzctl versions newer than 3.0.22 from VE to CT. This is what i've setup #!/bin/bash CONFIGFILE=/etc/vz/conf/$VEID.conf . $CONFIGFILE VZHOSTIF=`echo $NETIF |sed 's/^.*host_ifname=\(.*\),.*$/\1/g'` if [ ! -n "$VZHOSTIF" ]; then echo "According to $CONFIGFILE VE$VEID has no veth interface configured." exit 1 fi if [ ! -n "$BRIDGEDEV" ]; then echo "According to $CONFIGFILE VE$VEID veth interface is not enslaved to any bridge." exit 1 fi ifconfig veth${VEID}.0 0 brctl addif ${BRIDGEDEV} veth${VEID}.0 exit $? Hi piavlo, # vzctl --version vzctl version 3.0.22 Old version Tried your script also w/o solution. [Host]# vzctl start 101 Starting VE ... VE is mounted Setting CPU units: 1000 Configure meminfo: 65536 Set hostname: satimis-desktop32 File resolv.conf was modified Configure veth devices: veth101.0 /usr/sbin/vznetcfg: 20: source: not found VE start in progress... Still the same mistake "/usr/sbin/vznetcfg: 20: source: not found" B.R. satimis
Did you actually change $CTID to $VEID in you script? 3.0.22 is the latest versionb available at http://wiki.openvz.org/Download/utils and it works with $VEID If it does not work put set -x at the beginning of your EXTERNAL_SCRIPT and see where exactly is the problem first occurs. And don't just try someone's script, unless you understand exactly for which setup it was written (my was given only as example without describing my network setup).
piavlo wrote on Mon, 25 August 2008 04:33 Did you actually change $CTID to $VEID in you script? 3.0.22 is the latest versionb available at http://wiki.openvz.org/Download/utils and it works with $VEID If it does not work put set -x at the beginning of your EXTERNAL_SCRIPT and see where exactly is the problem first occurs. And don't just try someone's script, unless you understand exactly for which setup it was written (my was given only as example without describing my network setup). Hi piavlo, I also tried the external scrip here including yours. From record; [HN]# vzctl stop 101 Stopping VE ... VE was stopped VE is unmounted The external script; [HN]# cat /usr/sbin/vznetaddbr #!/bin/bash # /usr/sbin/vznetaddbr # a script to add virtual network interfaces (veth's) in a CT to a bridge on CT0 CONFIGFILE=/etc/vz/conf/$VEID.conf . $CONFIGFILE VZHOSTIF=`echo $NETIF |sed 's/^.*host_ifname=\(.*\),.*$/\1/g'` if [ ! -n "$VZHOSTIF" ]; then echo "According to $CONFIGFILE CT$VEID has no veth interface configured." exit 1 fi if [ ! -n "$VZHOSTBR" ]; then echo "According to $CONFIGFILE CT$VEID has no bridge interface configured." exit 1 fi echo "Adding interface $VZHOSTIF to bridge $VZHOSTBR on CT0 for CT$VEID" /sbin/ifconfig $VZHOSTIF 0 echo 1 > /proc/sys/net/ipv4/conf/$VZHOSTIF/proxy_arp echo 1 > /proc/sys/net/ipv4/conf/$VZHOSTIF/forwarding /usr/sbin/brctl addif $VZHOSTBR $VZHOSTIF exit 0 [HN]# vzctl start 101 Starting VE ... VE is mounted Setting CPU units: 1000 Configure meminfo: 65536 Set hostname: satimis-desktop32 File resolv.conf was modified Configure veth devices: veth101.0 /usr/sbin/vznetcfg: 20: source: not found VE start in progress... Same error "/usr/sbin/vznetcfg: 20: source: not found" [HN]# brctl show bridge name bridge id STP enabled interfaces br0 8000.000ea6f9a35b no eth0 Put "set -x" on /etc/vz/vznet.conf [HN]# cat /etc/vz/vznet.conf #!/bin/bash set -x EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr" [HN]# vzctl start 101 Starting VE ... VE is mounted Setting CPU units: 1000 Configure meminfo: 65536 Set hostname: satimis-desktop32 File resolv.conf was modified Configure veth devices: veth101.0 /usr/sbin/vznetcfg: 20: source: not found VE start in progress... Same output as abovementioned. Following thread is relevent to my problem; http://www.proxmox.com/forum/showthread.php?t=423 I use bridge NOT venet. Unfortunately the thread was discontinued. Neither can I figure out how to "delete the assigned IP address (Virtual Network Addresses (venet)) and click save. now you can select bridge." as "tom" mentioned on the thread. B.R. satimis
I meant that you put the set -x in /usr/sbin/vznetaddbr
piavlo wrote on Mon, 25 August 2008 16:41 I meant that you put the set -x in /usr/sbin/vznetaddbr Also tried. Same result "/usr/sbin/vznetcfg: 20: source: not found" [Host]# vzctl start 101 Starting VE ... VE is mounted Setting CPU units: 1000 Configure meminfo: 65536 Set hostname: satimis-desktop32 File resolv.conf was modified Configure veth devices: veth101.0 /usr/sbin/vznetcfg: 20: source: not found VE start in progress... [Host]# cat /usr/sbin/vznetaddbr #!/bin/bash # /usr/sbin/vznetaddbr # a script to add virtual network interfaces (veth's) in a CT to a bridge on CT0 set -x CONFIGFILE=/etc/vz/conf/$VEID.conf . $CONFIGFILE VZHOSTIF=`echo $NETIF |sed 's/^.*host_ifname=\(.*\),.*$/\1/g'` .... Even placing it on top of the file set -x #!/bin/bash # /usr/sbin/vznetaddbr # a script to add virtual network interfaces (veth's) in a CT to a bridge on CT0 CONFIGFILE=/etc/vz/conf/$VEID.conf . $CONFIGFILE VZHOSTIF=`echo $NETIF |sed 's/^.*host_ifname=\(.*\),.*$/\1/g'` .... There was no change on the output. satimis
This appears to be an old thread but for others looking for a straight answer (which this thread doesn't appear to provide) I found a simple solution. In /usr/sbin/vznetcfg you will notice at the top that the script actually tries to call "source" as a command. This should be changed to a . (full stop) instead. This will cause it to source the actual VEID.conf file correctly, remove the error and continue on. Old [ -f "$VZNETCFG" ] && source "$VZNETCFG" New [ -f "$VZNETCFG" ] && . "$VZNETCFG"