1.准备工作
查看本地主机的网络
我的本机网关是:172.20.18.1
2.检查Vmmare的网络连接方式
3.配置centos网络
#配置需要用到的三个文件 /etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/resolv.conf
(1)先配置network
vim /etc/sysconfig/network
NETWORKING=yes HOSTNAME=localhost.localdomain GATEWAY=172.20.18.1
(2)配置ifcfg-eth0文件
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 NBOOT=yes BOOTPROTO=static IPADDR=172.20.17.109 NETMASK=255.255.255.0 NETWORK=172.20.17.1 BOOTCAST=172.20.18.1 NAME="System eth0" DNS1=172.20.18.1
(3)配置resolv.conf文件
vim /etc/resolv.conf
# Generated by NetworkManager nameserver 172.20.18.1
4.重启网络
service network restart 或 /etc/init.d/network restart
5.测试