Linux – “ifconfig” gives an error on Bash on Ubuntu on Windows

bashifconfigUbuntuwindows-subsystem-for-linuxwireless-networking

When I try using the command "ifconfig" on Bash on Ubuntu on Windows(WSL), it gives me an error like this :-

root@example:~# ifconfig
Warning: cannot open /proc/net/dev (No such file or directory). Limited output.

And when I try to run "iwconfig" :-

eth0   no wireless extensions.

wifi0   no wireless extensions.

lo       no wireless extensions.

und0  no wireless extensions.

und1  no wireless extensions.

This leads me to believe that it hasn't detected the network devices, but then how is the internet working? Internet works well, as I've used apt-get to install apps;

I'm no linux pro, let alone a wsl pro, so could I have a some advice on how to overcome this problem?

Best Answer

WSL doesn't run a full Linux kernel – it only translates each individual syscall to its Windows variant. Therefore WSL doesn't need to "detect" devices the same way real Linux would, because Windows itself has already done that.

Besides, "detecting" a device is not the same thing as exposing information about it, anyway. The files in /proc/net are only for informative purposes; they are not needed for actually using the net. So it's not a big problem if they are missing.

In addition, most network programs do not care about the actual devices; they only deal with high-level functions (BSD sockets) and let the OS handle the details. Therefore, as long as WSL implements functions like socket() and connect() and sendto(), that's enough.


The situation with iwconfig is similar: the wireless devices are already managed by Windows itself; WSL just doesn't know how to translate the link information to Linux programs, but most of them do not need to know that anyway.

Besides, iwconfig is an old tool that uses the nearly-obsolete WEXT API. I suspect the developers would care more about making modern nl80211-based tools such as iw work first.

(Even many Linux drivers no longer support WEXT directly – they only emulate it on top of nl80211.)

Related Question