網(wǎng)卡設(shè)備的命名過程:
第一步:
udev, 輔助工具程序/lib/udev/rename_device
/usr/lib/udev/rules.d/60-net.rules
第二步:
biosdevname 會(huì)根據(jù)/usr/lib/udev/rules.d/71biosdevname.rules
第三步:
通過檢測(cè)網(wǎng)絡(luò)接口設(shè)備,根據(jù)/usr/lib/udev/rules.d/75-net-description
ID_NET_NAME_ONBOARD
ID_NET_NAME_SLOT
ID_NET_NAME_PATH
Centos6
網(wǎng)絡(luò)接口識(shí)別并命名相關(guān)的udev配置文件:
[root@centos6 ~]#cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?", ATTR{address}=="00:0c:29:23:71:94", ATTR{type}=="1", KERNEL=="eth", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?", ATTR{address}=="00:0c:29:23:71:9e", ATTR{type}=="1", KERNEL=="eth", NAME="eth1"
[root@centos6 ~]#
通過修改配置文件赁酝,可以修改網(wǎng)卡名稱
Centos7
采用傳統(tǒng)命名方式
使用傳統(tǒng)命名方式:
(1) 編輯/etc/default/grub配置文件
GRUB_CMDLINE_LINUX="rhgb quiet net.ifnames=0"
sed -r 's/(quiet)/\1 net.ifnames=0/' /etc/default/grub
或直接修改/boot/grub2/grub.cfg ?
(2) 為grub2生成其配置文件
grub2-mkconfig -o /etc/grub2.cfg
(3) 重啟系統(tǒng)
CentOS 7網(wǎng)絡(luò)配置工具
CentOS7主機(jī)名
配置文件:/etc/hostname 默認(rèn)沒有此文件犯祠,通過DNS反向解析獲取主機(jī)名,主機(jī)名默認(rèn)為:localhost.localdomain
顯示主機(jī)名信息
hostname hostnamectl status
設(shè)置主機(jī)名
hostnamectl set-hostname centos7.magedu.com
刪除文件/etc/hostname酌呆,恢復(fù)主機(jī)名localhost.localdomain
CentOS 7網(wǎng)絡(luò)配置工具
圖形工具:nm-connection-editor
字符配置tui工具:nmtui