Main /

OSX Set Mac

Navigation

Links

Useless Badges


All original content, unless otherwise noted, is licensed under a Creative Commons License.

@

OSX Set Mac

Setting the Built-in Ethernet MAC at boot on OS X

OS X allows you to change the MAC address used by the built-in 10/100/1000bT ethernet devices (at least the G4 and G5 ones I’ve tried). You can try this now by running /usr/sbin/ifconfig en0 lladdr 00:11:22:33:44:55, where 00:11:22:33:44:55 is the MAC you want to take.

However, this goes away every time you reboot… My first attempt at making this change more permanent was to add the ifconfig to /etc/rc.local, which gets executed during bootup. Unfortunately, at the time /etc/rc.local gets executed /dev/en0 doesn’t exist yet, so its kind of hard to update it. The two files below use launchctl (the new and improved rc/inetd/cron/etc replacement in 10.4) to wait until en0 shows up, and then set the MAC.

/Library/LaunchDaemons/org.gizmolabs.setMAC.plist:

   <?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
   <plist version="1.0">
   <dict>
           <key>Label</key>
           <string>org.gizmolabs.setMAC</string>
           <key>OnDemand</key>
           <true/>
           <key>ProgramArguments</key>
           <array>
                   <string>/bin/sh</string>
                   <string>/Library/LaunchDaemons/org.gizmolabs.setMAC/setmac.sh</string>
           </array>
           <key>RunAtLoad</key>
           <true/>
           <key>ServiceDescription</key>
           <string>Change MAC address of en0</string>
   </dict>
   </plist>

/Library/LaunchDaemons/org.gizmolabs.setMAC/setmac.sh:

   #!/bin/sh

   echo "Changing built-in ethernet MAC"

   false
   while [ $? != 0 ]; do
     sleep 5
     /sbin/ifconfig en0 lladdr 00:11:22:33:44:55
   done
Recent Changes (All) | Edit SideBar Page last modified on October 11, 2006, at 06:10 PM Edit Page | Page History
Powered by PmWiki