4

I read that the nameif is deprecated, although I still see it on my Ubuntu 14.04 system. If this command is deprecated, is the command cited for removal or will it still be available?

This command is extremely useful when trying to make consistent interface names particularly when your NIC's are constantly changing. Modifying udev (/etc/udev/rules.d/70-persistent-net.rules) is only useful when your NIC configuration is static.

In my case, the NIC's on my system are changing as it is a test bed and I have a startup script which reads the system mac addresses and NIC mac addresses, generates /etc/mactab file and runs nameif to make my interface names consistent.

It seems that ip link command is the replacement for nameif although it only seems to change interface names based on another interface name:

ip link set { dev DEVICE } [ name NEWNAME ]

This is not as friendly because first you have to find the mapping between mac address and interface name, and then perform your changes (see ip link help).

Is there a replacement command like nameif where the interface name can be set on the fly by the mac address? If not, is it ok to continue to use nameif?

  • You dynamically generate /etc/mactab; why can't you dynamically generate udev rules instead? Or, alternatively, write some udev rules that use a helper script to get the name? Or, finally, if you only have one interface, and always want it to be eth0... just turn off persistent names. – derobert Jul 29 '14 at 21:13
  • Or, in other words, 70-persistent-net.rules is nothing special. It's just an ordinary udev rules file, written by /lib/udev/rules.d/75-persistent-net-generator.rules – derobert Jul 29 '14 at 21:15
  • 2
    deprecated means that it can become unsupported in the future, and there are better way to do the same thing. It doesn't mean that you can't use it, especially in a test environment. It means that you shouldn't develop long term solution based on it, because they will become legacy soon. – pqnet Sep 2 '14 at 0:22
1

Is nameif deprecated?

is it ok to continue to use nameif?

Yes. Yes, it is. Just that there are more reliable methods to set the MAC of an interface, like using udev rules.

If so is there an equivalent replacement?

As mentioned before, you could use specials udev rules to set the MAC address however you like.

In my case, the NIC's on my system are changing as it is a test bed and I have a startup script which reads the system mac addresses and NIC mac addresses, generates /etc/mactab file and runs nameif to make my interface names consistent.

Remember that you should make these changes before the device is UP, so in your case it should work just fine without it.

  • nameif - like netstat, and ifconfig - is a member of the net-tools package, and, as such, has not seen a Linux release in more than a decade. Thanks, @Braiam. – mikeserv Sep 2 '14 at 0:26
  • Thanks. If I will have an unknown number of network interfaces on a system, how can I make sure they are all disabled on Centos and Ubuntu. Do you know? – user1527227 Sep 2 '14 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.