# /etc/resolv.conf mysteries



## grahamperrin@ (Apr 18, 2022)

FreeBSD uptime less than one day. 

I have not been on campus for more than four days. 

`resolvconf -u` resulted in addition of campus-related entries to an empty /etc/resolv.conf

If the entries did not come from /etc/resolvconf.conf, from where did they come?


----------



## VladiBG (Apr 18, 2022)

from DHCP or IPv6 Router adv


----------



## grahamperrin@ (Apr 19, 2022)

My router at home does use DHCP, but nothing fancy, it's not configured to do anything campus-related. 

For IPv6, I have a tunnel with Hurricane Electric <https://tunnelbroker.net/> that's configured to work only with my router at home.


----------



## gpw928 (Apr 19, 2022)

The potential "subscribers" are in /libexec/resolvconf/.
They are shell scripts.  You could try adding a telltale trace into each of them.


----------



## grahamperrin@ (Apr 19, 2022)

> The potential "subscribers" are in /libexec/resolvconf/. …




```
% ls
dnsmasq         libc            named           pdns_recursor   pdnsd           unbound
% less dnsmasq
% less libc
% man nscd
% less /etc/nscd.conf
% cat /etc/nscd.conf
#
# Default caching daemon configuration file
# $FreeBSD$
#

enable-cache passwd yes
enable-cache group yes
enable-cache hosts yes
enable-cache services yes
enable-cache protocols yes
enable-cache rpc yes
enable-cache networks yes
% less named
% less pdns_recursor
% less pdnsd
% less unbound
% sysrc local_unbound_enable
local_unbound_enable: NO
%
```

nscd(8)

Is it possible for data cached on 14th April (or earlier) on campus to survive four subsequent boots of the OS, where each subsequent boot was with a single router that uses DHCP and requires different data?


```
% cal
     April 2022      
Su Mo Tu We Th Fr Sa
                1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
                     
% grep -e BOOT -e reboot /var/log/messages | tail -n 8
Apr 13 08:16:03 mowa219-gjp4-8570p-freebsd kernel: ---<<BOOT>>---
Apr 15 15:17:34 mowa219-gjp4-8570p-freebsd shutdown[18406]: reboot by root:
Apr 15 15:23:58 mowa219-gjp4-8570p-freebsd kernel: ---<<BOOT>>---
Apr 17 03:50:49 mowa219-gjp4-8570p-freebsd shutdown[9373]: reboot by root:
Apr 17 03:55:14 mowa219-gjp4-8570p-freebsd kernel: ---<<BOOT>>---
Apr 17 19:00:23 mowa219-gjp4-8570p-freebsd kernel: ---<<BOOT>>---
Apr 17 23:59:47 mowa219-gjp4-8570p-freebsd shutdown[23047]: reboot by root:
Apr 18 00:01:59 mowa219-gjp4-8570p-freebsd kernel: ---<<BOOT>>---
%
```


```
% cat /etc/resolvconf.conf | grep -v \#
%
```



> … shell scripts.  You could try adding a telltale trace into each of them.



Thanks, but honestly, I wouldn't know what to do with scripting (and I wouldn't want to get into it, I'm necessarily focused on learning other stuff for the next few weeks).

Retrospective​
The computer became unusable (with the Internet with Wi-Fi) at the time of the incident, so I resorted to `service netif restart` followed by (amongst other things) `/etc/netstart`. 

`/etc/netstart` is explicitly obsolete, but it typically becomes *essential* when networking misbehaves for me. 



Spoiler: extract from history





```
2041  20:55   service netif restart
  2042  20:55   cat /etc/resolv.conf
  2043  20:56   ifconfig gif0 down
  2044  20:56   ifconfig em0 down
  2045  20:56   cat /etc/resolv.conf
  2046  20:56   ifconfig wlan0
  2047  20:56   cat /etc/resolv.conf
  2048  20:56   resolvconf -u
  2049  20:56   cat /etc/resolv.conf
  2050  20:56   service netif restart wlan0
  2051  20:56   ifconfig wlan0
  2052  20:56   cat /etc/resolv.conf
  2053  20:57   cat /etc/resolv.conf
  2054  20:57   ifconfig wlan0
  2055  20:57   cat /etc/resolv.conf
  2056  20:57   resolvconf -u
  2057  20:57   cat /etc/resolv.conf
  2058  20:57   resolvconf -u
  2059  20:57   cat /etc/resolv.conf
  2060  20:57   route delete default
  2061  20:57   service resolv stop
  2062  20:57   service resolv start
  2063  20:57   cat /etc/resolv.conf
  2064  20:57   cat /etc/resolv.conf
  2065  20:57   resolvconf -u
  2066  20:58   cat /etc/resolv.conf
  2067  20:58   service dhclient restart wlan0
  2068  20:58   cat /etc/resolv.conf
  2069  20:58   cat /etc/resolv.conf
  2070  20:58   resolvconf -u
  2071  20:58   cat /etc/resolv.conf
  2072  20:58   /etc/netstart
  2073  20:58   ifconfig
  2074  20:58   ping -6 freshports.org
  2075  20:59   cat /etc/resolv.conf
  2076  20:59   service netif stop em0
  2077  20:59   ifconfig gif0 down
  2078  20:59   cat /etc/resolv.conf
  2079  20:59   cat /etc/resolv.conf
  2080  20:59   resolvconf -u
  2081  20:59   cat /etc/resolv.conf
  2082  20:59   service netif restart wlan0
  2083  21:00   cat /etc/resolv.conf
  2084  21:00   ping -6 freshports.org
  2085  21:00   ifconfig gif0 down
  2086  21:00   ping -4 freshports.org
  2087  21:00   cat /etc/resolv.conf
  2088  21:03   cat /etc/resolvconf.conf
  2089  1:59    gh repo sync grahamperrin/freebsd-doc && cd /usr/doc && gh repo sync && git -C /usr/ports pull --ff-only && git -C /usr/src pull --ff-only && cd
```


----------

