配置文件 /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 是網(wǎng)絡(luò)接口名字,可能不一樣,可以使用 ifconfig 查看
重啟網(wǎng)絡(luò)并驗(yàn)證
service networking restart
ifconfig