6

Please, give me a clue, where it's located?

it's not under /etc/udev/rules.d anymore

# find / -name "*persistent-net.rules" didn't find anything...

4
  • What are you looking to do with the udev rules? – dyasny Jul 28 '14 at 17:52
  • we changed hardware and I wanna move enp4s0 back to enp1s0, like in centos6 before eth[*] to eth0 – Shirker Jul 28 '14 at 18:03
  • To do that, you'll have to move the NIC port to the same physical address. Or override the general use of hardware oriented NIC naming. – dyasny Jul 28 '14 at 18:14
  • 2
    In that case, move the NIC back to the other slot. – Michael Hampton Jul 28 '14 at 18:58
9

Centos 7 and Redhat 7 by defaults uses biosdevname

rpm -qi biosdevname-0.5.0-10.el7.x86_64
Summary     : Udev helper for naming devices per BIOS names
Description :
biosdevname in its simplest form takes a kernel device name as an
argument, and returns the BIOS-given name it "should" be.  This is necessary
on systems where the BIOS name for a given device (e.g. the label on
the chassis is "Gb1") doesn't map directly and obviously to the kernel
name (e.g. eth0).
3

There is one more method to control network link names in RHEL/CentOS 7 with systemd.

Create new dir if it is absent:

mkdir /etc/systemd/network

Create new rule file in it. File extension must be .link, or it will be ignored

cat /etc/systemd/network/10-lan0.link
   [Match]
   MACAddress=00:50:56:b7:65:2b

   [Link]
   Name=lan0

Create configuration file for this interface:

cat /etc/sysconfig/network-scripts/ifcfg-lan0 
   IPADDR="192.168.6.8"
   GATEWAY="192.168.6.254"
   NETMASK="255.255.255.0"
   BOOTPROTO="static"
   DEVICE="lan0"
   ONBOOT="yes"
   IPV6INIT="no"

Here systemd.link(5) you could read description how to create custom rules, there are many options for naming. Also there are some examples. Unfortunately this man page systemd.link(5) is absent in RHEL7, but is works.

Here you could read about new common naming policy of network interfaces. You may change this policy for some interfaces in system or for all interfaces.

0

If it is not there, you can simply create it!

The rules will apply. Here is my example:

[root@WesternStar rules.d]# pwd

/etc/udev/rules.d

[root@WesternStar rules.d]# cat 70-persistent-net.rules |grep -v \#

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:4e:40:9a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

[root@WesternStar rules.d]#
1
  • 2
    Could be that centos7 doesn't use 70-persistent-net.rules file anymore? – Shirker Jul 28 '14 at 21:15
-2

Try /usr/lib/udev/rules.d/60-net.rules

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.