zoukankan      html  css  js  c++  java
  • Centos6/7,Ubuntu 网卡名称修改为相同

      默认centos6网卡名是eth0 ,centos7以后版本和Ubuntu网卡名都是ens33 ,在自动化运维时候网卡名不一样,会导致无法统一控制

        centos7:

    一、

       1、

    vim /etc/default/grub 

    找到下面这行:

    GRUB_CMDLINE_LINUX="rhgb quiet"

    在后面添加 net.ifnames=0 

    GRUB_CMDLINE_LINUX="rhgb quie net.ifnames=0 "

    使用grub2-mkconfig 命令重新生成grub配置并更新内核

    grub2-mkconfig -o /boot/grub2/grub.cfg

      2、 移动原来的配置文件为eth0

    mv /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-eth0

    修改配置文件中的ens33为eth0

    NAME=eth0
    DEVICE=eth0

      3、重启centos

    二、安装时修改

      安装界面,按Tab键 输入net.ifname=0 biosdevname=0

        Ubuntu

      1、登陆用户

      2、切换到root

     sudo -i

      3、修改配置

    vim /etc/default/grub 

    找到这行:

    GRUB_CMDLINE_LINUX=""

    修改为:

    GRUB_CMDLINE_LINUX="net.ifnames=0 "

    使用grub-mkconfig 命令重新生成grub配置并更新内核

    grub-mkconfig -o /boot/grub/grub.cfg 

      4、修改网卡配置(否则重启后没网络)

    vim ./etc/network/interfaces

    基于BIOS支持启用biosdevname软件
      内置网卡:em1,em2
        pci卡:pYpX Y:slot ,X:port
      (2) 名称组成格式
        en: Ethernet 有线局域网
        wl: wlan 无线局域网
        ww: wwan无线广域网
      名称类型:
        o<index>: 集成设备的设备索引号
        s<slot>: 扩展槽的索引号
        x<MAC>: 基于MAC地址的命名
        p<bus>s<slot>: enp2s1   #p表示总线

    ------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------- 博客均为个人笔记,无所追求,仅供参考~~~ QQ--2382990774
  • 相关阅读:
    CF 1114D(538,div2) Flood Fill
    UVA 1640 The Counting Problem
    UVA 11971 Polygon
    UVA 1639 Candy
    CCPC 2019 秦皇岛 Angle Beats
    UVA1153-Keep the Customer Satisfied(贪心)
    UVA1613-K-Graph Oddity(贪心)
    UVA11925-Generating Permutations(贪心)
    UVA11491-Erasing ans Winning(贪心)
    UVA12545-Bits Equalizer(思维)
  • 原文地址:https://www.cnblogs.com/alexlv/p/15186251.html
Copyright © 2011-2022 走看看