1、centos7修改网卡名称为传统的eth0
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]#mv ifcfg-ens33 ifcfg-eth0
[root@localhost network-scripts]# vim ifcfg-eth0
TYPE=Ethernet
#网卡类型,以太网;
PROXY_METHOD=none
#代理方式;
BROWSER_ONLY=no
#不只是浏览;
BOOTPROTO=static
#设置网卡引导协议,分为static、dhcp、none;
DEFROUTE=yes
#启动默认路由;
IPV4_FAILURE_FATAL=no
#不启用ipv4错误检测功能;
IPV6INIT=yes
#启用ipv6协议;
IPV6_AUTOCONF=yes
#自动配置ipv6地址;
IPV6_DEFROUTE=yes
#启动ipv6默认路由;
IPV6_FAILURE_FATAL=no
#不启用ipv6错误检测功能;
IPV6_ADDR_GEN_MODE=stable-privacy
#ipv6地址生成策略;
NAME=eth0
#网卡设备别名
UUID=5b83a820-913e-4b18-9c5d-2915fc53d994
#网卡设备的uuid唯一标号;
DEVICE=eth0
#网卡的设备名称;
ONBOOT=yes
#开机自动激活网卡;
IPADDR=10.0.0.100
#网卡的ip地址;
PREFIX=24
#子网掩码;
GATEWAY=10.0.0.253
#默认网关;
IPV6_PRIVACY=no
#ipv6地址隐私;
DNS1=114.114.114.114
#DNS服务器地址;
[root@localhost ~]# vim /etc/sysconfig/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="rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg #生成启动菜单
[root@localhost ~]# reboot #重新启动
[root@localhost ~]# yum install net-tools -y #默认情况下centos7是不能使用ifconfig命令的,需要安装net-tools
[root@localhost ~]# ifconfig #再次查看网卡或使用'ip a'命令;
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.200 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::20c:29ff:fe99:315f prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:99:31:5f txqueuelen 1000 (Ethernet)
RX packets 11085 bytes 16327015 (15.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2430 bytes 152370 (148.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
1.2、补充:
1、网卡eth0和网卡ens33的区别;
2、在开机装系统的时候修改网卡的名称: