1.用ifconfig命令来查看当前网络的设置
2.进入vi /etc/sysconfig/network-scripts/ifcfg-eth0
3.进入vi /etc/sysconfig/network-scripts/ifcfg-eth0修改ONBOOT=yes
4.ifup eth0 开启网卡
再用ifconfig查看虚拟机通过dhcp获得的ip地址