SUMMARY: Changing the MAC addresses on Multiple Interfaces

From: Dave (
Date: Thu Jun 19 1997 - 18:17:36 CDT

  Problem: All additional interfaces on a Sun seem to assume the MAC
(ethernet) address of the primary interface. If you do a "ifconfig -a" you
can see it right away. If you don't belive what you see, check out the ARP
tables of some of the local routers. If you introduce this setup into a
"flattened" network of switches with VLANs, it starts to cause problems.
  This works fine in a traditional, routed, network. It hasn't caused
caused any problems to date.

  Question: How do you change it?

  Answer: Use the "ifconfig <interface> ether <value>" command to change it
to whatever you want. This doesn't seem to be documented in the "man
ifconfig" pages, though. This command works on SunOS 4.1.3 & 4.1.4. I was
told it works in Sol 2.X, but I have no multi-interface Sol 2.X machines to
try it on.

CAUTION: Be careful about what you change it to. If, by chance, you hit
another devices MAC address, it could get very interesting.

  In my case, I have two machines, each with three ethernet interfaces.
  Each inteface has a different IP address, and is on a different subnet.
  One machine has three 10BaseT.
  The other has one 10BaseT (le0) and two 100BaseT (hme0 & hme1).
  I changed the MAC addresses to the le0 MAC address+1
(le0=8:0:20:12:73:d2, le1=8:0:20:12:73:d3, le2=8:0:20:12:73:d4) after I
verifyed there were no devices at the MAC addresses.

  I added some lines in the /etc/rc.local file to set the MAC address at
boot and before the in.routd started.

# Change MAC addresses on le1 & le2
if [ -f /etc/hostname.le1 ]; then
   echo 'Changing MAC on le1'
   ifconfig le1 ether 8:0:20:XX:YY:ZZ
if [ -f /etc/hostname.le2 ]; then
  echo 'Changing MAC for le2'
  ifconfig le2 ether 8:0:20:XX:YY:ZZ+1

  On the machine with the 100BaseT cards:
# Change MAC addresses on hme0 & hme1
if [ -f /etc/hostname.hme0 ]; then
   echo 'Changing MAC on hme0
   ifconfig le1 ether 8:0:20:XX:YY:ZZ
if [ -f /etc/hotname.hme1 ]; then
  echo 'Changing MAC for hme1'
  ifconfig le2 ether 8:0:20:XX:YY:ZZ+1

  I am sure there is a way to automate it, so that you don't have to "hard
code" the MAC address, but this was a quick way around the problem.
  After the reboot, you can see the new MAC addresses have taken effect,
and a look at the router ARP table verifies it.


This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:57 CDT