Updating resolv conf
In fact, nm-tool says My issue was a bit different, I wanted to override my routers DNS servers.I found this link from Ubuntu: https://wiki.ubuntu.com/Override DNSServers It says: If you would like to override the DNS settings provided to you by a DHCP server, open but this is not recommended in certain case, a better solution is to setup correctly all the program/services using the DNS like (dnsmasq/network-manager/resolvconf/etc.) Here is an exhaustive list of setups to get back the control of and avoid having it overwritten (how to disable/setup DNS from other location other than resolv.conf) note that resolvconf is an independent program from resolv.conf, also depending on your system/config you may not have one or many of the programs listed here. auto local iface lo inet loopback # The primary network interface #iface eth0 inet dhcp iface eth0 inet static address x.x.x.x netmask 255.255.255.0 gateway x.x.x.x #nameservers # you may not need dns-search # I use it because I'm running this on a Windows network # so its useful to have # dns-search x.y dns-nameservers 18.104.22.168 22.214.171.124 directory.configuration file contains information that allows a computer to convert alpha-numeric domain names into the numeric IP addresses.The process of converting domain names to IP addresses is called resolving./etc/resolvconf/d/head File to be prepended to the dynamically generated resolver configuration file. /etc/resolvconf/d/tail File to be appended to the dynamically generated resolver configuration file. This file is a good place to put a resolver options line if one is needed, e.g., options inet6 which means that if the name searched for is not in the cache, then it is asked for at 126.96.36.199 and not at the server provided by dhcp.Another (perhaps better) option is to use "prepend" instead of "supersede": in this way, if the name is not resolved by 188.8.131.52, then the request falls back on the other server.I have slackware machines setup with static ips and I had to change the file. What command can I run to reload the file without rebooting? Using the 'dig' command the dns host used is shown at the bottom: ;; Query time: 81 msec ;; SERVER: 144.1#53(144.1) ;; WHEN: Tue Jan 09 EST 2018 After I change the and run dig again: ;; Query time: 0 msec ;; SERVER: 144.1#53(144.1) ;; WHEN: Tue Jan 09 EST 2018 ;; MSG SIZE rcvd: 268Changes to do eventually come into effect, but can take a couple of minutes to "stick," IME. By the way, Network Manager, if you are using it, will overwrite changes to
Visit Stack Exchange # nmcli conn NAME UUID TYPE DEVICE eth0 74315f7c-1573-4150-9c0e-e06ad28cac95 802-3-ethernet eth0 # # nmcli conn edit eth0 ===| nmcli interactive connection editor |=== Editing existing '802-3-ethernet' connection: 'eth0' Type 'help' or '? For convenience sake, I am posting this in my github repo as well. This is the main working "script", which does the magic happen: - name: Check if there are any previous entries in find: paths: /etc/patterns: '^nameserver ([0-9]\.)[0-9]$' register: found_previous - name: Set up (non-verride).template: src: "" dest: /etc/owner: root group: root mode: 0644 with_first_found: - files: - "" - resolv.j2 paths: - ../templates when: (found_previous is not defined and replace_previous == 1) or replace_previous == 0 - name: Set up (override or non-existent).After I change /etc/resolv.conf, the command "host" and "nslookup" works fine, they can follow the new name server defined in the /etc/resolv.conf, but the command "gethostbyname" will still use the old name server in the old /etc/ BTW, I have a lot of error of dbus cannot connect to the audit system, I am not sure it there is any relation. As described in my previous post, Ansible is very, very powerful tool for your daily automation tasks.