码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS7修改网卡为eth0

时间:2018-12-30 20:34:56      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:ipad   config   变更   gate   nbsp   配置   ns3   生成   cmd   

步骤:

1.编辑grub文件如下:

[root@node-4 ~]# vi /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="rd.lvm.lv=centos_node-4/root rd.lvm.lv=centos_node-4/swap net.ifnames=0 biosdevname=0 rhgb quiet" //标红内容为添加内容
GRUB_DISABLE_RECOVERY="true"

[root@node-4 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg    //重新生成配置文件

2.修改网卡配置文件

[root@node-4 ~]# mv /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-eth0

[root@node-4 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
NAME="eth0"
IPADDR="192.168.1.50"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.1"
DNS1="8.8.8.8"
DNS2="8.8.4.4"
DEVICE="eth0"
ONBOOT="yes"

3.重启服务器,查看已经变为eth0

[root@node-4 ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.50 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::20c:29ff:fe18:2b8d prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:18:2b:8d txqueuelen 1000 (Ethernet)
RX packets 59 bytes 7681 (7.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 89 bytes 12549 (12.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

故障说明:如果重启还没变更过来,删除/etc/udev/rules.d/70-persistent-ipoib.rules后重启即可.

[root@node-4 ~]# vi /etc/udev/rules.d/70-persistent-ipoib.rules 

CentOS7修改网卡为eth0

标签:ipad   config   变更   gate   nbsp   配置   ns3   生成   cmd   

原文地址:https://www.cnblogs.com/networking/p/10200337.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!