zoukankan      html  css  js  c++  java
  • CentOS7系统更改网卡名为eth0

    centOS7系统更改网卡名为eth0

    1、编辑grub参数

    [root@localhost ~]# vim /etc/sysconfig/grub

    2、在GRUB_CMDLINE_LINUX行中添加以下红色部分参数(双引号一定要加

    GRUB_CMDLINE_LINUX="crashkernel=auto "net.ifnames=0 biosdevname=0" rhgb quiet"

    3、重新生成grub配置文件

    [root@localhost ~]# grub2-mkconfig /boot/grub2/grub.cfg 
    Generating grub configuration file ...
    #
    # DO NOT EDIT THIS FILE
    #
    # It is automatically generated by grub2-mkconfig using templates
    # from /etc/grub.d and settings from /etc/default/grub
    #

    4、重启系统

    [root@localhost ~]# reboot

    此时运行ip addr 可以看到eth0

    [root@localhost ~]# ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 00:0c:29:7d:68:5e brd ff:ff:ff:ff:ff:ff
        inet 192.168.43.43/24 brd 192.168.43.255 scope global noprefixroute dynamic eth0
           valid_lft 3257sec preferred_lft 3257sec
        inet6 fe80::caaa:d49f:54d3:32cd/64 scope link noprefixroute 
           valid_lft forever preferred_lft forever
    3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 
        link/ether 52:54:00:6e:c8:cc brd ff:ff:ff:ff:ff:ff
        inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
           valid_lft forever preferred_lft forever
    4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500
        link/ether 52:54:00:6e:c8:cc brd ff:ff:ff:ff:ff:ff

    5、在网卡参数配置文件中修改网卡名

    [root@localhost ~]#cd /etc/sysconfig/network-scripts/
    [root@localhost network-scripts]# mv ifcfg-ens33 ifcfg-eth0
    [root@localhost network-scripts]# vim ifcfg-eth0 

    修改文件中的NAME和DEVICE为eth0。其余参数不变。最后重启网络服务。

    NAME=eth0
    DEVICE=eth0
    [root@localhost ~]# systemctl restart network.service

    完成

  • 相关阅读:
    集训Day 7 2020.3.7 动态规划(二)
    集训Day 6 2020.3.6 动态规划(一)
    集训Day 5 2020.3.4 杂题选讲(二)
    集训Day 4 2020.3.3 杂题选讲(一)
    集训Day 2 2020.3.1 数论(质数与筛法)
    集训Day 1 2020.2.29 数论复习(gcd)(一)
    [BZOJ4152]The Captain
    知识点清单(全)
    字符串相关知识
    分块相关知识
  • 原文地址:https://www.cnblogs.com/volac/p/9788219.html
Copyright © 2011-2022 走看看