Solve the Nic naming problem of centos7

Source: Internet
Author: User
In the pxe installation test of centos7, we found that Nic naming is not followed by naming rules and the latest naming method is enabled. the official website documents are described as follows: in RedHatEnterpriseLinux7, systemd and udevd support a large number of different naming schemes. By default, a fixed name is assigned based on the firmware, topology, and location information. Optimization of this naming method

In the pxe installation test of centos7, we found that Nic naming is not followed by naming rules and the latest naming method is enabled. the official website documents are described as follows:

 

In Red Hat Enterprise Linux 7, SystemdAnd UdevdSupports a large number of different naming schemes. By default, a fixed name is assigned based on the firmware, topology, and location information. The advantage of this naming method is that it is completely automatic and predictable, even if the hardware is added or deleted, it will not change (not relisting ), the damaged hardware can be replaced without any impact. The disadvantage of this behavior is that the name is sometimes more difficult to read than the previous name, for example, replacing eth0 with enp5s0. Currently UdevdThe following naming schemes are supported. Solution 1: the firmware or BIOS name is the name of the index number provided by the onboard device, for example, eno1. If the firmware information is applicable and available SystemdBy default, the interface is named based on this scheme, and solution 2 is used as an alternative. Solution 2: combine the firmware or BIOS name to provide the PCI shortcut hot swapping slot index number, for example, ens1. If the firmware information is applicable and available SystemdBy default, the interface is named based on this scheme, and solution 3 is used as an alternative. Solution 3 merge the name of the physical location of the hardware connector, for example, enp2s0. If the firmware information is applicable and available SystemdBy default, the interface is named based on this scheme, and solution 5 is used as an alternative. Solution 4: name of the MAC address of the merge interface, for example, enx78e7d1ea46da. By default SystemdThe interface will not be named according to this scheme, but this function can be enabled if necessary. Solution 5 name the traditional unpredictable kernel attribute ethX, for example, eth0. If all other methods fail, SystemdName the interface according to this scheme. If the system enables BIOSDEVNAME, or you have added UdevdRules, these rules will replace the default SystemdPolicy.
1. the solution is as follows:

These are the necessary steps:

  • Add "net. ifnames = 0" and "biosdevname = 0" as kernel arguments to grub
  • In '/etc/sysconfig/network-scripts/'change your configured NIC config file to 'ifcfg-ethX'
  • If you have multiple interfaces and want to control naming of each device rather than leader the kernel do in its own way,/etc/udev/rules. d/60-net.rules seems necessary to override/usr/lib/udev/rules. d/60-net.rules.
  • From: http://wiki.centos.org/FAQ/CentOS7
2. since centos7 is guided by grub2, you need to modify grub2 as follows:
Add "net. ifnames = 0 biosdevname = 0" to vim/etc/defaut/grub"
Grub2-mkconfig-o/boot/grub2/grub. cfg

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.