Skip to contentSkip to conversation

multiple MAC addresses from one network card

LARTC Alexey Marinichev 6 participants 13 messages Apr 6, 2001 – Apr 7, 2001

lore
Share & tools
lore
#0 lore raw

Hello,

It is possible to get several interfaces assigned to one card, the simplest way is to use aliases, like:
ifconfig eth0:0 <address>

Is it possible to assign a different MAC address to an aliased interface? ifconfig eth0:0 hw ether <MAC> doesn't seem to work...

Thanks,

--Lyosha

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

#1 lore raw
Quoted 8 lines · Alexey Marinichev

Hello,

It is possible to get several interfaces assigned to one card, the simplest way is to use aliases, like:
ifconfig eth0:0 <address>

Is it possible to assign a different MAC address to an aliased interface? ifconfig eth0:0 hw ether <MAC> doesn't seem to work...

DON'T USE IFCONFIG AND fooN:M ALIASES IF YOU CAN HELP IT. Use the iproute2 utility 'ip' and assign multiple addresses with

# ip address add <address> dev <device>

And you can add as many addresses as the kernel will let you (what's the limit?). Make sure aliasing support is on in the kernel.

Honestly I'd avoid using route and ifconfig at all. Replace them everywhere you can with 'ip'.

This doesn't answer your question, but I considered it a Public Service Message. :)

'james

Signature · 9 lines
James A. Crippen <[email protected]> ,-./-.  Anchorage, Alaska,
Lambda Unlimited: Recursion 'R' Us   |  |/  | USA, 61.2069 N, 149.766 W,
Y = \f.(\x.f(xx)) (\x.f(xx))         |  |\  | Earth, Sol System,
Y(F) = F(Y(F))                        \_,-_/  Milky Way.


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/
#2 lore raw
In reply to Alexey Marinichev

hello;

'mac' addresses are assigned to the manufactuerer of each wired/wireless ethernet card. each ethernet device must have their own unique 'mac' address. therefore, it would be extremely unwise to have a card with made-up 'mac' addresses. about the only way to guarantee uniqueness would be to collect several dead ethernet cards or pcmcia cards soley for the purpose of knowing what their 'mac' address is and using those. it would still be extremely difficult to convince any ethernet card or pcmcia card to have more than one 'mac' address.

On Fri, 6 Apr 2001, Alexey Marinichev wrote:

alexey> Hello,
alexey>
alexey> It is possible to get several interfaces assigned to one card, the alexey> simplest way is to use aliases, like:
alexey> ifconfig eth0:0 <address>
alexey>
alexey> Is it possible to assign a different MAC address to an aliased alexey> interface? ifconfig eth0:0 hw ether <MAC> doesn't seem to work... alexey>
alexey> Thanks,
alexey>
alexey> --Lyosha
alexey>

Signature · 14 lines
Terry L. Ridder
Blue Danube Software (Blaue Donau Software)
"We do not write software, we compose it."

digging deep, i feel my conscience burn
i need to know who and what i am
this hunger jolts me from complacency
rocks me, makes me meet myself
----kendall payne---closer to myself---


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/
#3 lore raw
In reply to Alexey Marinichev

On Fri, Apr 06, 2001 at 02:10:00PM -0800, James A. Crippen wrote:
[...]

Quoted 1 line

DON'T USE IFCONFIG AND fooN:M ALIASES IF YOU CAN HELP IT.

[...]

Why? What exactly is the difference between using aliases from ifconfig and from ip?

Quoted 2 lines

Honestly I'd avoid using route and ifconfig at all. Replace them everywhere you can with 'ip'.

Why? Just curious. BSD uses ifconfig and route just fine, so does SunOS.

--Lyosha

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

#4 lore raw
In reply to Alexey Marinichev
Quoted 7 lines · Terry L. Ridder

hello;

'mac' addresses are assigned to the manufactuerer of each wired/wireless ethernet card. each ethernet device must have their own unique 'mac' address. therefore, it would be extremely unwise to have a card with made-up 'mac' addresses.

Not really, you just need to make sure that no other cards on your network have the same address. This isn't terribly difficult to check, and a good network administrator should have a database of all MAC address to hardware to IP address mappings anyway.

I have very occasionally encountered two cards from a manufacturer with the same address. This has happened only once or twice in my life, but it does happen, mostly because there are only so many bits for the manufacturer to play with, usually only 32 or 24 of the whole 48 bit address. This is why the manufacturer usually includes a DOS utility (for PC ethernet cards anyway) on their driver disk to allow changing the address in a permanent way.

Quoted 4 lines

about the only way to guarantee
uniqueness would be to collect several dead ethernet cards or pcmcia cards soley for the purpose of knowing what their 'mac' address is and using those.

Or just pick a random one from the 'ethers.txt' list or some similar compendium of address range -> manufacturer assignments. Pick one from a manufacturer that you've never heard of, like Symbolics, and you have a very good chance of never having a collision with one of your other cards. In fact, the probability of having an address collision is fairly low in any case.

IIRC there are also some explicitly unallocated ranges, similar to the IPv4 addresses like 10.0.0.0/8.

You can set the mac address of an ethernet card under Linux both permanently and temporarily (eg, until next reboot). Donald Becker has tools somewhere to permanently modify a MAC address, and there are also tools available (on Freshmeat.net for instance) to *temporarily* change the MAC address of a card. You can put such a program into your init scripts to have it do this at every boot. A friend of mine has done this with a firewall for his home network. His ISP is very slow to update their DHCP static address mappings so he just worked around it by temporarily changing the MAC addresses on his hardware until they finally updated their DHCP servers. This worked beautifully.

Donald Becker for one explicitly mentions with his utilities that *permanently* changing the MAC address of a card is probably not a good idea. And that it doesn't always work right, and if it doesn't then you can be left with nothing more than a worthless pile of silicon for your efforts.

There's nothing really wrong with assigning your own MAC addresses, it's just a pain to keep track of. Very rarely will you encounter problems with doing so, like collisions between multiple cards.

Your network should have sufficient separation between hosts anyway, such that address collisions never have a chance to tempt the probability of occuring.

Quoted 3 lines

it would
still be extremely difficult to convince any ethernet card or pcmcia card to have more than one 'mac' address.

There is AFAIK no way to assign multiple concurrent addresses to a device. Does anyone know otherwise? Is it even theoretically possible? I don't think so the way most cards are designed.

Why would you want to anyway?

'james

Signature · 9 lines
James A. Crippen <[email protected]> ,-./-.  Anchorage, Alaska,
Lambda Unlimited: Recursion 'R' Us   |  |/  | USA, 61.2069 N, 149.766 W,
Y = \f.(\x.f(xx)) (\x.f(xx))         |  |\  | Earth, Sol System,
Y(F) = F(Y(F))                        \_,-_/  Milky Way.


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/
#5 lore raw
In reply to Alexey Marinichev
Quoted 9 lines · Alexey Marinichev

On Fri, Apr 06, 2001 at 02:10:00PM -0800, James A. Crippen wrote:
[...]

Quoted 1 line

DON'T USE IFCONFIG AND fooN:M ALIASES IF YOU CAN HELP IT.

[...]

Why? What exactly is the difference between using aliases from ifconfig and from ip?
Why? Just curious. BSD uses ifconfig and route just fine, so does SunOS.

Right, and the Linux version used to work perfectly well too. But there have been so many changes to the underlying network subsystem (under kernel 2.4 particularly) that ifconfig and route aren't totally in sync with the system. Aliases are a good example. They don't really exist anymore as network devices. Instead there's a clear separation now between the hardware device and its driver and the network stack and addresses assigned to a device. The old ifconfig way was to create fake devices like eth0:0 to hang other IP addresses on. The new way that the 'ip' tool works is to assign an arbitrary number of addresses to *one* real device. If you create an alias with ifconfig as an eth0:0 type of device then you can see it attached to the real device using 'ip'. However if you allocate a number of addresses and attach them to eth0, say, then you won't see any except the first with ifconfig. This is because ifconfig doesn't understand the new alias mechanism. Then you start to get out of sync, and you have the problem of your device going down when you try to remove an alias. It's just not good to use for anything more than the old single-address, single-device metaphor. Anything more complicated is better done with 'ip'. And if you've learned how to use 'ip' you'll find that it's so convenient that you want to just throw ifconfig and route away.

'james

Signature · 9 lines
James A. Crippen <[email protected]> ,-./-.  Anchorage, Alaska,
Lambda Unlimited: Recursion 'R' Us   |  |/  | USA, 61.2069 N, 149.766 W,
Y = \f.(\x.f(xx)) (\x.f(xx))         |  |\  | Earth, Sol System,
Y(F) = F(Y(F))                        \_,-_/  Milky Way.


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/
#6 lore raw
In reply to Alexey Marinichev

On Fri, Apr 06, 2001 at 02:35:28PM -0800, James A. Crippen wrote:
[...]

Quoted 7 lines
Quoted 3 lines

it would
still be extremely difficult to convince any ethernet card or pcmcia card to have more than one 'mac' address.

There is AFAIK no way to assign multiple concurrent addresses to a device. Does anyone know otherwise? Is it even theoretically possible? I don't think so the way most cards are designed.

Vmware seems to be able to do it. They assign different ethernet address to a network card in the virtual machine. It might as well involve putting the card in promiscuous mode and filtering out packets that do not have addresses we're interested in.

--Lyosha

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

#7 lore raw
In reply to Alexey Marinichev

hello;

would you know if anyone has all ready hacked
the /etc/sysconfig/network-scripts to use 'ip'
instead of 'ifconfig' and 'route'?

On Fri, 6 Apr 2001, James A. Crippen wrote:

<major snip>
james>
james> how to use 'ip' you'll find that it's so convenient that you want to just james> throw ifconfig and route away.
james>
james> 'james
james>

Signature · 12 lines
Terry L. Ridder

digging deep, i feel my conscience burn
i need to know who and what i am
this hunger jolts me from complacency
rocks me, makes me meet myself
----kendall payne---closer to myself---


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/
#8 lore raw
In reply to Alexey Marinichev
Quoted 5 lines · Terry L. Ridder

hello;

would you know if anyone has all ready hacked
the /etc/sysconfig/network-scripts to use 'ip'
instead of 'ifconfig' and 'route'?

For Dead Hat? No clue. I use 6.2 but then again I also don't use aliases if at all possible and if I do need one I do it myself by hand.

That'd be a good project to do, though. I'd love a version of the scripts for 6.2 (I won't use 7 for obvious reasons).

If I ever get irritated enough by their boot scripts I'd rewrite 'em meself. But I just don't care yet. They work well enough for now, since I don't do anything magic, and don't have any funny routing to do on my workstation (my routers all use handmade stuff).

Come to think of it though, in the next few months I'll be setting up some tunneling from my workstation, so I'll probably need to. I'll let the list know when I've rewritten them.

'james

Signature · 9 lines
James A. Crippen <[email protected]> ,-./-.  Anchorage, Alaska,
Lambda Unlimited: Recursion 'R' Us   |  |/  | USA, 61.2069 N, 149.766 W,
Y = \f.(\x.f(xx)) (\x.f(xx))         |  |\  | Earth, Sol System,
Y(F) = F(Y(F))                        \_,-_/  Milky Way.


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/
#9 lore raw
In reply to Alexey Marinichev
Quoted 5 lines · James A. Crippen

I have very occasionally encountered two cards from a manufacturer with the same address. This has happened only once or twice in my life, but it does happen, mostly because there are only so many bits for the manufacturer to play with, usually only 32 or 24 of the whole 48 bit address.

It's 24 bits for the manufacturer to play with. The first three octets are assigned by IEEE and the manufacturer assigns the other three.

Duplications happen sometimes, mostly because of a manufacturing error, but occasionally because the manufacturer neglected to order a new address range in time from IEEE.

If you need to assign extra MACs to a card, you should set the "locally assigned" bit. It's the second bit on the wire and in canonical form that's the 0x02 bit of the first octet, so if the real MAC is of the form 00:00:0c:xx:xx:xx you could assign 02:00:0c:xx:xx:xx with no fear of a collision.

That's the theory, anyway. I've never had occasion to try it.

Breen

Signature · 9 lines
Breen Mullins
San Mateo, Calif.
<mailto:[email protected]>



_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/
#10 lore raw
In reply to Alexey Marinichev
Quoted 4 lines

There is AFAIK no way to assign multiple concurrent addresses to a device. Does anyone know otherwise? Is it even theoretically possible? I don't think so the way most cards are designed.

I don't know of any system to do this either, but I think it is theoretically possible. If you can get your NIC to listen to *any* destination MAC address (promiscuous mode), why would it be impossible to let it listen to two different destination MAC addresses.
But this remains theory. I don't know of any card that can do this...

Quoted 2 lines

Why would you want to anyway?

I think such a feature might be useful if you want to do 802.1q vlan trunking, but I'm not sure about it. The applications of such a feature will be rare anyway...

Guy

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

#11 lore raw
In reply to Alexey Marinichev
Quoted 9 lines · Guy Van Den Bergh
Quoted 4 lines

There is AFAIK no way to assign multiple concurrent addresses to a device. Does anyone know otherwise? Is it even theoretically possible? I don't think so the way most cards are designed.

I don't know of any system to do this either, but I think it is theoretically possible. If you can get your NIC to listen to *any* destination MAC address (promiscuous mode), why would it be impossible to let it listen to two different destination MAC addresses.
But this remains theory. I don't know of any card that can do this...

That's an idea for a kernel hack where you put the card into promiscuous mode and then filter from there for only certain addresses. But that would be a heavyhanded hack and I can see it chewing up quite a bit of resources on a busy network.

'james

Signature · 9 lines
James A. Crippen <[email protected]> ,-./-.  Anchorage, Alaska,
Lambda Unlimited: Recursion 'R' Us   |  |/  | USA, 61.2069 N, 149.766 W,
Y = \f.(\x.f(xx)) (\x.f(xx))         |  |\  | Earth, Sol System,
Y(F) = F(Y(F))                        \_,-_/  Milky Way.


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/
#12 lore raw
In reply to Alexey Marinichev

I havent tried or figured the way to do this with iproute2, but in the non iproute2 way you can change the mac address by:

Quoted 1 line

ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

-- Ingram Leedy

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of James A. Crippen
Sent: Friday, April 06, 2001 6:10 PM
To: Alexey Marinichev
Cc: [email protected]
Subject: Re: [LARTC] multiple MAC addresses from one network card

Quoted 8 lines · Alexey Marinichev

Hello,

It is possible to get several interfaces assigned to one card, the simplest way is to use aliases, like:
ifconfig eth0:0 <address>

Is it possible to assign a different MAC address to an aliased interface? ifconfig eth0:0 hw ether <MAC> doesn't seem to work...

DON'T USE IFCONFIG AND fooN:M ALIASES IF YOU CAN HELP IT. Use the iproute2 utility 'ip' and assign multiple addresses with

# ip address add <address> dev <device>

And you can add as many addresses as the kernel will let you (what's the limit?). Make sure aliasing support is on in the kernel.

Honestly I'd avoid using route and ifconfig at all. Replace them everywhere you can with 'ip'.

This doesn't answer your question, but I considered it a Public Service Message. :)

'james

--
James A. Crippen <[email protected]> ,-./-. Anchorage, Alaska,

Lambda Unlimited: Recursion 'R' Us   |  |/  | USA, 61.2069 N, 149.766 W,
Y = \f.(\x.f(xx)) (\x.f(xx))         |  |\  | Earth, Sol System,

Y(F) = F(Y(F)) \_,-_/ Milky Way.

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO:
http://ds9a.nl/2.4Routing/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/