centos7网卡重命名eth0
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7网卡重命名eth0相关的知识,希望对你有一定的参考价值。
[[email protected]~]# ifconfig ens8:flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.112 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::eda5:e2c1:5b96:46b5 prefixlen 64 scopeid 0x20<link> ether 52:54:00:c4:8d:84 txqueuelen 1000 (Ethernet) RX packets 72 bytes 12810 (12.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 10 bytes 1308 (1.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 编辑/etc/sysconfig/grub文件内容,下边是编辑前的文件内容: vim/etc/default/grub 增加“net.ifnames=0 biosdevname=0”,编辑后的文件内容: GRUB_CMDLINE_LINUX="crashkernel=autord.lvm.lv=cl/root net.ifnames=0 biosdevnamee=0 rd.lvm.lv=cl/swapconsole=ttyS0,115200" 执行:grub2-mkconfig -o/boot/grub2/grub.cfg [[email protected]~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grubconfiguration file ... Found linuximage: /boot/vmlinuz-3.10.0-514.el7.x86_64 Found initrdimage: /boot/initramfs-3.10.0-514.el7.x86_64.img Found linuximage: /boot/vmlinuz-0-rescue-2220a6d1a36a4fbb8523e078b3dfe795 Found initrdimage: /boot/initramfs-0-rescue-2220a6d1a36a4fbb8523e078b3dfe795.img [ 7136.636287]xor: automatically using best checksumming function: [7136.648028] avx : 38496.000 MB/sec [ 7136.670721]raid6: sse2x1 gen() 12937 MB/s [ 7136.687762]raid6: sse2x2 gen() 16453 MB/s [ 7136.704811]raid6: sse2x4 gen() 13433 MB/s [ 7136.721846]raid6: avx2x1 gen() 21781 MB/s [ 7136.738915]raid6: avx2x2 gen() 32109 MB/s [ 7136.755964]raid6: avx2x4 gen() 34687 MB/s [ 7136.756797]raid6: using algorithm avx2x4 gen() (34687 MB/s) [ 7136.757976]raid6: using avx2x2 recovery algorithm [ 7136.796156]Btrfs loaded [ 7136.805566]fuse init (API version 7.22) done 重新对 文件进行命名: /etc/sysconfig/network-scripts/ifcfg-* 重启电脑网卡也会自动变 [[email protected]~]# ifconfig eth0:flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.112 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::1e89:5915:c6b6:2eb1 prefixlen 64 scopeid 0x20<link> ether 52:54:00:c4:8d:84 txqueuelen 1000 (Ethernet) RX packets 29 bytes 4669 (4.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 35 bytes 3334 (3.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eth1:flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.172 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::5054:ff:fe9d:7a94 prefixlen 64 scopeid 0x20<link> ether 52:54:00:9d:7a:94 txqueuelen 1000 (Ethernet) RX packets 59 bytes 12755 (12.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9 bytes 1246 (1.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo:flags=73<UP,LOOPBACK,RUNNING> mtu65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1 (Local Loopback) RX packets 8 bytes 680 (680.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 8 bytes 680 (680.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ifconfig eth0 192.168.0.171 netmask 255.255.255.0 && route add default gw 192.168.0.1 配置临时IP
以上是关于centos7网卡重命名eth0的主要内容,如果未能解决你的问题,请参考以下文章