Tuesday, May 8, 2007

How to change MAC address in openSUSE 10.2

Yast2 is a great tool in openSUSE for configuring all your network settings but one thing it lacks is the option to change the MAC address of the network card. This option is available in Windows so I see no reason why it should not be available in Yast.

Luckily, there is an alternate way to change your MAC address. I am assuming that you would want to change the MAC address on every boot. Otherwise 'ifconfig' is always available to change the MAC address.

To change the MAC address automatically on every boot, just create a file named 'rclocal' in /etc/init.d folder. Enter the following in this file:


#! /bin/sh

## This script simulates redhat's rc.local (Add commands at the end)

### BEGIN INIT INFO
# Provides: rclocal
# Required-Start: $local_fs $remote_fs $network
# X-UnitedLinux-Should-Start: $ALL
# Required-Stop:
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Simulates rc.local
# Description: Simulates redhat's rc.local: contains
# commands to execute after system has booted (all services are already
# available)
### END INIT INFO

## Execute ony when service is started
case "$1" in
start)
## commands will be executed
;;
*)
exit 0
;;
esac

# vvvvv Add your commands bellow this line vvvvv
/sbin/ifconfig eth0 hw ether 'Your New MAC address here'


Enter the MAC address that you want in the last line. After this, open up Yast2 and goto System-> System Services (Runlevel). In the list of services, select rclocal and enable it.


Save the changes. Reboot your computer. On reboot, the MAC address of your network card should now have been changed to the new one.

Note that this file can also be used like redhat's rc.local and so you can also add other stuff here.

Hope this has been useful! Please let me know if I have written anything incorrectly. Bye!

2 comments:

Unknown said...

For this there is a automated tool called Yast2 for configuring all your network settings but one thing it lacks is the option to change the MAC address of the network card. This option is available in Windows so I see no reason why it should not be available in Yast.

Thanks
Silvester Norman

Changing MAC Address

Charlie Electra said...

Hi Silvester,
Good to find that you have mentioned a very effective tool for configuring the network settings.

Thanks
Charlie Electra

Buy Electronic Products