In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the example analysis of changing the name of the network card on CentOS 6.x. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
There are three ways to modify the name of the Nic under CentOS 6.x:
Method 1:
Modify the UDEV file and delete its contents; use the command to redefine the name, and change both names
Method 2:
In centos6, you can directly use setup to set up a new network card and fill in eth2, ip and so on.
In CentOS 6, the default kudzu, a hardware-aware service, no longer exists, and almost all hardware management is managed through Udev.
If you add a new hardware to Centos 6, such as a network card, you only need to restart udev.
Start_udev
It will rescan the newly added hardware and do relevant processing.
If you add a new network card, identify the wrong network card and sometimes want to update the name of the network card, you do not need to edit the content under / etc/sysconfig/network-scripts/. If it is not normal after running to it, you can directly modify the network configuration of udev.
The configuration file for the specific Nic serial number of the udev of the network is / etc/udev/rules.d/70-persistent-net.rules.
The general content is as follows:
SUBSYSTEM== "net", ACTION== "add", DRIVERS== "? *", ATTR {address} = = "54:52:00:78:e8:2e", ATTR {type} = = "1", KERNEL== "eth*", NAME= "eth2" # PCI device
0x1af4:0x1000 (virtio-pci) SUBSYSTEM== "net", ACTION== "add", DRIVERS== "? *", ATTR {address} = = "54 net 52 2 00V 0419V 6c", ATTR {type} = = "1", KERNEL== "eth*"
NAME= "eth0"
With reference to the above, you can modify the MAC address and NAME at most.
After the modification is completed, use the command of udev to test:
Udevadm test / sys/class/net/eth0/
This command can show the process of udev identification and processing in detail.
Note:
Newly added hardware, if a network card is added to setup and system-config-network-tui, but / etc/sysconfig/network-scripts/ cannot find the configuration file.
Because these commands will by default put the generated configuration files in / etc/sysconfig/networking/devices/, as long as the following two configuration files are put in / etc/sysconfig/network-scripts/, for reuse
System-config-network-tui can be configured.
Code example: cp / etc/sysconfig/networking/devices/* / etc/sysconfig/network-scripts/
Then it can take effect after reboot.
Method 3:
1. Add the startup parameters of biosdevname=0 in grub, such as
Kernel / vmlinuz-2.6.32-131.21.1.el6.i686 ro root=/dev/mapper/vg_test-lv_root rd_LVM_LV=vg_test/lv_root rd_LVM_LV=vg_test/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latar
Cyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet biosdevname=0
2. Delete the configuration file rm-f / etc/udev/rules.d/70-persistent-net.rules of udev
3. Rename the network card configuration file
Mv ifcfg-em1 ifcfg-eth0
4. Modify the contents of the configuration file of the network card and change all the em1 to eth0.
You can replace it by using perl-p-I-e's ifcfg-eth0 or sed-I-I's.
5. Restart the system.
This is the end of the article on "sample Analysis of changing the name of CentOS 6.x Network Card". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.