ubuntu:dns:configure_client_to_use_dns_server
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ubuntu:dns:configure_client_to_use_dns_server [2021/01/10 19:34] – peter | ubuntu:dns:configure_client_to_use_dns_server [2021/01/10 20:53] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Ubuntu - DNS - Configure client to use DNS server ====== | ||
- | |||
- | <WRAP todo> | ||
- | **TODO**: | ||
- | </ | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | Edit the **/ | ||
- | |||
- | <WRAP notice> | ||
- | **NOTE**: | ||
- | </ | ||
- | |||
- | To the end of the file, add | ||
- | |||
- | <file bash / | ||
- | nameserver < | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | Resolvconf has a / | ||
- | * **base**: Used when no other data can be found | ||
- | * **head**: Used for the header of resolv.conf, | ||
- | * **original**: | ||
- | * **tail**: Any entry in tail is appended at the end of the resulting resolv.conf. In some cases, upgrading from a previous Ubuntu release, will make tail a symlink to original (when we think you manually modified resolv.conf in the past) | ||
- | </ | ||
- | |||
- | Regenerate **/ | ||
- | |||
- | <code bash> | ||
- | sudo resolvconf -u | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Change dhclient.conf ===== | ||
- | |||
- | Edit / | ||
- | |||
- | <WRAP important> | ||
- | **NOTE: | ||
- | </ | ||
- | |||
- | |||
- | Then find the following line | ||
- | |||
- | <file bash / | ||
- | #prepend domain-name-servers 127.0.0.1; | ||
- | </ | ||
- | |||
- | And change it to | ||
- | |||
- | <file bash / | ||
- | prepend domain-name-servers 8.8.8.8; | ||
- | </ | ||
- | |||
- | This will make dhclient (the DHCP client that NetworkManager uses) prepend this to your dns servers, so resolve.conf will end up looking like this | ||
- | |||
- | <file bash / | ||
- | nameserver 8.8.8.8 | ||
- | nameserver 192.168.1.1 | ||
- | </ | ||
- | |||
- | This solution will work everywhere and you will always get the DNS that you have chosen as the primary one. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Common DNS configuration changes ===== | ||
- | |||
- | To make DNS configuration changes for some common use cases: | ||
- | |||
- | * For a static configuration using ifup, use **dns-nameservers** and **dns-search** entries in / | ||
- | |||
- | * For a static configuration using NetworkManager, | ||
- | |||
- | * To override resolvconf' | ||
- | |||
- | <WRAP warning> | ||
- | **WARNING: | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== This no longer works ===== | ||
- | |||
- | <WRAP danger> | ||
- | **DANGER**: | ||
- | </ | ||
- | |||
- | |||
- | The **resolv.conf** file typically contains the IP addresses of nameservers (DNS name resolvers) that attempt to translate names into addresses for any node available on the network. | ||
- | |||
- | Edit the / | ||
- | |||
- | <code bash> | ||
- | vi / | ||
- | </ | ||
- | |||
- | Add the nameservers as follows: | ||
- | |||
- | <file bash / | ||
- | search sharewiz.net | ||
- | nameserver 5.42.134.35 | ||
- | nameserver 8.8.8.8 | ||
- | nameserver 8.8.4.4 | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | **NOTE**: | ||
- | </ | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | ===== Test ===== | ||
- | |||
- | setup nslookup or dig command: | ||
- | |||
- | <code bash> | ||
- | dig www.google.com | ||
- | nslookup www.google.com | ||
- | </ | ||
ubuntu/dns/configure_client_to_use_dns_server.1610307245.txt.gz · Last modified: 2021/01/10 19:34 by peter