Flickr Photos

Roe Deer
Leopard in the rain
Lion mum taking care of cubs
Male Lion
Lion Cubs Playing
Lazy Spotted Hyena
Female Lion
Golden Jackal
Golden Jackal
Young Cheetah

Playing with interfaces and mac-addresses on Linux

I often use laptop which have integrated wifi card and I often need external USB network card too and sometimes internal is WLAN0 and sometimes it was WLAN1 and of course opposite for that external card.
That’s why it was really annoying and almost impossible to write workings scripts that used specific network interfaces.

Username tuke81 gave me tip that I can tell linux to put internal to wlan0 and external to wlan1 if I just do some settings to /etc/udev/rules.d/70-persistent-net.rules file.

All that I had to do was put these two lines to that file and change MAC-addresses.
Here 11:22:33:44:55:66 is my internal wlan interface and 66:55:44:33:22:11 is external:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="11:22:33:44:55:66", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="66:55:44:33:22:11", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"

After this every time I start wlan0 with ifconfig wlan0 up it will be my laptops internal network card and when I use ifconfig wlan1 up wlan1 will be my external card and now it’s possible to write scripts which use my network interfaces.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>