篇二:配置网络
场景要求:局域网内部相互访问、配置公网ip外部可以访问
一、系统初始化

二、配置网络
1、设置网络为桥接模式

2、设置网络参数:vi /etc/sysconfig/network-scripts/ifcfg-eth0

3、重启服务:service network restart

三、移植VM网络MAC地址变更
场景:手动复制虚拟机的vdi文件,到另外一台机器上安装运行,MAC地址会是原先电脑上生成的,需要更新到新电脑上重新生成
1、方式一
导入好以后,在基础上复制一台,删除原先那台就OK
2、方式二
##删除文件 rm -rf /etc/udev/rules.d/70-persistent-net.rules ##重启 reboot ##重新启动后,进入查看,记住NAME、ATTR{address} vi /etc/udev/rules.d/70-persistent-net.rules SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8f:89:9 7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" ##进入 vi /etc/sysconfig/network-scripts/ifcfg-eth0 NAME对应DEVICE ATTR{address}对应HWADDR
参考
device eth0 does not seem to be present, delaying initialization 解决办法: 首先,打开/etc/udev/rules.d/70-persistent-net.rules内容如下面例子所示: # 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 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:8f:89:9 7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x1022:0x2000 (pcnet32) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:50:bd:1 7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" 记录下,eth1网卡的mac地址00:0c:29:50:bd:17 接下来,打开/etc/sysconfig/network-scripts/ifcfg-eth0 # vi /etc/sysconfig/network-scripts/ifcfg-eth0 将 DEVICE="eth0" 改成 DEVICE="eth1" , 将 HWADDR="00:0c:29:8f:89:97" 改成上面的mac地址 HWADDR="00:0c:29:50:bd:17" 最后,重启网络 # service network restart 或者 # /etc/init.d/network restart 正常了。 如果文件改坏了: 删除: /etc/udev/rules.d/70-persistent-net.rules 重启:自动生成

浙公网安备 33010602011771号