修改文件: /etc/network/interfaces,命令如下
sudo nano /etc/network/interfaces
将最后一句iface default inet dhcp,替换成:
iface default inet static
address 172.xx.xxx.186
netmask 255.255.255.0
gateway 172..xx.xxx.254
dns-nameservers 172..xx.xxx.2
最后Ctrl+O 存盘 Ctrl+X 退出,然后重启网络:
sudo /etc/init.d/networking restart