Ubuntu - DNS not automatically configured. Has to be set manually in /etc/resolv.conf

1

1

When I connect to a network (e.g. home or work network), I have to manually enter the nameserver adresses in /etc/resolv.conf every time (I change to a new network). It used to be automatic. Any ideas how to change this back to automatic again ?

Sonntex Syndicate

Posted 2016-03-10T09:01:18.530

Reputation: 11

check /etc/dhclient.conf and go to the line starting with request, see if you can find domain-name-servers. – Baroudi Safwen – 2016-03-28T08:26:40.050

Answers

1

/etc/resolv.conf shoud be symbolic link to /run/resolvconf/resolv.conf file which is updated automatically by resolvconf program when network configuration changes. Probably your /etc/resolv.conf is a separate file. Just check it with:

ls -l /etc/resolv.conf

Rename or delete this file and make a symbolic link to /run/resolvconf/resolv.conf

ln -s /etc/resolvconf/resolv.conf /etc/resolv.conf

Oleg Bolden

Posted 2016-03-10T09:01:18.530

Reputation: 1 507

Didn't work :-( – Sonntex Syndicate – 2018-03-01T11:57:20.640

sudo ln -s /etc/resolvconf/resolv.conf /etc/resolv.conf ln: failed to create symbolic link ‘/etc/resolv.conf’: File exists – Sonntex Syndicate – 2018-03-01T11:57:24.887

Sonntex Syndicate, you need to delete/rename existing /etc/resolv.conf file before creating a symolic link with the same filename. – Oleg Bolden – 2018-03-01T13:55:09.530

Or use ln -fs ... but I'm really skeptical of doing this manually. – tripleee – 2018-03-02T05:37:08.930

I tried that - renamed it to resolv.conf.backup - that also didn't work. But thanks. – Sonntex Syndicate – 2018-03-02T08:39:21.063