1

I am automating the installation of a linux system. One of the things I am doing is setting up the interfaces (Giving them static ips and such). I would like to know if the interfaces are named when the ifcfg-* scripts under /etc/sysconfig/network-scripts run on if the their names are set somewhere else. For instance, I have the following script named ifcfg-Installation:

TYPE=Ethernet
DEVICE=eth0
IPADDR=192.168.1.1
PREFIX=24
ONBOOT=yes

If I change the DEVICE=eth0 to DEVICE=installation. Assuming this is the first network script that runs. Would linux simply assign the first ethernet interface it has to have name installation? Or will it try to find an interface with device name installation and assign those settings to it?

I am running CentoOS6.3 for this (Don't know if this is relevant)

1
  • Try it and see.... Commented Aug 22, 2016 at 21:01

1 Answer 1

3

They are named somewhere else:

On newer linux systems(Centos starting with 7.0), interfaces are usually named using something called systemd persistent device naming, which assigns a name to the device based on the physical position in the system(although that can fail in practice).

Centos 6.3 names ethernet interfaces using udev: When the system is first booted, it enumerates all ethernet interfaces and assigns names starting from eth0 upwards, which then get saved to /etc/udev/rules.d/70-persistent-net.rules and reapplied on each boot. Whenever a new interface is attached the counter gets incremented by one and it is added to that file.

2
  • On RHEL7/Centos7 you can revert to eth0..ethN style of interface naming using startup parameters of course. I've had to resort to this as some of the licensing for various tools like ONLY eth0. Commented Aug 22, 2016 at 21:29
  • 1
    Yup, udev does the trick in there. And to make a udev rule to give the interface a fixed name always (assuming the installation happens on exactly the same kind of machine) you can check /sys/class/net/eth0/device (which will give you the PCI). Commented Aug 22, 2016 at 22:07

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.