Skip to content

Instantly share code, notes, and snippets.

@RealYukiSan
Last active May 24, 2024 03:15
Show Gist options
  • Save RealYukiSan/4341def451d6a7e940638282301ef8aa to your computer and use it in GitHub Desktop.
Save RealYukiSan/4341def451d6a7e940638282301ef8aa to your computer and use it in GitHub Desktop.
List available network interface
#!/usr/bin/sh
for iface in $(ls /sys/class/net/); do
echo "Interface: $iface";
mode=$(iw $iface info 2>/dev/null)
if [[ $? -eq 0 ]]; then
mode=$(echo "$mode" | grep type | awk '{print $2}')
echo "Mode: $mode"
fi
ethtool -i $iface 2>/dev/null | grep -E 'driver|version';
pci=$(ethtool -i $iface 2>/dev/null | grep bus-info | awk '{print $2}' | cut -d: -f2,3);
if [[ -n "$pci" ]]; then
lspci -v -s $pci | grep -E 'Ethernet|Network'
else
echo "PCI info not found";
fi
echo "-----";
done
@RealYukiSan
Copy link
Author

RealYukiSan commented May 24, 2024

deactivate first?:

ip link set dev wlan0mon down

rename the interface:

ip link set dev wlan0mon name wlan0

switch interface mode:

iwconfig wlan0 mode managed

re-activate?

ip link set dev wlan0 up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment