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

    
    
    设置网卡1:
    > /etc/sysconfig/network-scripts/ifcfg-ens33
    echo TYPE=Ethernet >> /etc/sysconfig/network-scripts/ifcfg-ens33
    echo BOOTPROTO=none >> /etc/sysconfig/network-scripts/ifcfg-ens33
    echo NAME=eth0 >> /etc/sysconfig/network-scripts/ifcfg-ens33
    echo DEVICE=eth0 >> /etc/sysconfig/network-scripts/ifcfg-ens33
    echo ONBOOT=yes >> /etc/sysconfig/network-scripts/ifcfg-ens33
    echo IPADDR=192.168.2.141 >> /etc/sysconfig/network-scripts/ifcfg-ens33
    echo PREFIX=24 >> /etc/sysconfig/network-scripts/ifcfg-ens33
    echo #GATEWAY=192.168.2.1 >> /etc/sysconfig/network-scripts/ifcfg-ens33
    echo #DNS1=114.114.114.114 >> /etc/sysconfig/network-scripts/ifcfg-ens33
    mac=`ifconfig ens33|grep ether|awk '{print $2}'`
    sed -i '/BOOTPROTO/aHWADDR='$mac'' /etc/sysconfig/network-scripts/ifcfg-ens33
    more /etc/sysconfig/network-scripts/ifcfg-ens33
    mv /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-eth0
    设置网卡2:
    > /etc/sysconfig/network-scripts/ifcfg-ens34
    echo TYPE=Ethernet >> /etc/sysconfig/network-scripts/ifcfg-ens34
    echo BOOTPROTO=none >> /etc/sysconfig/network-scripts/ifcfg-ens34
    echo NAME=eth1 >> /etc/sysconfig/network-scripts/ifcfg-ens34
    echo DEVICE=eth1 >> /etc/sysconfig/network-scripts/ifcfg-ens34
    echo ONBOOT=yes >> /etc/sysconfig/network-scripts/ifcfg-ens34
    echo #IPADDR=192.168.2.139 >> /etc/sysconfig/network-scripts/ifcfg-ens34
    echo #PREFIX=24 >> /etc/sysconfig/network-scripts/ifcfg-ens34
    echo #GATEWAY=192.168.2.1 >> /etc/sysconfig/network-scripts/ifcfg-ens34
    echo DNS1=114.114.114.114 >> /etc/sysconfig/network-scripts/ifcfg-ens34
    mac=`ifconfig ens34|grep ether|awk '{print $2}'`
    sed -i '/BOOTPROTO/aHWADDR='$mac'' /etc/sysconfig/network-scripts/ifcfg-ens34
    more ifcfg-ens34
    mv /etc/sysconfig/network-scripts/ifcfg-ens34 /etc/sysconfig/network-scripts/ifcfg-eth1
    设置网卡唯一属性并重启生效
    sed -i 's/rhgb/net.ifnames=0 biosdevname=0 &/' /etc/default/grub
     grub2-mkconfig -o /boot/grub2/grub.cfg
    reboot
    
    
    
     
  • 相关阅读:
    LinkedList -链表集合
    java包装类,自动装箱,拆箱,以及基本数据类型与字符串的转换
    StringBuilder -字符串缓冲区,节约内层空间变长数组
    System的两常用个静态方法
    StringBuilder
    mysql
    空房间
    数据结构占坑
    sql语句优化
    editPlus快捷键
  • 原文地址:https://www.cnblogs.com/vincent-liang/p/8506113.html
Copyright © 2011-2022 走看看