Simple question: How can I setup multiple MAC addresses on one physical network interface (linux)?
Why? My ISP is checking ip<->mac on GW and I d like to route traffic through my "linuxbox" and than forward it with different source ip.
Without checking ip<->mac, I will use eth0, eth0:0, but in this situation I need unique MAC address for every IP.
You can use macvlan to create multiple virtual interfaces with different MAC addresses.
In theory that should be all you need, though at some point something broke in the kernel and it would cause it to use one MAC for everything. I'm not sure what the status of that is; hopefully it's fixed.
If not, you could use arptables to rewrite the MAC addresses on output based on the egress interface or on input based on destination IP:
Unfortunately arptables is also quite buggy in my experience.
The reason why your bridge and TAP interface share the same MAC address,is because the bridge does not have a MAC,until its bound to an interface. If you create a bridge with BRCTL,and do a "brctl show",you will find the bridge has empty ports.(no interface bound to it) In binding TAP0 to br0,naturally,it will show as the same MAC. I created a test bridge,to illustrate.
# brctl addbr testbr0
I created three test TAPS. The output from "brctl showmacs testbr0".
As you can see,each bridge port has a unique MAC address,and the bridge should show its MAC, as the first interface bound. If you bridge a physical network interface,the Ethernet bridge will inherit its MAC address,and move all virtual interfaces down. Example binding eth0,to the test bridge.
Using "brctl show" again;
the TAP interfaces have moved down one,even though eth0,is still at PORT 4. You still have unique MAC addresses. If the Ethernet bridge is bound to a source-route interface,you have no choice in using an IP address,or DHCP. For what its worth,if you bridge a source-route interface,you will show a "non-local" MAC address. This is the next-hop router MAC address. I know in RedHat,there is an option in specifying a source IP,using IFCONFIG. My first option,would be consulting the IP command reference,as I think you can specify a source IP. I never have tried it.
Try to create
tap
devices or any other virtual ethernet devices with needed MAC addresses and IPs and then attach them into one bridge with eth0.It looks like you might be able to use vconfig to create multiple vlan addresses on the same physical ethernet, each with different mac addresses.