LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How can I change/set the MAC address at boot time under SuSE? (https://www.linuxquestions.org/questions/linux-networking-3/how-can-i-change-set-the-mac-address-at-boot-time-under-suse-493721/)

Basel 10-18-2006 11:51 PM

How can I change/set the MAC address at boot time under SuSE?
 
Currently I use ifconfig to change the MAC address after booting the machine as follows:
Code:

openSUSE:~ # ifconfig eth1 down
openSUSE:~ # ifconfig eth1 hw ether yy:yy:yy:yy:yy:yy
openSUSE:~ # ifconfig eth1 up

I tried setting the LLADDR to "yy:yy:yy:yy:yy:yy" in /etc/sysconfig/network/ifcfg-eth-id-xx:xx:xx:xx:xx:xx as hinted by ifcfg.template but it did not work. Under Slackware I would simply add HWADDR to rc.inet1.conf but I am not sure as of how to do it under SuSE.

andrewdodsworth 10-19-2006 02:23 AM

I agree with you - the ifcfg-template says it should work and when I've needed to use special stuff (wireless cards usually) putting it in eth-xx works. However, there's nothing stopping you putting your ifconfig commands in a script and putting them in /etc/init.d/boot.local.

Not as elegant but it works!

Basel 10-19-2006 08:05 AM

boot.local says:
Code:

# Here you should add things, that should happen directly after booting
# before we're going to the first run level.

Does that mean the script would run before dhcpcd?

ok4life 10-19-2006 09:30 AM

I would say yes. considering the your run level will start or not start the Network which this may just set a MAC add then change it back on you. I may play with it on my laptop I got Suse 10.0 on it. If you find it works or another elegant way post it up this is a common thing for me to have to do for offsite configuration. (to many MAC changes my ISP locks me down, MAC+IP binding)

andrewdodsworth 10-19-2006 10:20 AM

Sorry you're right! Had a look at startup log and boot.local gets run before the network stuff is started.

I'll have a play with scripts in /etc/init.d and let you know.

andrewdodsworth 10-19-2006 11:01 AM

Well I tried just putting the ifconfig statements in boot.local, rebooted (twice just to make sure) and it worked!

Let me know if it works for you.

Basel 10-20-2006 12:23 AM

Thank you everyone it worked :)


All times are GMT -5. The time now is 05:41 AM.