User Tools

Site Tools


ubuntu:dns:configure_client_to_use_dns_server

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ubuntu:dns:configure_client_to_use_dns_server [2021/01/10 19:34] peterubuntu: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**:  VERY OUTDATED. FIX 
-</WRAP> 
- 
- 
----- 
- 
-Edit the **/etc/resolvconf/resolv.conf.d/head** file.   
- 
-<WRAP notice> 
-**NOTE**:  Ignore the scary warning. 
- 
-**/etc/resolv.conf** is autogenerated, so the warning is there so it will get put in /etc/resolv.conf when /etc/resolv.conf is generated.  
-</WRAP> 
- 
-To the end of the file, add 
- 
-<file bash /etc/resolvconf/resolv.conf.d/head> 
-nameserver <ip_of_nameserver> 
-</file> 
- 
-<WRAP info> 
-Resolvconf has a /etc/resolvconf/resolv.conf.d/ directory that can contain “base”, “head”, “original” and “tail” files.  All in resolv.conf format. 
-  * **base**: Used when no other data can be found 
-  * **head**: Used for the header of resolv.conf, can be used to ensure a DNS server is always the first one in the list 
-  * **original**: Just a backup of your resolv.conf at the time of resolvconf installation 
-  * **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) 
-</WRAP> 
- 
-Regenerate **/etc/resolv.conf** so the changes are applied right now: 
- 
-<code bash> 
-sudo resolvconf -u 
-</code> 
- 
----- 
- 
-===== Change dhclient.conf ===== 
- 
-Edit /etc/dhcp3/dhclient.conf 
- 
-<WRAP important> 
-**NOTE:**  You may need to modify /etc/dhcp/dhclient.conf instead of /etc/dhcp3/dhclient.conf 
-</WRAP> 
- 
- 
-Then find the following line 
- 
-<file bash /etc/dhcp3/dhclient.conf> 
-#prepend domain-name-servers 127.0.0.1; 
-</file> 
- 
-And change it to 
- 
-<file bash /etc/dhcp3/dhclient.conf> 
-prepend domain-name-servers 8.8.8.8; 
-</file> 
- 
-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 /etc/dhcp3/dhclient.conf> 
-nameserver 8.8.8.8 
-nameserver 192.168.1.1 
-</file> 
- 
-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 /etc/network/interfaces. 
- 
-  * For a static configuration using NetworkManager, select the Automatic (DHCP) addresses only Method and enter addresses and domain names in the Additional DNS servers and Additional search domains fields in the Connection Editor. 
- 
-  * To override resolvconf's default configuration, use base, head and tail in /etc/resolvconf/resolv.conf.d/. Only enter addresses and domain names in these files as a temporary measure, since they really belong elsewhere, as described above. 
- 
-<WRAP warning> 
-**WARNING:**  Disabling resolvconf is not recommended, but you can replace the symlink /etc/resolv.conf with a regular file. 
-</WRAP> 
- 
----- 
- 
-===== This no longer works ===== 
- 
-<WRAP danger> 
-**DANGER**:  Manual changes to resolv.conf will be overridden, since Ubuntu 12.04. 
-</WRAP> 
- 
- 
-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 /etc/resolv.conf file: 
- 
-<code bash> 
-vi /etc/resolv.conf 
-</code> 
- 
-Add the nameservers as follows: 
- 
-<file bash /etc/resolv.conf> 
-search sharewiz.net 
-nameserver 5.42.134.35 
-nameserver 8.8.8.8 
-nameserver 8.8.4.4 
-</file> 
- 
-<WRAP info> 
-**NOTE**:  Maximum of three nameserver can be defined at a time. 
-</WRAP> 
- 
- 
----- 
- 
-===== Test ===== 
- 
-setup nslookup or dig command: 
- 
-<code bash> 
-dig www.google.com 
-nslookup www.google.com 
-</code> 
  
ubuntu/dns/configure_client_to_use_dns_server.1610307285.txt.gz · Last modified: 2021/01/10 19:34 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki