Apologies if this has been answered before, I searched and couldn't find a solution.
I have setup my ubuntu 16.04 desktop with a static IP. However on startup it is not able to resolve hostnames. Surprising if I manually restart the network service with:
sudo /etc/init.d/networking restart
It fixes my DNS issue. But I have to do this every time on startup.
I think the issue is with how my resolve.conf file is being auto-written on boot.
For example on boot up it has:
ow@ubuntu002:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
dns-nameservers 8.8.8.8 8.8.4.4
And after sudo /etc/init.d/networking restart
:
ow@ubuntu002:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
dns-nameservers 8.8.8.8 8.8.4.4
Appreciate any help with this. I can't help but try to get to the root cause of this.
EDIT:
@Simon Sudler: yes I modified /etc/network/interfaces
as well as /etc/NetworkManager/NetworkManager.conf
. It was based on online tutorials.
Here is the content of my interfaces file:
ow@ubuntu002:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp0s31f6
iface enp0s31f6 inet static
address 192.168.0.101
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4
ow@ubuntu002:~$
@oscar1919: I tried your solution and it fixed the issue!
Thank you both for your help.
/etc/network/interfaces
? Can you add the entry to your question? – Simon Sudler Apr 10 '18 at 08:58