Re: [vserver] Different MAC-Adress in a vserver

From: Adrian Reyer <>
Date: Wed 01 Jul 2009 - 18:17:52 BST
Message-ID: <>

On Tue, Jun 30, 2009 at 08:32:26PM +0200, Herbert Poetzl wrote:
> hmm, not sure that matches your initial search,
> but let us know how it went :)

Current status:
- managed to get a virtual switch up
- managed and link it via br0 on tap0 and eth0 to the ethernet
- managed to add tap-devices to it with adresses from the adresses
  that typically float by on the eth0-network
- ping -I tap2 some-other-host
  shows packets there coming from the tap2-MAC

Unfortunately the tools initial error message about duplicate MAC
adresses had been an error and therefore this effort had not been
needed for my project.
Nonetheless, here is what I did (Debian Lenny 5.0):

# Get the virtual switch software:
aptitude install vde2

# Configure it via /etc/network/interfaces because that is what you do
# in Debian:
# The virtual switch itself
auto vde0
iface vde0 inet manual
        vde2-switch -

# the first virtual network cable to tap0
auto tap0
iface tap0 inet manual
        tunctl_user vde2-net
        post-up vde_plug2tap -s /var/run/vde2/vde0.ctl -m 660 -g vde2-net -d tap0 -P /var/run/vde2/
        pre-down kill `cat /var/run/vde2/`

# bridge the switch via tap0 to our physical network
auto br0
iface br0 inet static
        bridge_ports regex (eth0|tap0)
        bridge_maxwait 2

# Some vserver interface, plugged into the virtual switch
auto tap34
iface tap34 inet static
        hwaddress ether f6:94:72:45:83:34
        metric 100
        tunctl_user vde2-net
        post-up vde_plug2tap -s /var/run/vde2/vde0.ctl -m 660 -g vde2-net -d tap34 -P /var/run/vde2/
        pre-down kill `cat /var/run/vde2/`

# another vserver interface
auto tap35
iface tap35 inet static
        hwaddress ether f6:94:72:45:83:35
        metric 100
        tunctl_user vde2-net
        post-up vde_plug2tap -s /var/run/vde2/vde0.ctl -m 660 -g vde2-net -d tap35 -P /var/run/vde2/
        pre-down kill `cat /var/run/vde2/`

# tunctl_user makes the if-up scripts in Debian generate the tap
# device
# as eth0 is in the bridge it needs no extra configuration

# linux-vserver network settings
echo tap35 > /etc/vservers/vserver35/interfaces/0/dev
echo > /etc/vservers/vserver35/interfaces/0/ip
echo vserver35 > /etc/vservers/vserver35/interfaces/0/name
touch /etc/vservers/vserver35/interfaces/0/nodev
echo 24 > /etc/vservers/vserver35/interfaces/0/prefix
touch /etc/vservers/vserver35/interfaces/0/tap

# for my testing I had been generous with network settings
# /etc/sysctl.conf:
net.ipv4.conf.all.accept_redirects = 1
net.ipv4.conf.all.accept_source_route = 1
net.ipv4.conf.all.log_martians = 0
# active sysctl setup
sysctl -p

In some tests I got the eth0 mac address as result, I guess some work
should be done with 'ip rule' to set the correct outgoing interface.

In some other tests the vserver has not seen the mac address of a
vserver on the same host in the arp cache.


LiHAS - Adrian Reyer - Krehlstra├če 1 - D-70563 Stuttgart
Fon: +49 (7 11) 78 28 50 90 - Fax:  +49 (7 11) 78 28 50 91
Mail: - Web:
Linux, Netzwerke, Consulting & Support - USt-ID: DE 227 816 626 Stuttgart
Received on Wed Jul 1 18:18:14 2009
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Wed 01 Jul 2009 - 18:18:16 BST by hypermail 2.1.8