2

Is there a way to send some (non-broadcast) packets out on an Ethernet interface that doesn't have an IP address assigned to it? Thus allowing me to see which light blinks on the network switch?

The issue is I have a server with three network interfaces. I know which three switch ports they are connected to, but not which interface name goes with each physical jack on the server. If they all had addresses, I could just use ping, but I was hoping to figure out which is which before I configure them. The back of the server is tough to get to, too. I'd have to move the rack. Otherwise, I could just use ethtool -p.

Edit: This is on a Linux server. Ubuntu, to be specific, though I imagine this wouldn't be distro-specific.

4
  • I'm pretty sure that ethernet switches care more about MAC addresses than IP addresses
    – infixed
    May 15, 2018 at 15:00
  • Me too, which is why I assume it's possible to send packets without an IP address, but I don't know what command might do it. May 15, 2018 at 15:10
  • But if you send a packet with an unknown MAC, it will probably repeat it on all ports, making blink detection sort of useless. So that implies you need to send to known MAC, which would likely show on two lights. arping yourself? I don't know. I think a link up/down loop like Centimane's answer implies shows promise
    – infixed
    May 15, 2018 at 15:20
  • Known MAC is okay. I know what most of the ports on the switch are connected to, so I can just send to any of those and know which light is the unknown interface. (In fact, this is what I ended up doing.) I do like Centimane's approach too, though. May 15, 2018 at 15:36

3 Answers 3

3

I would say the best way to solve this is actually from the switch itself.

Assuming it's a cisco switch:

# starting on your linux host
ip link show # note the mac addresses

ssh ${user}@${switch} # or however you normally connect to the switch
show mac address-table address ${mac-address} # note the mac address is in a weird format ####.####.####

That will show you which port has received traffic from the corresponding mac address. You may need to cause the interface to send some traffic in order to update the mac address table (even DHCP attempt) would suffice.

You could also toggle the link lights on the switch using:

ip link set ${interface} down

To shut-down an interface, which should turn off the link light.

Then:

ip link set ${interface} up

To turn the interface back on.

2
  • +1 This is a good option too. No need to even get up with this one. It's an HP switch though, so I'd have to look up the equivalent commands, and I already figured it out with arping. May 15, 2018 at 15:30
  • @Dominick sh mac, and then hit tab to complete the command or see the possible arguments. Especially with show commands, which won't break anything, you can pretty much get to the right direction by tabbing and guessing...
    – ilkkachu
    May 15, 2018 at 17:52
3

You can use lldpctl.

$ apt install lldpd
$ service start lldpd
$ # wait few seconds
$ lldpctl
-------------------------------------------------------------------------------
LLDP neighbors:
-------------------------------------------------------------------------------
Interface:    eno1, via: LLDP, RID: 2, Time: 0 day, 00:01:34
  Chassis:
    ChassisID:    mac xx:xx:xx:xx:xx:xx
    SysName:      xxx.net
    SysDescr:     Cisco Nexus Operating System (NX-OS) Software 7.0(3)I7(5a)
                  TAC support: http://www.cisco.com/tac
                  Copyright (c) 2002-2018, Cisco Systems, Inc. All rights reserved.
    Capability:   Bridge, on
    Capability:   Router, on
  Port:
    PortID:       ifname Ethernet1/22    <- here is the switch port number
    PortDescr:    serv01
    TTL:          120
  VLAN:         202, pvid: yes
  Unknown TLVs:
    TLV:          OUI: 00,01,42, SubType: 1, Len: 1 01
3
  • This is indeed a nice approach; given the context of the question one can assume the switch involved does support LLDP ;-). (As a side note, apt install lldpd will start the service for you, you shouldn’t need the service start command.) Jun 4, 2019 at 9:36
  • I had to service start that why i wrote it :)
    – albttx
    Jun 4, 2019 at 11:13
  • That’s weird — most Debian/Ubuntu packages automatically start their services, and I checked on a clean VM on my end (and lldpd was started by the package). Oh well :-/. Jun 4, 2019 at 11:30
2

You can use arping (from the iputils-arping package, in Ubuntu):

arping -I enp0s25 10.10.10.2

will ping 10.10.10.2 using ARP on interface enp0s25, even if the interface doesn’t yet have an IP address. If you use an IP address corresponding to a machine connected to another port on your switch, you can use that to identify which port each interface is connected to: arping will switch to unicast ARP as soon as it receives a reply.

1
  • Ah, I tried this using arping from the apring package and it sent only broadcast packets, which was not helpful. Switching to the iputils-apring package worked. (It looks like the version in the arping package can send unicast packets to a MAC address though, which I didn't try before installing the other.) May 15, 2018 at 15:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .