Apr 3, 2009

Change MAC on Linux

On rebooting, the file below is read.
/etc/sysconfig/network-scripts/ifcfg-eth0

It looks like:

# nVidia Corporation nForce3 Ethernet
DEVICE=eth1
BOOTPROTO=none
BROADCAST=192.168.28.255
HWADDR=00:30:04:04:AE:57
IPADDR=192.168.28.51
NETMASK=255.255.255.0
NETWORK=192.168.28.0
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
GATEWAY=192.168.28.254
TYPE=Ethernet

1. Add a line "MACADDR=XX:XX...:XX", where XX is the MAC addr you want.

2. Either change HWADDR to the same as MACADDR, or comment out HWADDR which is BETTER!
I don't know the differences between these two options. Just try!

3. Restart service
/etc/init.d/network stop
/etc/init.d/network start

0 comments: