# FreeBSD Ethernet Manipulation



## billli (Dec 29, 2011)

I need a method to perform the following task, suppose if I have a computer with k (k is large) number of Ethernet interfaces. I want to have a method to identify which identifier (em0) is assigned to which physical interface.

The only "easy" method that I came up is to blink the LED light on the physical interface.

For example


```
etherblink em0
```

Would flash the link or the activity LED on the physical Ethernet interface that is assigned to em0.

I know on linux there is the ethertool, but that doesn't work with FreeBSD. As well as there is the LED driver on FreeBSD, but that only support limited number of Ethernet modules.

Any ideas? I thought about binding a socket to the interface and write to the socket, but that didn't work.


----------



## DutchDaemon (Dec 29, 2011)

You can rename the interfaces any way you like in /etc/rc.conf, so if you have a physical labeling setup (stickers/labels like NIC1, NIC2, etc.), you can name your interfaces the same way at the OS level. You'll only have to figure out the relationship once.


----------



## aragon (Dec 30, 2011)

billli said:
			
		

> Any ideas?


Not exactly what you had in mind, but you can try this:

`# cat /var/run/devd.pipe`

And then connect/disconnect one of the ethernet cards to/from its uplink.  The link change event will be shown in your cat output along with the device name.


----------



## wblock@ (Dec 30, 2011)

Some cards blink the LEDs on access, so pings could make a repeated pattern.  The LEDs might even go off if the card is downed with ifconfig(8).


----------

