Vmware复制完好的linux目录后网卡操作
Posted kyeup
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Vmware复制完好的linux目录后网卡操作相关的知识,希望对你有一定的参考价值。
目录
Vmware复制完好的linux目录后网卡操作
为了减少工作量,目前需要对已经安装好系统的linux,进行复制。采用直接复制目录的方式,那么后续会出现网卡配置冲突问题,那么如何解决呢?
OS 版本:
[[email protected] ~]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: OracleServer
Description: Oracle Linux Server release 6.9
Release: 6.9
Codename: n/a
修改/etc/udev/rules.d/70-persistent-net.rules
- 查看现有的IP地址
[[email protected] ~]# ifconfig
eth1 Link encap:Ethernet HWaddr 00:50:56:38:CC:A3
inet addr:192.168.1.115 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe38:cca3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:205 errors:0 dropped:0 overruns:0 frame:0
TX packets:75 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:49848 (48.6 KiB) TX bytes:13452 (13.1 KiB)
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:65536 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)
- 修改文件
[[email protected] ~]# 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 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:f0:2d:c6", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:38:cc:a3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
把上面的eth0一行进行注释,并把eth1的名字修改成eth0,记录mac地址:00:50:56:38:cc:a3
修改网卡配置文件
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=00:50:56:38:cc:a3
IPADDR=192.168.1.20
PREFIX=24
GATEWAY=192.168.1.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
删除UUID,并把mac地址修改成记录的mac。
重启查看
以上是关于Vmware复制完好的linux目录后网卡操作的主要内容,如果未能解决你的问题,请参考以下文章
VmWare Workstation 关于Linux 虚拟机快照或克隆后 识别不到网卡问题
vmware克隆linux系统,发现部署后的linux系统无法启动网卡