1

I setup a macvtap interface like this:

ip link add link eth0 vlan type macvlan mode bridge
ip address add 10.0.0.17 dev vlan
ip link set dev vlan up
ip route flush dev eth0
ip route flush dev vlan
ip route add 10.0.0.0/24 dev vlan metric 0
ip route add default via 10.0.0.1
ip link add link eth0 name vtap address xx:xx:xx:xx:xx:xx type macvtap mode bridge
ip link set vtap up
ip address flush eth0
ip address flush vtap
dhclient -v vtap
ip address flush vtap

And it works fine for a couple of hours. But after that, any connections to the DHCP (macvtap) IP will start going to the host machine instead. So if I connect to the IP at port 80 for example, I will see a page served by the host instead of the VM.

I am trying to understand why it stops working. At first I thought maybe the DHCP lease expired, and dhclient is not renewing it. But the leasetime is 24 hours, and this problem starts earlier than that, sometimes in less than 10 hours.

So what can be causing the macvtap interface to stop working?

1

1 Answer 1

0

When dhclient was started, it was the only one using the macvtap interface. But when dhclient was sending a packet in order to renew the lease after many hours, it broke macvtap because by that time the guest was also using the interface. And both host and guest cannot use the same interface simultanously.

If a totally different program had just sended a random packet over that interface from the host, for example a simple ping packet, the same would have happened. So this problem was not related to DHCP in any way.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .