Score:0

Identify PHYSICAL Network Interfaces?

no flag

I'm working on a network automation project. I'm writing a python script that will remotely scan Ubuntu servers and network switches and then do its best to reconstruct the network's physical topology in a diagram. I think the script can do this, like so:

  1. For every Ubuntu server, make a list of the server's physical interfaces.
  2. If an interface is UP/UP, note its MAC address.
  3. For every network switch, examine all UP/UP ports that could be supporting end servers.
  4. Examine the switch's MAC Address table for the MAC of the host on the far end.
  5. If a match is found, update the diagram.

Step 1 is the current headache. When I run commands like ifconfig, ip a, ip link show, lshw -C network -short, ls /sys/class/net/, netstat -i, and others, I get a list of all network interfaces, physical and logical. For example, here's the list of interfaces on one of my servers:

bond0.10
bond0.11
br16
br17
eno3
enp216s0
enp94s0f
lo
virbr0
vnet0
vnet1

Which are physical? Which are virtual? I can make some educated guesses, but that's not good enough. I'd like to definitively identify which interfaces are the physicals and weed out the rest.

(I do not have admin access on these Ubuntu machines, so I can't install a utility like nmcli.)

Any advice is wildly appreciated.

waltinator avatar
it flag
SNMP is the tool. See`apt-cache search snmp`. You may have to install packages. Read `man snmp snmpget snmpwalk snmpcmd`, and see http://www.net-snmp.org/
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.