linux下修改网卡的名称

第一步修改网卡名称

cd /etc/sysconfig/network-scripts/
mv ifcfg-eno16777736 ifcfg-eth0

第二步 编辑修改后的网卡名称,注意将DEVICE名称和NAME名称修改

vim ifcfg-eth0 
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eth0
UUID=5d6f4309-b592-45c7-9f19-08b6140335a9
DEVICE=eth0
ONBOOT=no
DNS1=192.168.1.1
IPADDR=192.168.1.20
PREFIX=24
GATEWAY=192.168.1.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no

第三步编辑linux内核,GRUB_CMDLINE_LINUX="vconsole.keymap=us crashkernel=auto vconsole.font=latarcyrheb-sun16 rhgb quiet替换为如下所示

vim /etc/sysconfig/grub
GRUB_CMDLINE_LINUX="vconsole.keymap=us crashkernel=auto  vconsole.font=latarcyrheb-sun16 rhgb quiet net.ifnames=0"

第四步重启生效看见网卡的名称已经修改成功了

[root@centos network-scripts]# ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.40.194  netmask 255.255.255.0  broadcast 192.168.40.255
        inet6 fe80::20c:29ff:fe81:350a  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:81:35:0a  txqueuelen 1000  (Ethernet)
        RX packets 568  bytes 45018 (43.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 512  bytes 44984 (43.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 13  bytes 1360 (1.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 1360 (1.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@centos network-scripts]# 

发布了5 篇原创文章 · 获赞 1 · 访问量 154
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览