Hi everybody
I'm testing the macvlan module for a while now on a Debain Etch server. I am using it for obtaining 4 dynamic ip-addresses from my ISP on one singel machine (on one nic).
Everything is working fine so far. I'm getting an IP-address for each of my four macvlan devices and I am able to use them. An issue drew my attention though when I restarted the network. The DHCPRELEASE packet reported, that the route to the dhcp server (that is located in a different subnet) is not known.
I have policy routing set up so this can't be the reason. After testing everything back and forth, I noticed that by typing "ifdown macvlan0" the dhclient releases the ip address for all macvlan interfaces at once instead of only macvlan0. This looks to me as if those interfaces are somehow coupled together. Issuing "ifdown -a", when time comes for macvlan1 to release it's ip-address this already happened when the ip of macvlan0 was released.
One funny thing is: I have on my productive machine and on a vmware the same kernel installed. On the vmware I don't have this issue. Could the network-device driver cause such a problem?
Anyone having an idea how to solve this?
Thank you David
Use bridged veth interfaces
i.e. create a bridge, create four veth instances, then bridge together those veth interfaces with your physical interface.
e.g. roughly, you'll need to e.g. up the interfaces etc.
# create bridge
brctl addbr br0
# create veth0, veth1 - virtual p2p eth link
ip link add type veth
# create veth2, veth3 - virtual p2p eth link
ip link add type veth
# add real interface and upstream virtual p2p ethernet interfaces bridge
brctl addif br0 eth0
brctl addif br0 veth0
brctl addif br0 veth2
# run DHCP client on downstream virtual ethernet interfaces
dhcpcd -i veth1
dhcpcd -i veth3
There's some limitations with macvlan interfaces that may be causing your problem. Have a read of some of the emails in this thread:
http://kerneltrap.org/mailarchive/linux-netdev/2009/3/7/5117214