I want to have 2 WAN IP addresses (of the same subnet) with different MAC addresses on the same physical port, with the same firewall rules (wan), and then, by means of routing table, separate the traffic.
I have been looking how to achieve this on 19.07.3 with macvlan (not mwan3). I've been testing different configurations, but haven't figured out the right combinaton of parameters yet.
BTW: This only have 1 vlan with the real physical port and the cpu:
Some other people reported having success by running something like:
ip link add link eth0 name veth0 type macvlan ifconfig veth0 up ip link add link eth0 name veth1 type macvlan ifconfig veth1 up
config device 'veth0' option name 'veth0' option type 'macvlan' option ifname 'eth0' config device 'veth1' option name 'veth1' option type 'macvlan' option ifname 'eth0'
So, because my actual network config is like:
config device 'wan_port' option name 'eth0.1' option macaddr '11:11:11:11:11:11' config interface 'wan' option ifname 'eth0.1' option proto 'static' option ipaddr '10.10.10.10' option netmask '255.255.255.0'
ip link add link eth0.1 name eth0.2 type macvlan ifconfig eth0.2 up
Works when doing it manually, but not when adding it to the rc.local (I mean, it creates it and looks as it should, but it don't work).
Regarding the second approach, I think something like the following should work:
config device 'wan_port' option name 'eth0.1' option macaddr '11:11:11:11:11:11' config interface 'wan' option ifname 'eth0.1' option proto 'static' option ipaddr '10.10.10.10' option netmask '255.255.255.0' option metric '10' config device 'foo_wan_port' option name 'eth0.2' option type 'macvlan' option ifname 'eth0.1' option macaddr '11:11:11:22:22:22' config interface 'foo_wan' option ifname 'eth0.2' option proto 'static' option ipaddr '10.10.10.20' option netmask '255.255.255.0' option metric '20'
I obtain different ifconfig / LuCI results depending on where on the config file I declare the MAC(s) and the macvlan(s) options, or whether I omit some, but with none of those I get a ping reply for the eth0.2, and under some combinations not even for eth0.1. Moreover, with most of the combinations, luci / kvorker eats a lot of cpu, making the ssh and LuCI response very slow.
Note: I also tried simply assigning two IP addresses / interfaces to the same eth0.1, but then I get the same MAC for both regardless what I declare for the override MAC option.
I would appreciate you support with this puzzle.