精华内容
下载资源
问答
  • linux修改网卡

    2012-10-07 10:48:39
    linux下的网卡修改指令,大家看看,希望对大家有所帮助
  • linux修改网卡.doc

    2020-04-30 14:49:23
    linux修改网卡技术分析
  • Linux修改网卡信息

    2020-03-31 20:54:34
    Linux修改网卡信息 cd /etc/sysconfig/network-scripts/ vi 网卡文件

    Linux修改网卡信息
    cd /etc/sysconfig/network-scripts/
    vi 网卡文件

    展开全文
  • linux修改网卡名称

    2020-11-27 16:10:51
    linux修改网卡名称 wflwn 2018-11-25 16:19:36 3343 收藏 2 展开 也许大家习惯了linux默认网卡为eth0,如果换成其他反而不适应,现在将它改为传统的eth0。 步骤一:使用ifconfig查看网卡的名称 步骤二:cd /etc/...

    linux修改网卡名称

    wflwn 2018-11-25 16:19:36 3343 收藏 2
    展开
    也许大家习惯了linux默认网卡为eth0,如果换成其他反而不适应,现在将它改为传统的eth0。

    步骤一:使用ifconfig查看网卡的名称

    步骤二:cd /etc/sysconfig/network-scripts

    进入到网卡目录,查看网卡文件名称为ifcfg-eno16777736,修改配置文件的名称为eth*。

    步骤三:修改NAME和DEVICE的名称,并增加MAC地址,修改完成之后ifcfg-eno16777736文件内容如下:

    步骤四:在终端执行sed -i ‘s/rhgb/net.ifnames=0 biosdevname=0 &/’ /etc/default/grub

    步骤五:再执行grub2-mkconfig -o /boot/grub2/grub.cfg

    步骤六:最后重启即可。

    重启之后使用ifconfig查看网卡的名称,发现网卡名已经改好
    ————————————————
    版权声明:本文为CSDN博主「wflwn」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/wflwn/article/details/84495166

    展开全文
  • 本篇文章主要介绍了Linux修改网卡名称、主机名的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
  • linux修改网卡名称脚本

    千次阅读 2019-01-10 18:04:19
    linux修改网卡名称 linux修改网卡名称脚本,在生活中大家在安装服务器中都会遇到装完系统后发现网卡名称为ens esp等等杂七杂八的网卡名,管理起来特别不方便,因此我写了一个脚本供大家参考,可直接复制粘贴,执行完...

    linux修改网卡名称

    linux修改网卡名称脚本,在生活中大家在安装服务器中都会遇到装完系统后发现网卡名称为ens esp等等杂七杂八的网卡名,管理起来特别不方便,因此我写了一个脚本供大家参考,可直接复制粘贴,执行完脚本后需重启服务器方可生效!

    #!/bin/bash
    
    n=`ip addr|awk -F ':' '{print $2}'|grep -v "^$"|grep e|wc -l`
    dir="/etc/sysconfig/network-scripts"
    dir1="/lib/udev/rules.d"
    date=`date +%Y-%m-%d`
    num=`ls /etc/sysconfig/network-scripts/|grep ifcfg-e|wc -l`
    rules="ACTION==\"add\", SUBSYSTEM==\"net\", DRIVERS==\"?*\", ATTR{type}==\"1\""
    
    ip addr|awk -F ':' '{print $2}'|grep -v "^$"|grep e&>>/tmp/oldname.txt
    ip addr|grep ether|awk '{print $2}' &>> /tmp/mac.txt
    sed -i '1'd  /tmp/oldname.txt
    sed -i 's/ //g' /tmp/oldname.txt 
    
    
    #network interface backup 
    mkdir $dir/network-$date.bak
    cp $dir/ifcfg-e* $dir/network-$date.bak
    cp $dir1/60-net.rules $dir/network-$date.bak/
    
    #create a new network card name
    for i in {0..5}
    do
      echo "ifcfg-eth$i" &>> /tmp/newname.txt
    done
    
    
        mac=`sed -n '1'p /tmp/mac.txt`
       mac2=`sed -n '2'p /tmp/mac.txt`
       mac3=`sed -n '3'p /tmp/mac.txt`
       mac4=`sed -n '4'p /tmp/mac.txt`
       mac5=`sed -n '5'p /tmp/mac.txt`
       mac6=`sed -n '6'p /tmp/mac.txt`
    
       olda=`sed -n '1'p /tmp/oldname.txt`
       oldb=`sed -n '2'p /tmp/oldname.txt`
       oldc=`sed -n '3'p /tmp/oldname.txt`
       oldd=`sed -n '4'p /tmp/oldname.txt`
       olde=`sed -n '5'p /tmp/oldname.txt`
       oldf=`sed -n '6'p /tmp/oldname.txt`
    
       newone=`sed -n '1'p /tmp/newname.txt`
       newtwo=`sed -n '2'p /tmp/newname.txt`
       newthree=`sed -n '3'p /tmp/newname.txt`
       newfore=`sed -n '4'p /tmp/newname.txt`
       newfive=`sed -n '5'p /tmp/newname.txt`
       newsix=`sed -n '6'p /tmp/newname.txt`
    
       #determine how many network cards there are 
       if [ $n -eq 1 ]
          then
         echo "$rules, ATTR{address}==\"$mac\", NAME=\"eth0\", GOTO=\"net_end\"" &>$dir1/60-net.rules
    mv $dir/$olda $dir/$newone
    sed -i 's/NAME/#NAME/g' $dir/$newone
    sed -i '/NAME/i\NAME=eth0' $dir/$newone
    sed -i 's/DEVICE/#DEVICE/g' $dir/$newone
    	sed -i '/DEVICE/i\DEVICE=eth0' $dir/$newone
    	echo "MACADDR=$mac" &>> $dir/$newone
       elif [ $n -eq 2 ]
          then
        echo "$rules, ATTR{address}==\"$mac\", NAME=\"eth0\", GOTO=\"net_end\"" &>$dir1/60-net.rules
     	echo "$rules, ATTR{address}==\"$mac2\", NAME=\"eth1\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        mv $dir/ifcfg-$olda $dir/$newone
        sed -i 's/NAME/#NAME/g' $dir/$newone
        sed -i '/NAME/i\NAME=eth0' $dir/$newone
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newone
        sed -i '/DEVICE/i\DEVICE=eth0' $dir/$newone
        echo "MACADDR=$mac" &>> $dir/$newone
        mv $dir/ifcfg-$oldb $dir/$newtwo
        sed -i 's/NAME/#NAME/g' $dir/$newtwo
        sed -i '/NAME/i\NAME=eth1' $dir/$newtwo
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newtwo
        sed -i '/DEVICE/i\DEVICE=eth1' $dir/$newtwo
        echo "MACADDR=$mac2" &>> $dir/$newtwo
       elif [ $n -eq 3 ]
          then
        echo "$rules, ATTR{address}==\"$mac\", NAME=\"eth0\", GOTO=\"net_end\"" &>$dir1/60-net.rules
     	echo "$rules, ATTR{address}==\"$mac2\", NAME=\"eth1\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        echo "$rules, ATTR{address}==\"$mac3\", NAME=\"eth2\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        mv $dir/ifcfg-$olda $dir/$newone
        sed -i 's/NAME/#NAME/g' $dir/$newone
        sed -i '/NAME/i\NAME=eth0' $dir/$newone
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newone
        sed -i '/DEVICE/i\DEVICE=eth0' $dir/$newone
        echo "MACADDR=$mac" &>> $dir/$newone
        mv $dir/ifcfg-$oldb $dir/$newtwo
        sed -i 's/NAME/#NAME/g' $dir/$newtwo
        sed -i '/NAME/i\NAME=eth1' $dir/$newtwo
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newtwo
        sed -i '/DEVICE/i\DEVICE=eth1' $dir/$newtwo
        echo "MACADDR=$mac2" &>> $dir/$newtwo
        mv $dir/ifcfg-$oldc $dir/$newthree
        sed -i 's/NAME/#NAME/g' $dir/$newthree
        sed -i '/NAME/i\NAME=eth2' $dir/$newthree
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newthree
        sed -i '/DEVICE/i\DEVICE=eth2' $dir/$newthree
        echo "MACADDR=$mac3" &>> $dir/$newthree
       elif [ $n -eq 4 ]
          then
        echo "$rules, ATTR{address}==\"$mac\", NAME=\"eth0\", GOTO=\"net_end\"" &>$dir1/60-net.rules
     	echo "$rules, ATTR{address}==\"$mac2\", NAME=\"eth1\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        echo "$rules, ATTR{address}==\"$mac3\", NAME=\"eth2\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        echo "$rules, ATTR{address}==\"$mac4\", NAME=\"eth3\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        mv $dir/ifcfg-$olda $dir/$newone
        sed -i 's/NAME/#NAME/g' $dir/$newone
        sed -i '/NAME/i\NAME=eth0' $dir/$newone
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newone
        sed -i '/DEVICE/i\DEVICE=eth0' $dir/$newone
        echo "MACADDR=$mac" &>> $dir/$newone
        mv $dir/ifcfg-$oldb $dir/$newtwo
        sed -i 's/NAME/#NAME/g' $dir/$newtwo
        sed -i '/NAME/i\NAME=eth1' $dir/$newtwo
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newtwo
        sed -i '/DEVICE/i\DEVICE=eth1' $dir/$newtwo
        echo "MACADDR=$mac2" &>> $dir/$newtwo
        mv $dir/ifcfg-$oldc $dir/$newthree
        sed -i 's/NAME/#NAME/g' $dir/$newthree
        sed -i '/NAME/i\NAME=eth2' $dir/$newthree
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newthree
        sed -i '/DEVICE/i\DEVICE=eth2' $dir/$newthree
        echo "MACADDR=$mac3" &>> $dir/$newfore		
        mv $dir/ifcfg-$oldd $dir/$newfore
        sed -i 's/NAME/#NAME/g' $dir/$newfore
        sed -i '/NAME/i\NAME=eth3' $dir/$newfore
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newfore
        sed -i '/DEVICE/i\DEVICE=eth3' $dir/$newfore
        echo "MACADDR=$mac4" &>> $dir/$newfore	
       elif [ $n -eq 5 ]
          then
        echo "$rules, ATTR{address}==\"$mac\", NAME=\"eth0\", GOTO=\"net_end\"" &>$dir1/60-net.rules
     	echo "$rules, ATTR{address}==\"$mac2\", NAME=\"eth1\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        echo "$rules, ATTR{address}==\"$mac3\", NAME=\"eth2\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        echo "$rules, ATTR{address}==\"$mac4\", NAME=\"eth3\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        echo "$rules, ATTR{address}==\"$mac5\", NAME=\"eth4\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        mv $dir/ifcfg-$olda $dir/$newone
        sed -i 's/NAME/#NAME/g' $dir/$newone
        sed -i '/NAME/i\NAME=eth0' $dir/$newone
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newone
        sed -i '/DEVICE/i\DEVICE=eth0' $dir/$newone
        echo "MACADDR=$mac" &>> $dir/$newone
        mv $dir/ifcfg-$oldb $dir/$newtwo
        sed -i 's/NAME/#NAME/g' $dir/$newtwo
        sed -i '/NAME/i\NAME=eth1' $dir/$newtwo
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newtwo
        sed -i '/DEVICE/i\DEVICE=eth1' $dir/$newtwo
        echo "MACADDR=$mac2" &>> $dir/$newtwo
        mv $dir/ifcfg-$oldc $dir/$newthree
        sed -i 's/NAME/#NAME/g' $dir/$newthree
        sed -i '/NAME/i\NAME=eth2' $dir/$newthree
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newthree
        sed -i '/DEVICE/i\DEVICE=eth2' $dir/$newthree
        echo "MACADDR=$mac3" &>> $dir/$newfore		
        mv $dir/ifcfg-$oldd $dir/$newfore
        sed -i 's/NAME/#NAME/g' $dir/$newfore
        sed -i '/NAME/i\NAME=eth3' $dir/$newfore
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newfore
        sed -i '/DEVICE/i\DEVICE=eth3' $dir/$newfore
        echo "MACADDR=$mac4" &>> $dir/$newfore
    	mv $dir/ifcfg-$olde $dir/$newfive
        sed -i 's/NAME/#NAME/g' $dir/$newfive
        sed -i '/NAME/i\NAME=eth4' $dir/$newfive
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newfive
        sed -i '/DEVICE/i\DEVICE=eth4' $dir/$newfive
        echo "MACADDR=$mac5" &>> $dir/$newfive
       elif [ $n -eq 6 ]
          then
        echo "$rules, ATTR{address}==\"$mac\", NAME=\"eth0\", GOTO=\"net_end\"" &>$dir1/60-net.rules
     	echo "$rules, ATTR{address}==\"$mac2\", NAME=\"eth1\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        echo "$rules, ATTR{address}==\"$mac3\", NAME=\"eth2\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        echo "$rules, ATTR{address}==\"$mac4\", NAME=\"eth3\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        echo "$rules, ATTR{address}==\"$mac5\", NAME=\"eth4\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        echo "$rules, ATTR{address}==\"$mac6\", NAME=\"eth5\", GOTO=\"net_end\"" &>>$dir1/60-net.rules
        mv $dir/ifcfg-$olda $dir/$newone
        sed -i 's/NAME/#NAME/g' $dir/$newone
        sed -i '/NAME/i\NAME=eth0' $dir/$newone
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newone
        sed -i '/DEVICE/i\DEVICE=eth0' $dir/$newone
        echo "MACADDR=$mac" &>> $dir/$newone
        mv $dir/ifcfg-$oldb $dir/$newtwo
        sed -i 's/NAME/#NAME/g' $dir/$newtwo
        sed -i '/NAME/i\NAME=eth1' $dir/$newtwo
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newtwo
        sed -i '/DEVICE/i\DEVICE=eth1' $dir/$newtwo
        echo "MACADDR=$mac2" &>> $dir/$newtwo
        mv $dir/ifcfg-$oldc $dir/$newthree
        sed -i 's/NAME/#NAME/g' $dir/$newthree
        sed -i '/NAME/i\NAME=eth2' $dir/$newthree
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newthree
        sed -i '/DEVICE/i\DEVICE=eth2' $dir/$newthree
        echo "MACADDR=$mac3" &>> $dir/$newfore		
        mv $dir/ifcfg-$oldd $dir/$newfore
        sed -i 's/NAME/#NAME/g' $dir/$newfore
        sed -i '/NAME/i\NAME=eth3' $dir/$newfore
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newfore
        sed -i '/DEVICE/i\DEVICE=eth3' $dir/$newfore
        echo "MACADDR=$mac4" &>> $dir/$newfore
    	mv $dir/ifcfg-$olde $dir/$newfive
        sed -i 's/NAME/#NAME/g' $dir/$newfive
        sed -i '/NAME/i\NAME=eth4' $dir/$newfive
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newfive
        sed -i '/DEVICE/i\DEVICE=eth4' $dir/$newfive
        echo "MACADDR=$mac5" &>> $dir/$newfive		
    	mv $dir/ifcfg-$oldf $dir/$newsix
        sed -i 's/NAME/#NAME/g' $dir/$newsix
        sed -i '/NAME/i\NAME=eth5' $dir/$newsix
        sed -i 's/DEVICE/#DEVICE/g' $dir/$newsix
        sed -i '/DEVICE/i\DEVICE=eth5' $dir/$newsix
        echo "MACADDR=$mac6" &>> $dir/$newsix	
       fi
    
    展开全文
  • Linux修改网卡的名字

    2020-12-07 08:08:16
    网上很多linux修改网卡名字的方法,第一步就是 nmcli con nmcli con show 但我执行后没有显示任何uuid, 所以这些方法对我行不通。 下面介绍我自己的方法: 查看 /etc/udev/rules.d/90-eno-fix.rules #vi /etc/...

    网上很多linux修改网卡名字的方法,第一步就是

    nmcli con

    nmcli con show

    但我执行后没有显示任何uuid, 所以这些方法对我行不通。

    下面介绍我自己的方法:

    1. 查看 /etc/udev/rules.d/90-eno-fix.rules

    #vi /etc/udev/rules.d/90-eno-fix.rules

    1. ifconfig -a

    #ifconfig -a

    根据MAC 地址对应,修改

    ATTR{address}==“00:50:56:31:64:20”, NAME=“wlan0”

    这两个变量。

    #reboot

    重启后执行 ifconfig -a 就会发现网卡的名字被修改了;

    1. 为该网卡生成一个uuid

    uuidgen lan0

    5042cfcc-0671-447c-a6f1-536c3f9db032

    1. 配置网卡, 让网卡开机启动自动初始化

    #cd /etc/sysconfig/network-scripts

    #cp ifcfg-eth0 ifcfg-lan0

    #vi ifcfg-lan0

    systemctl restart network

    End

    展开全文
  • linux修改网卡的MAC

    千次阅读 2019-04-15 09:10:20
    由于购买了几片网卡的出厂MAC地址竞置为一样的,在做局域网测试时会造成麻烦,于是便有了linux修改网卡的MAC的需求,查了一下资料觉的下面资料写的比较易懂,记录一下,至于为何不退换网卡,其实MAC一样也有好处,...
  • Linux修改网卡配置

    2021-01-14 13:37:06
    1.输入如下命令,修改网卡的配置文件: vi /etc/sysconfig/network-scripts/ifcfg-ens33 注意:ifcfg-ens33是网卡名,看个人主机配置而定 2.配置静态网卡: TYPE=Ethernet BOOTPROTO=static //static静态IP地址,...
  • linux修改网卡设备名称 1.shutdown 相应接口,将 /etc/sysconfig/network-scripts/ifcfg-eth0中的 DEVICE=eth0 H...
  • linux修改网卡状态.docx

    2020-05-27 17:23:08
    进入目录 /etc/sysconfig/network-scripts/ 用ls命令查看网卡配置文件名在CENTOS7中网卡名貌似变成了随机数字所以每台机器的网卡名并不相同 ? 用vim(或者vi随你便咯)编辑该文件 将最后一行的ONBOOT=no改为ONBOOT=yes...
  • Linux 修改网卡名称

    2014-12-02 16:27:01
    还是可以的,备忘.关键时刻起大用处哦!
  • Linux 修改网卡

    2018-01-19 09:45:00
    1. 修改网卡配置文件  vim /etc/sysconfig/network-scripts/ifcfg-ens32 (“ens32”为当前网卡名)  将NAME、DEVICE项修改为eth0   2. 重命名该配置文件  mv/etc/sysconfig/network-scripts/ifcfg-ens...
  • LINUX修改网卡MAC地址

    2010-03-24 12:01:03
    LINUX修改网卡MAC地址 常用虚拟机的朋友了解,虚拟机文件是可以拷贝的,但LINUX虚拟机拷贝后两台主机网卡的MAC地址相同无法通信,想方便想省事结果不能网络通信,做为网络系统工程师不能通信是比较简单的问题,...
  • Linux修改网卡和网卡对应名称关系

    千次阅读 2019-07-25 14:35:02
    网卡网卡名称对应关系配置...例如想修改0000:06:00.1 这个网卡名称为eth4 ,0000:06:00.0 这个网卡名称改为eth5,则只需要修改后面的NAME当中的值,修改完毕,重启网卡,执行service network restart命令即可生...
  • Linux修改网卡

    2018-08-30 11:31:00
    问题现象:戴尔机器网卡名为em1,修改为eth0a)由于未发现有/etc/udev/rule.d/70-persistent-net.rules文件,重启后也未发现此文件手动执行/lib/udev/write_net_rules;提示缺少变量INTERFACEroot@server:/lib/udev/...
  • Linux修改网卡名称

    2018-08-22 08:28:43
    网卡,即网络接口板,又称网络适配器或NIC (网络接口控制器),是一块被设计用来允许计算机在计算机网络上进行通讯的计算机硬件。由于其拥有MAC地址,因此属于OSI模型的第1层。它使得用户可以透过电缆或无线相互...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 5,322
精华内容 2,128
关键字:

linux修改网卡

linux 订阅