I have a Linux setup where two macvlan interfaces in mode bridge are added on the same physical interface, in the same IP subnet:
ip link add link eth2 dev mvl0 type macvlan mode bridge
ip link add link eth2 dev mvl1 type macvlan mode bridge
ip addr add 192.168.42.16/24 dev mvl0
ip addr add 192.168.42.17/24 dev mvl1
ip link set dev mvl0 up
ip link set dev mvl1 up
I want to communicate between mvl0
and mvl1
using sockets which are bound to the interfaces, but this doesn't work. For example,
# ping -I mvl0 192.168.42.17
doesn't get any replies. I can see that the kernel tries to do ARP on lo
, but that doesn't work as it gets no reply.
Is there a way to make this work, for example by manipulating routing or neighbor tables?
Should this be considered a bug in the Linux kernel? After all,
macvlan
interfaces in modebridge
should be able to see each other.
(Background: This is a simulation of two embedded devices running in the same process context. Our framework always binds sockets to interfaces, to ensure that communication really goes through the desired interface. Communication is normally via UDP.)