[Users] Sharing VLANs between multiple VEs
Chris Bennett
chris at ceegeebee.com
Fri Nov 20 01:41:24 EST 2009
Hi Timo,
> Thanks for your information; so, you were actually able to use one
> ethN.n in more than one VE at the same time? That's the point it all
> boils down.
Yup. See below for most of the config you can use as a reference in making it
work.
And to allocate an interface to a container, pairing it up with a host node
bridge interface, I run:
vzctl set <id> --netif_add eth0.<vlan>,,veth<id>.<vlan>,,brvl<vlan> --save
where
<id> := container id
<vlan> := vlan id
brvl<vlan> := logical bridge name
That will allocate a MAC address for you automatically.
[root at hc ~]# brctl show
bridge name bridge id STP enabled interfaces
brvl10 8000.001851aa1922 no veth101.10
veth24.10
veth26.10
eth0.10
Containers 101, 24 and 26 are all bridged to eth0.10. Here's the
output if ifconfig in the containers & host node.
[root at hc ~]# vzctl exec 101 ifconfig eth0.10
eth0.10 Link encap:Ethernet HWaddr 00:18:51:15:93:01
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::218:51ff:fe15:9301/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1533257 errors:0 dropped:0 overruns:0 frame:0
TX packets:1231514 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1113861032 (1.0 GiB) TX bytes:928317625 (885.3 MiB)
[root at hc ~]# vzctl exec 24 ifconfig eth0.10
eth0.10 Link encap:Ethernet HWaddr 00:18:51:CD:D2:81
inet addr:192.168.1.24 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::218:51ff:fecd:d281/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2979954 errors:0 dropped:0 overruns:0 frame:0
TX packets:642616 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:231909752 (221.1 MiB) TX bytes:64014412 (61.0 MiB)
[root at hc ~]# vzctl exec 26 ifconfig eth0.10
eth0.10 Link encap:Ethernet HWaddr 00:18:51:40:16:02
inet addr:192.168.1.26 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::218:51ff:fe40:1602/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3413253 errors:0 dropped:0 overruns:0 frame:0
TX packets:151027 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:649410741 (619.3 MiB) TX bytes:9924130 (9.4 MiB)
[root at hc ~]# ifconfig brvl10
brvl10 Link encap:Ethernet HWaddr 00:18:51:AA:19:22
inet addr:192.168.1.43 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::219:d1ff:fe69:fd2e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:47128149 errors:0 dropped:0 overruns:0 frame:0
TX packets:61377267 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:755961920 (720.9 MiB) TX bytes:2573333037 (2.3 GiB)
[root at hc ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
[root at hc ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0.10
DEVICE=eth0.10
BOOTPROTO=none
ONBOOT=YES
BRIDGE=brvl10
[root at hc ~]# cat /etc/sysconfig/network-scripts/ifcfg-brvl10
DEVICE=brvl10
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.43
NETMASK=255.255.255.0
TYPE=Bridge
DELAY=0
[root at hc conf]# grep NETIF /etc/vz/conf/24.conf
NETIF="ifname=eth0.10,bridge=brvl10,mac=00:18:51:CD:D2:81,host_ifname=veth24.10,host_mac=00:18:51:AA:19:22"
[root at hc conf]# grep NETIF /etc/vz/conf/26.conf
NETIF="ifname=eth0.10,bridge=brvl10,mac=00:18:51:40:16:02,host_ifname=veth26.10,host_mac=00:18:51:FF:F6:95"
# 101 is doing routing/nat so connected to multiple vlans
[root at hc conf]# grep NETIF /etc/vz/conf/101.conf
NETIF="ifname=eth0.10,bridge=brvl10,mac=00:18:51:15:93:01,host_ifname=veth101.10,host_mac=00:18:51:BF:12:94;ifname=eth0.19,bridge=brvl19,mac=00:18:51:3F:54:C0,host_ifname=veth101.19,host_mac=00:18:51:C8:19:18;ifname=eth0.13,bridge=brvl13,mac=00:18:51:64:62:9E,host_ifname=veth101.13,host_mac=00:18:51:D8:6B:D0;ifname=eth0.12,bridge=brvl12,mac=00:18:51:29:D0:B9,host_ifname=veth101.12,host_mac=00:18:51:B7:B9:65"
Regards,
Chris Bennett
cgb
More information about the Users
mailing list