先临时切换到root用户(由于我不想每打一个命令都要在前面加上sudo)ubuntu
$ sudo -i
而后,输入密码临时切换到root用户.以下图:
vim
打开 /etc/network/interfaces 同时配置如下内容服务器
# vim /etc/network/interfaces
具体的地址能够根据本身的状况来配置
gateway 即网关地址,我写的是我路由器的地址
重新启动网络:网络
# /etc/init.d/networking restart
# vim /etc/resolv.conf
由于写在 /etc/resolv.conf 下面的内容会被覆盖,因此须要将DNS写在其余地方 ,
须要将DNS写在 /etc/resolvconf/resolv.conf.d/base3d
# apt-get install resolvconf
# vim /etc/resolvconf/resolv.conf.d/base
Ubuntu18.04 须要写入 /etc/resolvconf/resolv.conf.d/head
才有效
而后写入DNS好比,写入下面两条:rest
nameserver 114.114.114.114 nameserver 8.8.8.8
# reboot
code