虚拟机Centos-6中配置联网
- 设置虚拟机网络为NAT
- 修改静态ip
- *** 终端输入:vim /etc/udev/rules.d/70-persistent-net.rules
- ***删除eth0该行;将eth1修改为eth0,同时复制物理ip地址
- *** 输入:vim /etc/sysconfig/network-scripts/ifcfg-eth0
- *** 修改 BOOTPROTO=static
修改ONBOOT=yes
修改HWADDR=刚才粘贴地址
修改IPADDR=你想要得ip地址(必须保证与本机在同一个网段下) - *** 保存退出
- *** 执行 service network restart 若失败 执行reboot,重启虚拟机
- 修改主机名
- *** 查看本机名 hostname
- *** vim /etc/sysconfig/network
- *** 修改HOSTNAME;(主机名不能有下划线)
- *** 保存退出
- *** vim /etc/hosts 添加主机ip 与主机名 (如:192.168.1.100 hostname100)
- *** 打开C:\Windows\System32\drivers\etc中的hosts文件添加刚才的内容
- 关闭防火墙
- *** 查看防火墙状态
chkconfig iptables --list - ***关闭防火墙
chconfig iptables off
** 配置完成后,若仍联网失败,重启 **