I need to config two different MAC and IP addresses on the same physical device (eth1).
But when I configure a macvlan interface in the default/global namespace and configure a vlan on top of it. I can ping the vlan IP address directly from a external host, without tagging it (ping). But on the other side: tagged pings does not work. The same happens when I set up the network configuration in a non-global/non-default namespace.
ip addr add 169.254.255.126/16 dev eth1
ip link set dev eth1 up
# ping 169.254.255.126 # PING from external host is working: fine
ip link add macvlan link eth1 type macvlan mode bridge
ip addr add 169.254.255.127/16 dev macvlan
ip link set dev macvlan up
# ping 169.254.255.127 # PING from external host is working: fine
ip link add link macvlan name vlan2 type vlan id 2
ip addr add 169.254.255.128/16 dev vlan2
ip link set dev vlan2 up
# ping 169.254.255.128 # PING from external host works without vlan tag: FAIL
# ping 169.254.255.128 -I VLAN2 # no PING response external host with vlan tag: FAIL
**So how can I set up two virtual interfaces (different MAC+IP) on the same physical interface in its global/default namespace, which are acting like real devices?**
Optional: If global is no option, namespaces are acceptable.
FYI: I tested it on UBUNTU 18.04 with kernel 5.4 and also an embedded buildroot system with kernel 4.9 (both times, same result).
Asked by stahlstngel
(1 rep)
May 12, 2021, 12:08 PM
Last activity: May 20, 2022, 06:40 AM
Last activity: May 20, 2022, 06:40 AM