把centos 网卡接口eth2改成eth0
kvm 虚拟机 复制之后 默认网卡是 eth2了
用 ifconfig -a 命令查看所有的网络设置,果然没有eth0的相关设置,多出来一个eth2。显示如下:
[root@neal ~]# ifconfig -a
eth2 Link encap:Ethernet HWaddr 52:54:00:A0:10:38
inet addr:192.168.1.226 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::5054:ff:fea0:1038/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11764 errors:0 dropped:0 overruns:0 frame:0
TX packets:5302 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1361989 (1.2 MiB) TX bytes:428860 (418.8 KiB)
Interrupt:11 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
virbr0 Link encap:Ethernet HWaddr 52:54:00:4F:C2:A3
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:473 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:49932 (48.7 KiB)
virbr0-nic Link encap:Ethernet HWaddr 52:54:00:4F:C2:A3
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
由于系统默认的启动网卡是eth0,所以怎么样把eth2更改为eth0成了当务之急。查了很多资料最终终于找到解决方法,方法如下:
修改文件vi /etc/udev/rules.d/70-persistent-net.rules 文件,原来为:
vi /etc/udev/rules.d/70-persistent-net.rules
[root@neal ~]# vi /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1af4:0x1000 (virtio-pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:57:05:8f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10ec:0x8139 (8139cp)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:9b:af:6b", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x10ec:0x8139 (8139cp)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:a0:10:38", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
修改后:
[root@neal ~]# vi /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1af4:0x1000 (virtio-pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:57:05:8f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x10ec:0x8139 (8139cp)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:9b:af:6b", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x10ec:0x8139 (8139cp)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:a0:10:38", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
保存重启后可以看到原来的网络配置又回来了。
转载自:http://hi.baidu.com/li_zhonghui/item/71e4ed52f1f92c15da163596
把centos 网卡接口eth2改成eth0的更多相关文章
- Centos7修改默认网卡名(改为eth0)以及网卡启动报错RTNETLINK answers: File exists处理
安装好centos7版本的系统后,发现默认的网卡名字有点怪,为了便于管理,可以手动修改.下面对centos7版本下网卡重命名操作做一记录:1)编辑网卡信息[root@linux-node2~]# cd ...
- Saltstack把网卡从ens160修改成eth0
手动修改参考:https://www.cnblogs.com/minseo/p/8521873.html salt目录结构为 files/grub GRUB_TIMEOUT=5 GRUB_DISTRI ...
- Centos7下修改默认网卡名(改为eth0)的操作记录
安装好centos7版本的系统后,发现默认的网卡名字有点怪,为了便于管理,可以手动修改.下面对centos7版本下网卡重命名操作做一记录:1)编辑网卡信息[root@linux-node2~]# cd ...
- 将Ubuntu下网卡名称enss改为eth0
将Ubuntu下网卡名称enss改为eth0 sudo nano /etc/default/grub 找到GRUB_CMDLINE_LINUX=""改为GRUB_CMDLINE ...
- CentOS 7将网卡名称eno16777736改为eth0
http://www.linuxidc.com/Linux/2015-09/123396.htm Linux系统版本:CentOS_7(64位) 一.前言: 今天将CentOS 6.5装回了CentO ...
- Linux学习之CentOS(三)----将Cent0S 7的网卡名称eno16777736改为eth0
[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/3 ...
- 把CentOS 7.x网卡名称eno16777736改为eth0
CentOS 7.x系统中网卡命名规则被重新定义,可能会是"eno167777xx"等,下面我们把网卡名称改为eth0这种. 一.cd /etc/sysconfig/networ ...
- Ubuntu中将网卡名称eno16777736改回eth0
一.前言 今天在Vmware Workstation中安装了Ubuntu Server 15.10,然后发现网卡名称出现了问题,主网卡竟然不叫“eth0”,而是叫一个奇怪的名字“eno16777736 ...
- 将Cent0S 7的网卡名称eno16777736改为eth0
新建的虚拟机redhat linux7默认的网卡名称是eno16777736,找不到eth0如图所示: 修改网卡名称: 输入如下命令,进入对应目录,编辑文件: vim /etc/sysconfig/g ...
随机推荐
- llvm學習(二)————llvm編譯與環境構建
本文由博主原创,转载请注明出处(保留此处和链接): IT人生(http://blog.csdn.net/robinblog/article/details/17339027) 在2011十月份的时候, ...
- PC机安装Qt以及QT交叉编译环境 分类: OpenCV ZedBoard shell ubuntu Eye_Detection 2014-11-08 18:57 246人阅读 评论(0) 收藏
PC: apt-get install qtcreator Qt Embedded for ZedBoard: 下载qt-everywhere-opensource-src-4.7.3.tar.gz, ...
- [RxJS] Transformation operator: scan
All of the combination operators take two or more observables as input. These operators may also be ...
- myeclipse配置svn亲测
1.安装目录更改为myeclipse install 目录:E:\MyEclipse85\MyEclipse 8.5common 目录: E:\MyEclipse85\Common ...
- Struts2 OGNL调用公共静态方法
在实现一个功能的时候用到了Struts2的OGNL 调用后台的静态方法,弄了半天没有出来结果,原来是自己没有在Struts的配置文件里面申明可以在前台使用后台的静态方法 <constant na ...
- 10.29 morning
WPS转word太丑了 凑合看喽 第二题 [题目描述] 给你两个日期,问这两个日期差了多少毫秒. [输入格式] 两行,每行一个日期,日期格式保证为“YYYY-MM-DD hh:mm:ss ”这种形式. ...
- html px em pt长度单位(像素 相对长度 点)知识(转)
html px em pt单位区 一.PX\EM\PT单位介绍 px单位名称为像素,相对长度单位,像素(px)是相对于显示器屏幕分辨率而言的国内推荐:em单位名称为相对长度单位.相对于当前对象内文本的 ...
- Android Studio下添加引用jar文件和so文件
博客: 安卓之家 微博: 追风917 CSDN: 蒋朋的家 简书: 追风917 博客园: 追风917 安卓开发中我们常会遇到jar文件和so文件的引用,下面介绍下在as下如何添加使用,这里以百度地图s ...
- angularjs-googleMap googleMap api地址解析与反解析
1.js:根据地址得到经纬度var myplace=$scope.place;//获取输入的地址var geocoder = new google.maps.Geocoder();//创建geocod ...
- 文字排版--字号、颜色(font-size, color)
可以使用下面代码设置网页中文字的字号为12像素,并把字体颜色设置为#666(灰色): body{font-size:12px;color:#666} 示例: <!DOCTYPE HTML> ...