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:
---8<------8<------8<------8<------8<------8<------8<---
# 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/plugtap0.pid
pre-down kill `cat /var/run/vde2/plugtap0.pid`
# bridge the switch via tap0 to our physical network
auto br0
iface br0 inet static
bridge_ports regex (eth0|tap0)
bridge_maxwait 2
address 192.168.26.131
netmask 255.255.255.0
broadcast 192.168.26.255
gateway 192.168.26.1
dns-nameservers 192.168.1.111 192.168.111.111
dns-search lihas.de
# Some vserver interface, plugged into the virtual switch
auto tap34
iface tap34 inet static
address 192.168.26.134
netmask 255.255.255.0
broadcast 192.168.26.255
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/plugtap34.pid
pre-down kill `cat /var/run/vde2/plugtap34.pid`
# another vserver interface
auto tap35
iface tap35 inet static
address 192.168.26.135
netmask 255.255.255.0
broadcast 192.168.26.255
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/plugtap35.pid
pre-down kill `cat /var/run/vde2/plugtap35.pid`
---8<------8<------8<------8<------8<------8<------8<---
# 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 192.168.26.135 > /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:
---8<------8<------8<------8<------8<------8<------8<---
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.all.rp_filter=0
net.ipv4.ip_forward=1
net.ipv4.conf.all.accept_redirects = 1
net.ipv4.conf.all.accept_source_route = 1
net.ipv4.conf.all.log_martians = 0
---8<------8<------8<------8<------8<------8<------8<---
# 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.
Regards,
_are_
-- 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: lihas_at_lihas.de - Web: http://lihas.de Linux, Netzwerke, Consulting & Support - USt-ID: DE 227 816 626 StuttgartReceived on Wed Jul 1 18:18:14 2009