CentOS script for mac address change

I have in my home internet connection from Multimedia. I didn’t bought yet a WiFi router so I must share a cable between two laptops: mine and my wife 🙂 Usually when I switch cable I must also restart modem because it has to get new mac address from the device.

Because I don’t want to restart the modem all the time I want to connect my laptop to the internet (because usually my wife laptop is connected) i wroted a small script which is changing my network card mac address.

The script looks like this:

#!/bin/bash
/sbin/service NetworkManager stop
/sbin/ifdown eth0
/sbin/ifconfig eth0 hw ether MAC_ADDRESS
/sbin/ifup eth0
/sbin/service NetworkManager start

You may download the script from here.

Of course you have to be root to do this.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

This website stores some user agent data. These data are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to opt-out of any future tracking, a cookie will be set up in your browser to remember this choice for one year. I Agree, Deny
594