1.安装好虚拟机后,进行克隆完成后需要完成下面工作
2.命令行输入ifconfig
[root@hadoop12 ~]# ifconfig
eth1 Link encap:Ethernet HWaddr 00:0C:29:5B:52:FA
inet addr:192.168.6.135 Bcast:192.168.6.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe5b:52fa/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1768720 errors:0 dropped:0 overruns:0 frame:0
TX packets:202155 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2479203619 (2.3 GiB) TX bytes:28710501 (27.3 MiB)
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:414906 errors:0 dropped:0 overruns:0 frame:0
TX packets:414906 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:55128448 (52.5 MiB) TX bytes:55128448 (52.5 MiB)
需要将eth1修改为eth0
[root@hadoop12 ~]# 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) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:5b:52:fa", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a9:22:9d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
"/etc/udev/rules.d/70-persistent-net.rules" 8L, 460C
打开该文件,这时你会发现,里面有eth0,eth1两个网卡的信息,但实际上你ifconfig时只能发现eth1一个网卡的信息,这时因为eth0根本就不存在。
将其中eth0的信息删掉,并将eth1信息中的设备名改为eth0,重启系统,你看到的网卡就是eth0了,或者删掉其中所有的信息重启系统udev会帮你发现新的设备的。
3.修改ma地址
eth0 Link encap:Ethernet HWaddr 00:0C:29:5B:52:FA
inet addr:192.168.6.135 Bcast:192.168.6.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe5b:52fa/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1768720 errors:0 dropped:0 overruns:0 frame:0
TX packets:202155 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2479203619 (2.3 GiB) TX bytes:28710501 (27.3 MiB)
修改方法:
命令行输入ifconfig
#vim /etc/sysconfig/network-scripts/ifcfg-eth0 [编辑网卡的配置文件]
输入上述命令后回车,打开配置文件,使用方向键移动光标到最后一行,按字母键“O”,进入编辑模式,输入以下内容:
CE="eth0"
BOOTPROTO="static" ###
HWADDR="
00:0C:29:5B:52:FA"##这里换为
00:0C:29:5B:52:FA
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes" ###
TYPE="Ethernet"
UUID="affc7d0f-c5f7-444e-bfba-22eb0569e749"
IPADDR=
192.168.6.135 ###
NETMASK=255.255.255.0 ###
GATEWAY=192.168.6.2 ###
DNS1=8.8.8.8 ###一定要有这个否则不能上网
4.重启网络:
命令行输入:service network restart