Linux Interface Names

For convenience I like to name the interfaces for my desktop/laptop in an easy to remember convention so that I don’t need to think about what the interface names are at all when running things like tcpdump.

The best way I have found to do this is with udev rules. The original interface names will remain as an alias so you can still refer to the interface using the old name as well.

The udev rule(s) can be created in this file:

/etc/udev/rules.d/70-persistent-net.rules

An example of the rules I use for laptop:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="74:78:27:1b:e2:dd", NAME="lan0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="dc:41:a9:43:df:1e", NAME="wifi0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="74:78:27:91:77:62", NAME="dock0"

The address attribute should be the MAC address of the interface that you would like to rename. If required other attributes can be used to match (useful in the case of using multiple USB network devices).

Leave a Reply

Your email address will not be published.