您好,登錄后才能下訂單哦!
導(dǎo)讀 | 本文檔介紹更改 RHEL7 或者 CentOS 7 的網(wǎng)卡名稱的方法,按照以下步驟來(lái)操作就可以實(shí)現(xiàn)。 |
[root@Jaking11 ~]# ifconfig ens33: flags=4163mtu 1500 inet 192.168.10.11 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::250:56ff:fe29:eae prefixlen 64 scopeid 0x20 ether 00:50:56:29:0e:ae txqueuelen 1000 (Ethernet) RX packets 132 bytes 14492 (14.1 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 115 bytes 13105 (12.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10loop txqueuelen 1000 (Local Loopback) RX packets 140 bytes 11204 (10.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 140 bytes 11204 (10.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@Jaking11 ~]# [root@Jaking11 ~]# cd /etc/sysconfig/network-scripts/ [root@Jaking11 network-scripts]# ls ifcfg-ens33 ifdown-ppp ifup-eth ifup-sit ifcfg-lo ifdown-routes ifup-ippp ifup-Team ifdown ifdown-sit ifup-ipv6 ifup-TeamPort ifdown-bnep ifdown-Team ifup-isdn ifup-tunnel ifdown-eth ifdown-TeamPort ifup-plip ifup-wireless ifdown-ippp ifdown-tunnel ifup-plusb init.ipv6-global ifdown-ipv6 ifup ifup-post network-functions ifdown-isdn ifup-aliases ifup-ppp network-functions-ipv6 ifdown-post ifup-bnep ifup-routes [root@Jaking11 network-scripts]# mv ifcfg-ens33 ifcfg-eth0 [root@Jaking11 network-scripts]# vim ifcfg-eth0 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no NAME=eth0 DEVICE=eth0 ONBOOT=yes IPADDR=192.168.10.11 GATEWAY=192.168.10.2 NETMASK=255.255.255.0
此功能通過(guò)
/etc/default/grub
文件來(lái)控制,要禁用此功能,在文件中加入
"net.ifnames=0 biosdevname=0"
即可
[root@Jaking11 network-scripts]# vim /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0" GRUB_DISABLE_RECOVERY="true"
在/etc/udev/rules.d目錄中創(chuàng)建一個(gè)網(wǎng)卡規(guī)則70-persistent-net.rules文件,在文件中寫(xiě)入以下參數(shù):
SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="需要修改名稱的網(wǎng)卡MAC地址",ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"
參考配置:
[root@Jaking11 rules.d]# vim 70-persistent-net.rules SUBSYSTEM=="net",ACTION=="add",DRIVERS=="?*",ATTR{address}=="00:50:56:29:0e:ae", ATTR{type}=="1" ,KERNEL=="eth*",NAME="eth0"
[root@Jaking11 rules.d]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-fe49b659ccb940fa8d260a5897c0b08a Found initrd image: /boot/initramfs-0-rescue-fe49b659ccb940fa8d260a5897c0b08a.img done
[root@Jaking11 ~]# ifconfig eth0: flags=4163mtu 1500 inet 192.168.10.11 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::250:56ff:fe29:eae prefixlen 64 scopeid 0x20 ether 00:50:56:29:0e:ae txqueuelen 1000 (Ethernet) RX packets 86 bytes 10889 (10.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 95 bytes 10828 (10.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
以上就是更改 RHEL7 或者 CentOS 7 的網(wǎng)卡名稱的方法,最后看到 eth0 說(shuō)明網(wǎng)卡名稱更改成功!
本文原創(chuàng)地址: https://www.linuxprobe.com/rhel7-centos7-network.html
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。