I have a small home router running OpenWrt (Kind of embedded Linux for routers). It has five Ethernet ports, one labeled WAN and four labeld LAN 1 to 4. It has the following Network Interfaces defined as per ifconfig
:
root@TIBERIUS: ~ > ifconfig | grep Link
br-lan Link encap:Ethernet HWaddr 00:23:CD:20:C3:B0
eth0 Link encap:Ethernet HWaddr 00:23:CD:20:C3:B0
lan1 Link encap:Ethernet HWaddr 00:23:CD:20:C3:B0
lan2 Link encap:Ethernet HWaddr 00:23:CD:20:C3:B0
lan3 Link encap:Ethernet HWaddr 00:23:CD:20:C3:B0
lan4 Link encap:Ethernet HWaddr 00:23:CD:20:C3:B0
lo Link encap:Local Loopback
pppoe-wan Link encap:Point-to-Point Protocol
wan Link encap:Ethernet HWaddr 00:23:CD:20:C3:B0
wlan0 Link encap:Ethernet HWaddr 00:23:CD:20:C3:B0
As you can see, quite a number of devices, but only one MAC address.
I understand some of those devices are virtual. Let's put aside lo
and pppoe-wan
, that's the loopback device and my PPPoE Connection. But for the rest of those, how am I supposed to be able to tell whether they are physical or virtual? I understand there is a naming convention for labeling virtual Interfaces like eth0.1
, but that is obviously not adhered to here. Let's see the Output of ifconfig
for two of these interfaces:
root@TIBERIUS: ~ > ifconfig wan
wan Link encap:Ethernet HWaddr 00:23:CD:20:C3:B0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15007 errors:0 dropped:0 overruns:0 frame:0
TX packets:12055 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:13341276 (12.7 MiB) TX bytes:1831757 (1.7 MiB)
root@TIBERIUS: ~ > ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:23:CD:20:C3:B0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25799 errors:0 dropped:0 overruns:23 frame:0
TX packets:25294 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15481996 (14.7 MiB) TX bytes:15160380 (14.4 MiB)
Interrupt:4
Apart from the obscure Detail of txqueuelen
having a non-zero for eth0
, the only striking difference is that eth0
has an Interrupt
entry, which as far as I know is a Hardware Feature. So is that how you tell a Network Interface is physical or not, by looking for an Interrupt
entry in ifconfig
? Or is there a better way? A simple and straightforward way to find out whether a network device is physical or virtual?
Note there is a related question but while it does have an accepted answer, it isn't conclusive.
Update
In reply to derobert's answer, here's information derivd from ls -l /sys/class/net
:
br-lan -> ../../devices/virtual/net/br-lan
eth0 -> ../../devices/platform/ag71xx.0/net/eth0
lan1 -> ../../devices/platform/dsa.0/net/lan1
lan2 -> ../../devices/platform/dsa.0/net/lan2
lan3 -> ../../devices/platform/dsa.0/net/lan3
lan4 -> ../../devices/platform/dsa.0/net/lan4
lo -> ../../devices/virtual/net/lo
pppoe-wan -> ../../devices/virtual/net/pppoe-wan
wan -> ../../devices/platform/dsa.0/net/wan
[Addendum to this list: wlan0
would have shown up as well as wlan0 -> ../../devices/platform/ath9k/net/wlan0
, but when I copied the above list I had WLAN disabled, which is why it didn't show up.]
I would say eth0
is the only device. Not clear what dsa.0
is.
And in reply to Bryan Agee's answer:
root@TIBERIUS: ~ > cat /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'eth'
option ifname 'eth0'
option proto 'none'
config interface 'lan'
option ifname 'lan1 lan2 lan3 lan4'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.33.1'
option netmask '255.255.255.0'
config interface 'wan'
option ifname 'wan'
option proto 'pppoe'
option username '…'
option password '…'
lshw -class network
lshw
is not in the package list. A knowledgeable and determined guy might succeed in installing dev tools intmpfs
, but would it be worth while? I'm going to further my understanding of Linux networking by means of a standard PC. This is going to be easier. While I don't properly understand this router configuration, it does work fine. Thanks for your help.