# Renaming interfaces by MAC address

## frozenQueue

Hi. I need to make sure two eth interface names on a PC are each always matched to the correct interface (by MAC address). net.example file states:

```
# If you are unable to write udev rules, then we do provide a way of renaming

# the interface based on it's MAC address, but it is not optimal.

# Here is how to rename an interface whose MAC address is 00:11:22:33:44:55

# to foo1

#rename_001122334455="foo1"
```

May I ask why this is consider "not optimal"? (E.g., unreliable?) I confess I have not yet learned how to write udev rules but will learn if necessary.

----------

## BradN

I believe this is already done for you out-of-the-box so to speak.  I just recently cloned a gentoo install to another machine and the ethx numbers continued numbering past the numbers that were present on the first machine.

Unless you need to specifically *name* those interfaces, you should already have the assurance that the numbers won't flip around arbitrarily.

----------

## frozenQueue

 *BradN wrote:*   

> I believe this is already done for you out-of-the-box so to speak.  I just recently cloned a gentoo install to another machine and the ethx numbers continued numbering past the numbers that were present on the first machine.
> 
> Unless you need to specifically *name* those interfaces, you should already have the assurance that the numbers won't flip around arbitrarily.

 

Thank you for the reply. However, could you provide more details as to what internal system or scripting would ensure this capability. You see, I am looking for certainty here, as I am creating a multi-interface device that must work correctly the next 1000 times it is used, even if I am not around to maintain it.

----------

## py-ro

View in 

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

Py

----------

## BradN

The classic problem one runs into is if a NIC burns out and someone installs another card - even if the drivers are correct, it will get a new interface number, and then /etc/udev/rules.d/70-persistent-net.rules must be manually edited.

----------

