临时的意义不大,现查就行

1改ip

ifconfig

 

eth1      Link encap:Ethernet  HWaddr 00:0C:29:32:F5:64  
          inet addr:192.168.25.133  Bcast:192.168.25.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe32:f564/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:49 errors:0 dropped:0 overruns:0 frame:0
          TX packets:41 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6623 (6.4 KiB)  TX bytes:5543 (5.4 KiB)
          Interrupt:19 Base address:0x2024 

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:119 errors:0 dropped:0 overruns:0 frame:0
          TX packets:119 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:8684 (8.4 KiB)  TX bytes:8684 (8.4 KiB)

 

cd /etc/sysconfig/network-scripts
ll
-rw-r--r--. 1 root root   262 Jul 29  2015 ifcfg-Auto_eth2
-rw-r--r--. 1 root root   254 Jan  9  2013 ifcfg-lo

 

vim ifcfg-Auto_eth2
TYPE=Ethernet
HWADDR=00:0C:29:32:F5:64 #不能与其他虚拟机的mac相同
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.25.130 #不与其他虚拟机的ip相同
PREFIX=24
G:ATEWAY=192.168.25.2
DNS1=192.168.25.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="eth0"
UUID=6e6f9829-0737-4943-ab21-61d6173ba8c4
ONBOOT=yes
LAST_CONNECT=1438160743
cd /etc/sysconfig/network-scripts

 发现修改的eth0无效

2 查看虚拟机网卡信息

vim /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_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.

#mac要与虚拟机的相同
# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:cc:16:f0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

#删了下边的
# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:32:f5:64", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

3 重启网络配置。

service network restart

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