1. #ifconfig
注意 eth0为你要配置的interfase
2. #vi /etc/network/interfaces
# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto eth0iface eth0 inet dhcp
很明显看到eth0为dhcp模式,动态分配ip
改为
auto eth0iface eth0 inet staticaddress 10.0.0.160gateway 10.0.0.1netmask 255.255.255.0
注意:网关和掩码要和主机上的桥接网路一致
3.#service networking restart
4.最好还是重启下虚拟机