PDA

View Full Version : WLAN Id Numbers



JackBauer
2017-04-08, 18:03
Hi, is it possible to have KALI identify ALWAYS with the same number the different WLAN adapters?

I run KALI 2016.2 with:
- an internal wifi card
- an usb TP-LINK adapter
- an usb ALFA adapter

What i see now is that each adapter is randomly assigned a WLAN Id, for example:
Internal = WLAN2
TP-LINK = WLAN1
ALFA = WLAN0

After each reboot this situation changes.

I'd need to have ALWAYS this situation:
Internal = WLAN0
TP-LINK = WLAN1
ALFA = WLAN2

mmusket33
2017-04-09, 06:36
To JackBauer

You could try this and see if it works. Boot the computer with no usb wifi devices connected then once running plug in TP link and see if it gets assigned wlan1 then plug in Alpha and see if it get assigned wlan2

MTeams

JackBauer
2017-04-09, 12:41
Thanks MM33, following your suggestion i get desired WLAN Id's, BUT my specific need is to boot Kali with all USB Wifi Adapters ALREADY plugged in: in this case i usually get this situation:
ALFA=WLAN0
TP-LINK=WLAN1
Internal=WLAN2

It seems that "somewhere" Kali has stored this association, linking each WLAN Id to each specific adapter.

re4son
2017-04-11, 01:55
Create "/etc/udev/rules.d/70-persistent-net.rules" and add rules to clearly identify the adapter (e.g. using the port, slot, driver, etc.) and assign the name of your choice.

Below an example rules file running on a Raspberry Pi, used to assign wlanX where X is the number of the USB port the adapter is plugged into:

# Assign wlan name according to the usb port used (2-5), 0 for internal
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="1-1.2:1.0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan2"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="1-1.3:1.0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan3"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="1-1.4:1.0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan4"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="1-1.5:1.0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan5"


Just run udevadm info -a /sys/class/net/wlan0, etc. and find the best attributes to use for your rules.

JackBauer
2017-04-11, 10:57
Ok, thanks.
I think the mac address is a good attribute, so a rule would be:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:86:f1:65:d5", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

Do I need to restart the service with:
sudo service udev restart
?

re4son
2017-04-12, 09:00
Quickest to reboot.
You could unplug the USB adapters, reload the rules and plug them back in but for the internal cards you have to stop the network, unload the drivers, reload the rules, trigger the rules, reload the drivers, start the network... -Just bounce it