CentOS 7 修改网卡命名为传统ethx

CentOS 6和CentOS 7网卡名称区别

  • CentOS 6 基于传统的命名方式ethx,如eth0、eth1等。
  • CentOS 7 开始系统默认的网卡命名会根据网卡的硬件信息、插槽位置相关。
    CentOS 7 较之CentOS 6 的优点是命名全自动、可预知,但也会加大阅读难度。

CentOS 7 配置传统命名方式

系统安装过程中修改
  1. 选择install CentOS 7 后按Tab键
    在这里插入图片描述
  2. 添加修改网卡命名规则参数
    net.ifnames=0 biosdevname=0
    按回车
系统安装完成后修改
  1. 查看当前网卡名称

    [root@localhost Desktop]# ifconfig
    eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.75.132  netmask 255.255.255.0  broadcast 192.168.75.255
            inet6 fe80::20c:29ff:fe00:839a  prefixlen 64  scopeid 0x20<link>
            ether 00:0c:29:00:83:9a  txqueuelen 1000  (Ethernet)
            RX packets 26  bytes 5227 (5.1 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 26  bytes 4139 (4.0 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
  2. 编辑网卡配置文件中网卡名称信息

    [root@localhost Desktop]# vim /etc/sysconfig/network-scripts/ifcfg-eno16777728 
    NAME="eth0"   
    DEVICE="eth0" 
    
  3. 重命名网卡配置文件名称信息

    [root@localhost Desktop]# mv /etc/sysconfig/network-scripts/ifcfg-eno16777728 /etc/sysconfig/network-scripts/ifcfg-eth0
    
  4. 编辑内核参数
    在GRUB_CMDLINE_LINUX后加入net.ifnames=0 biosdevname=0

    [root@localhost Desktop]# vim /etc/default/grub 
    
    GRUB_CMDLINE_LINUX="rhgb quiet net.ifnames=0 biosdevname=0"
    
  5. 使系统重新加载grub配置文件
    编辑完grub配置文件后不会立即生效,需要生成配置文件

    [root@localhost Desktop]# grub2-mkconfig -o /etc/grub2.cfg 
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
    Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
    Found linux image: /boot/vmlinuz-0-rescue-3e8f17dddca14000849b1775948ff329
    Found initrd image: /boot/initramfs-0-rescue-3e8f17dddca14000849b1775948ff329.img
    done
    
  6. 重启系统并验证

    [root@localhost Desktop]# ifconfig
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.75.132  netmask 255.255.255.0  broadcast 192.168.75.255
            inet6 fe80::20c:29ff:fe00:839a  prefixlen 64  scopeid 0x20<link>
            ether 00:0c:29:00:83:9a  txqueuelen 1000  (Ethernet)
            RX packets 17  bytes 3752 (3.6 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 24  bytes 4314 (4.2 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值