打开网络的配置文件
sudo vim /etc/network/interfaces
选择网卡,我这里是有线网卡eth0,设置静态ip为192.168.1.108
auto eth0 iface eth0 inet static address 192.168.1.108 netmask 255.255.255.0 network 192.168.0.1 gateway 192.168.1.1 broadcast 192.168.0.255
设置dns信息
vim /etc/resolv.conf
修改为:
nameserver 192.168.1.1 nameserver 8.8.8.8
修改上面的数据后每次重启将会被置空
打开/etc/resolvconf/resolv.conf.d/base
sudo vim /etc/resolvconf/resolv.conf.d/base
编辑dns信息
nameserver 192.168.1.1 nameserver 8.8.8.8
然后重启即可