second MAC address to a network adapter

Is it possible to add a second MAC address to a network adapter or to create a virtual network interface with a separate MAC address?

In linux, especially openwrt, I use macvlan

Code:
ip link add link eth1 eth2 type macvlan
ifconfig eth2 hw ether 00:24:01:f5:1b:84

ip link add link eth1 eth3 type macvlan
ifconfig eth3 hw ether 00:24:01:f5:1b:85

ip link add link eth1 eth4 type macvlan
ifconfig eth4 hw ether 00:24:01:f5:1b:86

ip link add link eth1 eth5 type macvlan
ifconfig eth5 hw ether 00:24:01:f5:1b:87

ip link add link eth1 eth6 type macvlan
ifconfig eth6 hw ether 00:24:01:f5:1b:88
 
Look at vlan(4) and the vlan and vlandev options to ifconfig(8). Untested by me, but looks like it may be able to do what you want: create a VLAN interface and then, maybe, change the MAC address on that interface.
 
There may be only one VLAN interface with a specific tag bound to a physical interface, this solution may not appropiate. The example suggests more MACs assigned within the same VLAN id.
Maybe it will work this way: publish ARP for the desired addresses, while having the IP addresses bound to one or more loopback interfaces. This may work for ingress traffic only.
I can't find a real world usage for this kind of setup, anyway.
Perhaps ng_ether is the right answer.
 
So, it looks that ng_eiface(4) combined with ng_ether(4) is the answer. It looks that here's a script showing how to create a virtual network attached to a physical interface, having this network connected to as many virtual interfaces (with different MAC addresses) you need. The script uses the same MAC address as the physical interface, but I think it can easily be changed to suit your needs.
 
So, it looks that ng_eiface(4) combined with ng_ether(4) is the answer. It looks that here's a script showing how to create a virtual network attached to a physical interface, having this network connected to as many virtual interfaces (with different MAC addresses) you need. The script uses the same MAC address as the physical interface, but I think it can easily be changed to suit your needs.
So I read the post but it's unclear for me if it's similar to macvlan or not. With macvlan each interfaces in bridge mode can do the following:
* connect directly to external (not going through the bridge interface)
* connect via the bridge to other hosts

Will it do the same?
 
Back
Top