ubuntu配置静态路由
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 interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp
很明显看到eth0为dhcp模式,动态分配ip
改为
auto eth0 iface eth0 inet static address 10.0.0.160 gateway 10.0.0.1 netmask 255.255.255.0
注意:网关和掩码要和主机上的桥接网路一致
3.#service networking restart
4.最好还是重启下虚拟机