LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   resolv.conf - how to reload? (https://www.linuxquestions.org/questions/slackware-14/resolv-conf-how-to-reload-4175621278/)

coldbeer 01-09-2018 09:15 AM

resolv.conf - how to reload?
 
I have slackware machines setup with static ips and I had to change the resolv.conf file.

Does the machine have to be rebooted?

What command can I run to reload the resolv.conf file without rebooting?

thx

kjhambrick 01-09-2018 09:26 AM

coldbeer --

In my experience, editing resolv.conf has always seemed to be 'good enough' ...

YMMV ... ( and I am not sure what applications may be caching DNS )

-- kjh

This is my resolv.conf:

Code:

# cat /etc/resolv.conf

domain kjh.home
search kjh.home
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 192.168.0.1

What server is resolving hostnames for me ( note the SERVER section at the end of the dig output ) ?

Code:

; <<>> DiG 9.10.5-P3 <<>> any google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6319
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 4, ADDITIONAL: 5

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com.                    IN      ANY

;; ANSWER SECTION:
google.com.            86281  IN      CAA    0 issue "pki.goog"

<<snip>>

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Jan 09 09:21:20 CST 2018
;; MSG SIZE  rcvd: 458

Change my resolv.conf

Code:

# cat /etc/resolv.conf

domain kjh.home
search kjh.home
nameserver 8.8.8.8
nameserver 192.168.0.1
nameserver 127.0.0.1

Which SERVER is resolving host names now ?

Code:

# dig any google.com

<<snip>> - jump to the punch line ...

;; Query time: 36 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue Jan 09 09:23:54 CST 2018
;; MSG SIZE  rcvd: 384


coldbeer 01-09-2018 09:27 AM

Looks like resolv.conf changes are effective immediately.

Using the 'dig' command the dns host used is shown at the bottom:

;; Query time: 81 msec
;; SERVER: 144.111.55.235#53(144.111.55.235)
;; WHEN: Tue Jan 09 10:21:30 EST 2018

After I change the resolv.conf and run dig again:

;; Query time: 0 msec
;; SERVER: 144.111.44.79#53(144.111.44.79)
;; WHEN: Tue Jan 09 10:22:11 EST 2018
;; MSG SIZE rcvd: 268

coldbeer 01-09-2018 09:28 AM

Quote:

Originally Posted by kjhambrick (Post 5804170)
coldbeer --

In my experience, editing resolv.conf has always seemed to be 'good enough' ...

YMMV ... ( and I am not sure what applications may be caching DNS )

-- kjh

This is my resolv.conf:

Code:

# cat /etc/resolv.conf

domain kjh.home
search kjh.home
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 192.168.0.1

What server is resolving hostnames for me ( note the SERVER section at the end of the dig output ) ?

Code:

; <<>> DiG 9.10.5-P3 <<>> any google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6319
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 4, ADDITIONAL: 5

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com.                    IN      ANY

;; ANSWER SECTION:
google.com.            86281  IN      CAA    0 issue "pki.goog"

<<snip>>

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Jan 09 09:21:20 CST 2018
;; MSG SIZE  rcvd: 458

Change my resolv.conf

Code:

# cat /etc/resolv.conf

domain kjh.home
search kjh.home
nameserver 8.8.8.8
nameserver 192.168.0.1
nameserver 127.0.0.1

Which SERVER is resolving host names now ?

Code:

# dig any google.com

<<snip>> - jump to the punch line ...

;; Query time: 36 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue Jan 09 09:23:54 CST 2018
;; MSG SIZE  rcvd: 384


I just did the same thing :-) Thanks!

Fat_Elvis 01-13-2018 11:53 PM

Changes to resolv.conf do eventually come into effect, but can take a couple of minutes to "stick," IME. I wonder if there's a way of "forcing" the issue.

By the way, NetworkManager, if you are using it, will overwrite changes to resolv.conf.

Didier Spaier 01-14-2018 03:01 AM

Quote:

Originally Posted by Fat_Elvis (Post 5806203)
By the way, NetworkManager, if you are using it, will overwrite changes to resolv.conf.

Which can be prevented if the file system allows it with:
Code:

chattr -V +i /etc/resolv.conf
I do that because my web hoster's name servers are sometimes slow so I prefer to use public ones.

Fat_Elvis 01-15-2018 10:24 AM

Quote:

Originally Posted by Didier Spaier (Post 5806215)
Which can be prevented if the file system allows it with:
Code:

chattr -V +i /etc/resolv.conf
I do that because my web hoster's name servers are sometimes slow so I prefer to use public ones.

Good info, thanks! I should get around to learning how to set up wi-fi manually one of these days.


All times are GMT -5. The time now is 01:43 AM.