Is dns cache cleared after restarting dnsmasq?

Or is it still stored in temp ?

It's flushed. It's an in-memory cache.

From the manpage

When it receives a SIGHUP, dnsmasq clears its cache and then re-loads /etc/hosts and /etc/ethers and any file given by --dhcp-hostsfile, --dhcp-hostsdir, --dhcp-optsfile, --dhcp-optsdir, --addn-hosts or --hostsdir.

See below for all opened files on a running dnsmasq instance

root@openwrt:/var/log# lsof -c dnsmasq
COMMAND   PID    USER   FD      TYPE             DEVICE SIZE/OFF    NODE NAME
dnsmasq 31838 dnsmasq  cwd       DIR                8,2     8192       2 /
dnsmasq 31838 dnsmasq  rtd       DIR                8,2     8192       2 /
dnsmasq 31838 dnsmasq  txt       REG                8,2   388600  141354 /usr/sbin/dnsmasq
dnsmasq 31838 dnsmasq  mem       REG                8,2    47040  394543 /lib/libnss_files-2.33.so
dnsmasq 31838 dnsmasq  mem       REG                8,2    26432  129066 /usr/lib/libmnl.so.0.2.0
dnsmasq 31838 dnsmasq  mem       REG                8,2  1794216  394528 /lib/libc-2.33.so
dnsmasq 31838 dnsmasq  mem       REG                8,2   100112  394535 /lib/libgcc_s.so.1
dnsmasq 31838 dnsmasq  mem       REG                8,2    30616  394554 /lib/libubus.so.20210215
dnsmasq 31838 dnsmasq  mem       REG                8,2    51008  394553 /lib/libubox.so.20210302
dnsmasq 31838 dnsmasq  mem       REG                8,2   489416  128976 /usr/lib/libgmp.so.10.4.1
dnsmasq 31838 dnsmasq  mem       REG                8,2   288520  128990 /usr/lib/libhogweed.so.6.0
dnsmasq 31838 dnsmasq  mem       REG                8,2   259968  129110 /usr/lib/libnettle.so.8.0
dnsmasq 31838 dnsmasq  mem       REG                8,2    29888  129112 /usr/lib/libnfnetlink.so.0.2.0
dnsmasq 31838 dnsmasq  mem       REG                8,2   120136  129094 /usr/lib/libnetfilter_conntrack.so.3.7.0
dnsmasq 31838 dnsmasq  mem       REG                8,2   198200  394520 /lib/ld-2.33.so
dnsmasq 31838 dnsmasq    0u      CHR                1,3      0t0    5296 /dev/null
dnsmasq 31838 dnsmasq    1u      CHR                1,3      0t0    5296 /dev/null
dnsmasq 31838 dnsmasq    2u      CHR                1,3      0t0    5296 /dev/null
dnsmasq 31838 dnsmasq    3u      REG               0,18      931     195 /tmp/dhcp.leases
dnsmasq 31838 dnsmasq    4u     IPv4            6003698      0t0     UDP *:bootps 
dnsmasq 31838 dnsmasq    5u  netlink                         0t0 6003699 NETFILTER
dnsmasq 31838 dnsmasq    6u  netlink                         0t0 6003700 ROUTE
dnsmasq 31838 dnsmasq    7u     IPv4            6003702      0t0     UDP *:domain 
dnsmasq 31838 dnsmasq    8u     IPv4            6003703      0t0     TCP *:domain (LISTEN)
dnsmasq 31838 dnsmasq    9u     IPv6            6003704      0t0     UDP *:domain 
dnsmasq 31838 dnsmasq   10u     IPv6            6003705      0t0     TCP *:domain (LISTEN)
dnsmasq 31838 dnsmasq   11u  a_inode               0,10        0      28 [eventpoll:12]
dnsmasq 31838 dnsmasq   12r     FIFO                0,9      0t0 6003706 pipe
dnsmasq 31838 dnsmasq   13w     FIFO                0,9      0t0 6003706 pipe
dnsmasq 31838 dnsmasq   14u     unix 0x00000000bb58de35      0t0 6003707 type=STREAM 
dnsmasq 31838 dnsmasq   15u     unix 0x0000000015d2c601      0t0 6003708 type=DGRAM 
dnsmasq 31838 dnsmasq   16r     FIFO                0,9      0t0 6011905 pipe
dnsmasq 31838 dnsmasq   17w     FIFO                0,9      0t0 6011905 pipe
dnsmasq 31838 dnsmasq   18u     unix 0x000000009c591a94      0t0 6011907 type=DGRAM 
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.