首页 > 系统相关 >centos 7.9修改网卡名

centos 7.9修改网卡名

时间:2022-12-13 19:31:50浏览次数:70  
标签:overruns 00 errors centos bytes RX 网卡 ff 7.9

文档课题:centos 7.9修改网卡名.
1、系统检查
[root@liujun ~]# cat /etc/*release
CentOS Linux release 7.9.2009 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.9.2009 (Core)
CentOS Linux release 7.9.2009 (Core)
[root@liujun ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.133.120 netmask 255.255.255.0 broadcast 192.168.133.255
inet6 fe80::8859:131d:a761:bc7a prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:98:c5:5f txqueuelen 1000 (Ethernet)
RX packets 134 bytes 29118 (28.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 136 bytes 21093 (20.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 48 bytes 4080 (3.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 48 bytes 4080 (3.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:a8:7c:6f txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2、修改网卡名
2.1、grub文件
--编辑/etc/default/grub,加入“net.ifnames=0 biosdevname=0”到GRUB_CMDLINE_LINUX变量.
[root@liujun ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto spectre_v2=retpoline rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@liujun ~]# sed -i 's/rhgb/net.ifnames=0 biosdevname=0 rhgb/' /etc/default/grub
2.2、70-persistent-net.rules文件
修改/etc/udev/rules.d/70-persistent-net.rules文件
--查接口mac地址。
[root@liujun ~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:98:c5:5f brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
link/ether 52:54:00:a8:7c:6f brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT group default qlen 1000
link/ether 52:54:00:a8:7c:6f brd ff:ff:ff:ff:ff:ff
--MAC地址为00:0c:29:98:c5:5f,将MAC地址填入文件70-persistent-net.rules的ATTR中。
[root@liujun rules.d]# vi /etc/udev/rules.d/70-persistent-net.rules
添加如下:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:98:c5:5f", ATTR{type}=="1", KERNEL=="ens*", NAME="ens37"
说明:需注意ATTR和NAME值。
2.3、ifcfg-ens33文件
--修改网卡配置文件
[root@liujun network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@liujun network-scripts]# mv ifcfg-ens33 ifcfg-ens37
[root@liujun network-scripts]# vi ifcfg-ens37
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens37
UUID=e7191296-fd65-478d-936e-f43dc98f1745
DEVICE=ens37
ONBOOT=yes
IPADDR=192.168.133.120
DNS1=192.168.133.2
GATEWAY=192.168.133.2
PREFIX=24
说明:需修改DEVICE和NAME的名称为ens37.
3、重启系统
[root@liujun network-scripts]# reboot
[root@liujun ~]# ifconfig
ens37: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.133.120 netmask 255.255.255.0 broadcast 192.168.133.255
inet6 fe80::e007:4abd:58d:5da3 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:98:c5:5f txqueuelen 1000 (Ethernet)
RX packets 35 bytes 5261 (5.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 58 bytes 10265 (10.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 48 bytes 4080 (3.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 48 bytes 4080 (3.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:a8:7c:6f txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

参考网址:http://blog.itpub.net/26736162/viewspace-2771463/

标签:overruns,00,errors,centos,bytes,RX,网卡,ff,7.9
From: https://blog.51cto.com/u_12991611/5935003

相关文章

  • oel 7.9搭建oracle 11.2.0.4物理备库
    文档课题:oel7.9搭建oracle11.2.0.4物理备库.实验目标:主库已存在一个备库,搭建第二个备库.创建时间:2021/12/011、规划2、磁盘处理2.1、划分磁盘空间#fdisk/dev/sdb为meddoc......
  • 记一次CentOS8误删恢复yum过程
    起因同事不小心删了yum,搞不定找我处理,我也没搞过,但是我知道yum是一个管理rpm包管理工具。可通过rpm直接安装。当然一开始我想的是编译安装。但是发现编译安装需要很多依赖......
  • 【安装】虚拟机安装Centos8
    下载地址​​Indexof/centos/(aliyun.com)​​    ​​Indexof/centos/8.4.2105/isos/x86_64/(aliyun.com)​​​​阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者......
  • Centos6.10 安装docker
    Centos6.10安装docker下载安装docker用到的依赖yuminstall-yyum-utilsdevice-mapper-persistent-datalvm2已加载插件:fastestmirror设置安装进程Loadingmirror......
  • Centos 7配置使用nginx反向代理mysql
    背景:由于WEB服务和MySQL数据库服务分开部署的,由于网络问题限制,有时需要通过中间代理服务器跳转连接MySQL,所以需要在中间服务器上配置代理。1、添加stearm模块#nginx通常......
  • centos6.10 yum报错解决办法
    centos6.10yum报错解决办法下载软件或者yummakecache时会报错(或者类似错误)我试了很多方法,最后重装成功了1.卸载之前的yumrpm-qa|grepyum|xargsrpm-e--allmat......
  • centos无法启动 fail to spawn unable to execute
    环境:centos6.7启动有报错  处理思路:看着像是文件有缺失导致无法启动,但不确定是哪个。报错提示中有unabletoexecute,无法执行。可能是bash相关。解决过程:尝试进入......
  • 2022 年超详细过程步骤讲解 CentOS 7 安装Maven。以及Mavne配置文件的修改
    1、下载maven官网:​​https://maven.apache.org/download.cgi​​​下载:​​apache-maven-3.8.6-bin.tar.gz​​2、创建放置maven的文件夹统软件统一放置到​​/usr/loca......
  • Centos7.9 安装 ElasticSearch
     先安装好jdk1.8下载es: ​​https://www.elastic.co/cn/downloads/elasticsearch​​解压:tar-zxvfelasticsearch-7.16.2-linux-x86_64.tar.gz 修改系统参数 修改系......
  • 超详细过程步骤讲解 CentOS 7 安装jdk1.8
    linux系统下安装jdk以及环境变量的设置、真的是比window下方便一万倍1、卸载系统自带jdk1.1查看系统自带jdkjava-version1.2查看java相关文件rpm-qa|grepja......