Subject: Re: Ethernet [MAC] addresses
To: Berndt Josef Wulf <wulf@dingo.ping.net.au>
From: Mark White <mark.white@st-edmund-hall.oxford.ac.uk>
List: port-i386
Date: 02/22/2001 12:40:39
Berndt Josef Wulf writes:
> Mark White wrote
> > Can somebody enlighten me: is it possible to change the
> > ethernet [MAC, ie xx.xx.xx.xx.xx.xx] address of a network
> > interface?
> 
> AFAIK, you can't... MAC addresses are uniques numbers assigned to NICs at
> time of production by the manufacturer. 

Indeed, the default MAC address is stored in (usually) ROM
or EPROM on the card, and only a very small number of NICs
allow you to change this.

However, on pretty much every NIC around, this is just the
*default* address for packet control; the address actually
*used* for incoming and outgoing packets doesn't have to be
the default hardware address.  Some systems (linux and
solaris, in particular) implement an ioctl for doing so; you
can do something like "ifconfig eth0 hw 00:11:22:33:44:55"
in linux, or "ifconfig ne1 ether 00:11:22:33:44:55" in
solaris [I forget the exact syntax].

> I can't see the point of wanting to change this, but you must have
> your reasons... perhaps you can enlighten me on this one...

Changing it is quite useful for at least two things:
  - fiddling with DHCP (eg many systems only allow
    registered MAC addresses, and it's sometimes convenient
    to conenct a new NIC without having to register a new
    MAC address)
  - substituting one server for another without resetting
    anything on client machines (especially if the server is
    doing routing, DHCP or bootp)

Sun workstations do something like this, I think, to set all
the interfaces on a given machine to the same MAC.

ISTR that modifying the kernel to set this value is
relatively simple; it'd be convenient to implement setting
it from ifconfig.

Mark <><