Migration of OpenVZ Containers

Extcee

Active Member
Apr 11, 2011
50
1
26
Hi,

I have migrated one of my OpenVZ containers this morning to my new infrastructure.

Old server was on a 192.168.0.* subnet, the VZ container on 192.168.0.12

New server is on a 10.10.1.* subnet, and I want the OpenVZ container still on 192.168.0.12.

I have put eth0 on my node into a Trunk Port, tagging the VLANs required, this works for KVM VM's, as they come up on the correct network.

Have done a little digging around and found the following command:
Code:
[FONT=Menlo]root@proxnode2:~# vzctl set 102 --netif_add adm100,,,,venet0-00v100 --save[/FONT][FONT=Menlo]Configure veth devices: veth102.100 [/FONT]
[FONT=Menlo]According to /etc/pve/openvz/102.conf, CT102 has no veth interface configured.[/FONT]
[FONT=Menlo]/usr/sbin/vznetcfg exited with error[/FONT]
[FONT=Menlo]Error: failed to apply some parameters, not saving configuration file![/FONT]

My VLAN here is VLAN 100, but I just can't figure out why no veth interface is shown.

From the OVZ container:
Code:
[FONT=Menlo]root@proxnode2:~# cat /var/lib/vz/private/102/etc/network/interfaces [/FONT][FONT=Menlo]# This configuration file is auto-generated.[/FONT]
[FONT=Menlo]#[/FONT]
[FONT=Menlo]# WARNING: Do not edit this file, your changes will be lost.[/FONT]
[FONT=Menlo]# Please create/edit /etc/network/interfaces.head and[/FONT]
[FONT=Menlo]# /etc/network/interfaces.tail instead, their contents will be[/FONT]
[FONT=Menlo]# inserted at the beginning and at the end of this file, respectively.[/FONT]
[FONT=Menlo]#[/FONT]
[FONT=Menlo]# NOTE: it is NOT guaranteed that the contents of /etc/network/interfaces.tail[/FONT]
[FONT=Menlo]# will be at the very end of this file.[/FONT]
[FONT=Menlo]#[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]# Auto generated lo interface[/FONT]
[FONT=Menlo]auto lo[/FONT]
[FONT=Menlo]iface lo inet loopback[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]# Auto generated venet0 interface[/FONT]
[FONT=Menlo]auto venet0[/FONT]
[FONT=Menlo]iface venet0 inet manual[/FONT]
[FONT=Menlo]	up ifconfig venet0 up[/FONT]
[FONT=Menlo]	up ifconfig venet0 127.0.0.2[/FONT]
[FONT=Menlo]	up route add default dev venet0[/FONT]
[FONT=Menlo]	down route del default dev venet0[/FONT]
[FONT=Menlo]	down ifconfig venet0 down[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]iface venet0 inet6 manual[/FONT]
[FONT=Menlo]	up route -A inet6 add default dev venet0[/FONT]
[FONT=Menlo]	down route -A inet6 del default dev venet0[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]auto venet0:0[/FONT]
[FONT=Menlo]iface venet0:0 inet static[/FONT]
[FONT=Menlo]	address 10.10.1.62[/FONT]
[FONT=Menlo]	netmask 255.255.255.255[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]root@proxnode2:~# [/FONT]

Sorry I am a bit new to OpenVZ containers and their networking..

Just wondering if someone can point me in the right direction?

If all else fails I think i might try following: http://www.robthomson.me.uk/2011/02/10/migrating-openvz-to-kvmzenvmware/

Just so I can keep my CTs alive as I need to decommission the old Prox setup soon.

Thanks again everyone for all your hard-work and knowledge.
 
I would create a bridge configured with the correct VLAN and then assign this bridge to the CT. Eg. leave the VLAN tagging to the bridge a keep the interface configuration as is in the CT.
 
Sorry, I am bit new to this..

I have edited my vz.conf file like kotakomputer has suggested..

