On my laptop, I have Ubuntu 14.04. This laptop has both an RJ45 connector for wired Ethernet, and wireless/WiFi. I have noticed, however, that on this laptop, right after reboot, I have only this:
$ ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:608 errors:0 dropped:0 overruns:0 frame:0
TX packets:608 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:76086 (76.0 KB) TX bytes:76086 (76.0 KB)
wlan0 Link encap:Ethernet HWaddr XX:71:XX:XX:b1:XX
inet addr:YY.0.XX.XX Bcast:YY.0.XX.XX Mask:255.255.0.0
inet6 addr: fe80::XXXX:XXXX:fe3f:b1db/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2589 errors:0 dropped:0 overruns:0 frame:0
TX packets:2044 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1458453 (1.4 MB) TX bytes:292837 (292.8 KB)
In fact, if I turn off wireless / uncheck "Enable Wi-Fi" from the Network Manager applet, I have only this:
$ ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1794 errors:0 dropped:0 overruns:0 frame:0
TX packets:1794 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:178068 (178.0 KB) TX bytes:178068 (178.0 KB)
As you can see from the above ifconfig
dumps, eth0
corresponding to the wired ethernet network is not listed at all! And in fact, it won't appear, until I connect the laptop with a router/switch, and the laptop gets an IP address!? In fact, while there is nothing connected to the RJ45 connector, the laptop reports just this via lshw
:
$ sudo lshw -c network
*-network
description: Wireless interface
product: AR9485 Wireless Network Adapter
vendor: Qualcomm Atheros
physical id: 0
bus info: pci@0000:01:00.0
logical name: wlan0
version: 01
serial: XX:71:XX:XX:b1:XX
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list rom ethernet physical wireless
configuration: broadcast=yes driver=ath9k driverversion=4.2.0-42-generic firmware=N/A ip=YY.0.XX.XX latency=0 link=yes multicast=yes wireless=IEEE 802.11bgn
resources: irq:16 memory:f7c00000-f7c7ffff memory:f7c80000-f7c8ffff
Notice, the wired/eth0
adapter is not listed anywhere ?!
Otherwise, when I've connected the laptop's RJ45 connector with a network cable to a router or Internet cable, I get an ifconfig
entry like:
eth0 Link encap:Ethernet HWaddr XX:XX:2b:XX:XX:XX
inet6 addr: fe80::YYYY:YYYY:fe0a:YYYY/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1980 (1.9 KB) TX bytes:12108 (12.1 KB)
In fact, in the above snippet, the eth0
didn't even get an IP4 address assigned; so apparently all it matters is that it is connected somehow to an Ethernet network.
Note, on this laptop, /etc/network/interfaces
was containing just:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
... however, I added auto eth0
as a last line, saved and rebooted - and there was no change in behavior whatsoever (i.e. eth0
was still hidden, until connected).
Now, on the other hand, I manage a desktop machine as an Ubuntu server (also 14.04), and on it I've always seen eth0
show up in ifconfig
- even if I have pulled the network cable from the desktop's RJ45 connector?!
So my questions are:
- Why does Ubuntu sometimes "hide"
eth0
(or other network interfaces) until they are connected - and why is it not consistent (i.e. on desktop it is always shown, on laptop it is not shown until connected)? - How can I list all network hardware, on an Ubuntu that "hides" network interfaces like this - as in that case, as shown above, not even
sudo lshw
works?
ifconfig
by default shows only the interfaces that are Up. To see all interfaces, including the down one(s):Note that, in GNU/Linux
ifconfig
(comes withnet-tools
) is deprecated in favor of newerip
(comes withiptoute2
). Withip
you can do:Shorthand:
Check
man ip
to get more idea.