配置文件 /etc/network/interface 增加如下配置
auto eth0
iface eth0 inet static
address 192.168.1.111
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameserver 192.168.1.1
eth0 是网络接口名字,可能不一样,可以使用 ifconfig 查看
重启网络并验证
service networking restart
ifconfig
auto eth0
iface eth0 inet static
address 192.168.1.111
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameserver 192.168.1.1
eth0 是网络接口名字,可能不一样,可以使用 ifconfig 查看
service networking restart
ifconfig