How would one create a bridge (in the Prox node I'm assuming? Anyway tried from here and get: Parameter verification failed. (400) gateway: Default gateway already exists on interface 'eth1'. )

Also how would I assign this to my VZ container?

Im sorry my knowledge here is a bit low, I'm quite new to OpenVZ.

Thanks again everyone, its really appreciated.
 
Hey kotakomputer thanks for your post.

If i set up a route, as listed in your linked post, I can see this VM and ping it.. however, I can't see this from outside the Prox node.

I already have 2 KVM-VM's set up using VLAN tagging in the 100 VLAN, which I am trying to add to my OVZ.

Here is my ifconfig
Code:
[FONT=Menlo]root@proxnode1:~# ifconfig[/FONT][FONT=Menlo]eth0      Link encap:Ethernet  HWaddr 00:26:9e:b5:e1:f0  [/FONT]
[FONT=Menlo]          inet6 addr: fe80::226:9eff:feb5:e1f0/64 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1[/FONT]
[FONT=Menlo]          RX packets:152914114 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:146652494 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:1000 [/FONT]
[FONT=Menlo]          RX bytes:144687405949 (134.7 GiB)  TX bytes:135197502151 (125.9 GiB)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]eth1      Link encap:Ethernet  HWaddr 00:26:9e:b5:e1:f1  [/FONT]
[FONT=Menlo]          inet addr:10.10.***.111  Bcast:10.10.142.255  Mask:255.255.255.0[/FONT]
[FONT=Menlo]          inet6 addr: fe80::226:9eff:feb5:e1f1/64 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST RUNNING MULTICAST  MTU:9000  Metric:1[/FONT]
[FONT=Menlo]          RX packets:14425163 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:13007550 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:1000 [/FONT]
[FONT=Menlo]          RX bytes:44173522112 (41.1 GiB)  TX bytes:51293304732 (47.7 GiB)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]eth0.1100 Link encap:Ethernet  HWaddr 00:26:9e:b5:e1:f0  [/FONT]
[FONT=Menlo]          inet6 addr: fe80::226:9eff:feb5:e1f0/64 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1[/FONT]
[FONT=Menlo]          RX packets:0 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:2945 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:0 [/FONT]
[FONT=Menlo]          RX bytes:0 (0.0 B)  TX bytes:391985 (382.7 KiB)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]lo        Link encap:Local Loopback  [/FONT]
[FONT=Menlo]          inet addr:127.0.0.1  Mask:255.0.0.0[/FONT]
[FONT=Menlo]          inet6 addr: ::1/128 Scope:Host[/FONT]
[FONT=Menlo]          UP LOOPBACK RUNNING  MTU:16436  Metric:1[/FONT]
[FONT=Menlo]          RX packets:98646 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:98646 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:0 [/FONT]
[FONT=Menlo]          RX bytes:85353729 (81.3 MiB)  TX bytes:85353729 (81.3 MiB)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]tap301i0  Link encap:Ethernet  HWaddr 62:e0:39:61:15:ce  [/FONT]
[FONT=Menlo]          inet6 addr: fe80::60e0:39ff:fe61:15ce/64 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1[/FONT]
[FONT=Menlo]          RX packets:1481 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:388 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:500 [/FONT]
[FONT=Menlo]          RX bytes:279584 (273.0 KiB)  TX bytes:25680 (25.0 KiB)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  [/FONT]
[FONT=Menlo]          inet6 addr: fe80::1/128 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1[/FONT]
[FONT=Menlo]          RX packets:0 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:0 errors:0 dropped:3 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:0 [/FONT]
[FONT=Menlo]          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]vmbr0     Link encap:Ethernet  HWaddr 00:26:9e:b5:e1:f0  [/FONT]
[FONT=Menlo]          inet addr:10.10.1.51  Bcast:10.10.1.255  Mask:255.255.255.0[/FONT]
[FONT=Menlo]          inet6 addr: fe80::226:9eff:feb5:e1f0/64 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1[/FONT]
[FONT=Menlo]          RX packets:152147594 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:71589976 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:0 [/FONT]
[FONT=Menlo]          RX bytes:142504985903 (132.7 GiB)  TX bytes:130242100086 (121.2 GiB)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]vmbr0v1100 Link encap:Ethernet  HWaddr 00:26:9e:b5:e1:f0  [/FONT]
[FONT=Menlo]          inet6 addr: fe80::60a0:ddff:fedc:9bd9/64 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1[/FONT]
[FONT=Menlo]          RX packets:1403 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:0 [/FONT]
[FONT=Menlo]          RX bytes:270499 (264.1 KiB)  TX bytes:468 (468.0 B)[/FONT]
[FONT=Menlo]

I have set neighbour_devs=all but I still can't ping this VM inside my Prox node, our out.

