Linux: How to find the device driver used for a device? - Unix & Linux Stack Exchange
https://unix.stackexchange.com/questions/41817/linux-how-to-find-the-device-driver-used-for-a-device
networking - How do I find what kernel module is behind a network interface? - Ask Ubuntu
https://askubuntu.com/questions/216110/how-do-i-find-what-kernel-module-is-behind-a-network-interface
Improved driver finding and output format:
#!/bin/bashSave the above script as test.sh.
for f in /sys/class/net/*; do
dev=$(basename $f)
driver=$(ethtool -i $dev 2>/dev/null | grep driver: | cut -c 9-)
addr=$(cat $f/address)
operstate=$(cat $f/operstate)
printf "%020s [%017s]: %015s (%s)\n" "$dev" "$addr" "$driver" "$operstate"
done
Enumerate all the interface in all the network namespaces
echo === NameSpace: Global ===
sh test.sh
for a in $(ip netns list | sed -e 's/(.*$//g') ; do
echo
echo === NameSpace: $a ===
ip netns exec $a sh test.sh
done