N.B my 10.10.***.111 interface is my connection to my SAN, so all "normal" traffic comes through eth0 (well vmbr0 as Prox has used this for it's own thing)

As I said a little up VLAN tagging on my 192.168.0.0 (VLAN 100) subnet works on KVM VM's, so I am just trying to figure out how I can apply this to the OVZ CT's that exist on VLAN 100.

Again, your help is greatly appreciated..[/FONT]
 
Hi kotakomputer

I have tried what you have said, and I still can't get this to work..

I have edited the conf and restarted the vz service.

I tried to add a bridged interface (vmbr100) on my prox node on my 192.168.0.0/24 subnet and then create a veth device (eth0) bridged to vmbr100 but I still can't see the device from inside my node our outside.. A few posts up there was a link you kindly posted, and in there, i believe deitmar states adding in a static route (route add -net 192.168.0.0 netmask 255.255.255.0 dev vmbr0) when adding this route in I can ping my OVZ CT on its address (192.168.0.12), but can't see it from outside the node, also I can't see any other devices on the 192.168.0.0/24 subnet as the static route has overridden this.

When adding my vmbr100 device on the 192.168.0.0/24 subnet I couldn't see this also from outside my Prox node.

my current ifconfig (removing the vmbr100 device i created)
Code:
[FONT=Menlo]root@proxnode2:/# ifconfig[/FONT]
[FONT=Menlo]eth0      Link encap:Ethernet  HWaddr c8:0a:a9:03:4b:f8  [/FONT]
[FONT=Menlo]          inet6 addr: fe80::ca0a:a9ff:fe03:4bf8/64 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1[/FONT]
[FONT=Menlo]          RX packets:200543 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:136254 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:1000 [/FONT]
[FONT=Menlo]          RX bytes:31014862 (29.5 MiB)  TX bytes:26176864 (24.9 MiB)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]eth1      Link encap:Ethernet  HWaddr c8:0a:a9:03:4b:f9  [/FONT]
[FONT=Menlo]          inet addr:10.10.142.112  Bcast:10.10.142.255  Mask:255.255.255.0[/FONT]
[FONT=Menlo]          inet6 addr: fe80::ca0a:a9ff:fe03:4bf9/64 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST RUNNING MULTICAST  MTU:9000  Metric:1[/FONT]
[FONT=Menlo]          RX packets:136686 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:158452 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:1000 [/FONT]
[FONT=Menlo]          RX bytes:223793611 (213.4 MiB)  TX bytes:16904289 (16.1 MiB)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]lo        Link encap:Local Loopback  [/FONT]
[FONT=Menlo]          inet addr:127.0.0.1  Mask:255.0.0.0[/FONT]
[FONT=Menlo]          inet6 addr: ::1/128 Scope:Host[/FONT]
[FONT=Menlo]          UP LOOPBACK RUNNING  MTU:16436  Metric:1[/FONT]
[FONT=Menlo]          RX packets:26651 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:26651 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:0 [/FONT]
[FONT=Menlo]          RX bytes:13231291 (12.6 MiB)  TX bytes:13231291 (12.6 MiB)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  [/FONT]
[FONT=Menlo]          inet6 addr: fe80::1/128 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1[/FONT]
[FONT=Menlo]          RX packets:6 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:0 errors:0 dropped:3 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:0 [/FONT]
[FONT=Menlo]          RX bytes:416 (416.0 B)  TX bytes:0 (0.0 B)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]vmbr0     Link encap:Ethernet  HWaddr c8:0a:a9:03:4b:f8  [/FONT]
[FONT=Menlo]          inet addr:10.10.1.52  Bcast:10.10.1.255  Mask:255.255.255.0[/FONT]
[FONT=Menlo]          inet6 addr: fe80::ca0a:a9ff:fe03:4bf8/64 Scope:Link[/FONT]
[FONT=Menlo]          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1[/FONT]
[FONT=Menlo]          RX packets:200280 errors:0 dropped:0 overruns:0 frame:0[/FONT]
[FONT=Menlo]          TX packets:136397 errors:0 dropped:0 overruns:0 carrier:0[/FONT]
[FONT=Menlo]          collisions:0 txqueuelen:0 [/FONT]
[FONT=Menlo]          RX bytes:28193184 (26.8 MiB)  TX bytes:26225292 (25.0 MiB)[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]root@proxnode2:/#[/FONT]
[FONT=verdana][SIZE=2]
[/SIZE][/FONT]
I can't seem to see anywhere where I can TAG the VLAN ID (VLAN100) i require to the interface.. eth0 is in a switch, in trunk mode with 2 VLANs tagged, VLAN10 being the 10.10.1./24 subnet, VLAN100, being the 192.168.0.0/24 subnet..

Im just wondering if you have any ideas, point me in the right direction or correct my stupidity?

Thanks again, much appreciated.
 
-- Update

I was being very stupid in the fact that I never actually created an interface on the Prox node for my VLAN.

Simply went to the Prox Node.. > Networking > create Bridge > called it vmbr100 (100 being my VLAN tag, however I think this can be anything really)..

Gave the device an IP address on my 192.168.0.0/24 (VLAN100) subnet, with a /24 bit mask.. Left default gateway off, and selected bridge port eth0.100 (again .100 being the VLAN i wanted traffic to be tagged with)..

Rebooted server..

Went to my OVZ container, added venet IP on this subnet and the damn thing came up and was visible.. I'm sure the vz.conf edit by Kotakomputer was also necessary.

Thanks everyone for all your help!