Dnsmasq running as nobody

Hi,

I’ve experienced some problems with DNS when backup GSM connection was switched off and on again. It seems like if the file /tmp/resolv.conf.auto is ignored sometimes even if it is filled properly. Googling around, I’ve found some posts related to this problem and to the user rights to read this file. Finaly I’ve found that dnsmasq on my Turris is run as noname. My question is: Is it correct?

Regards

Fanda

  PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
 1704 root       20   0  1516   868   732 S  0.0  0.0  0:05.26 /sbin/netifd
10224 root       20   0  1416  1176   776 R  0.0  0.1  0:00.07 htop
 6779 root       20   0   688   376   356 S  0.0  0.0  0:00.10 nethist
    1 root       20   0  1340   768   624 S  0.0  0.0  0:03.97 /sbin/procd
  811 root       20   0   804   424   400 S  0.0  0.0  0:02.08 /sbin/ubusd
  889 root       20   0   688   440   420 S  0.0  0.0  0:00.00 /sbin/askfirst /bin/ash --login
 1620 root       20   0  1872   832   736 S  0.0  0.0  0:00.19 /sbin/rpcd
 1683 root       20   0  6360  5588  1916 S  0.0  0.3  0:00.44 /usr/bin/python /usr/sbin/sfpswitch.py --nodaemon
 1862 root       20   0  1096   612   580 S  0.0  0.0  0:01.24 /usr/sbin/odhcpd
 1905 nobody     20   0   764   456   432 S  0.0  0.0  0:00.00 /usr/sbin/atd -f
 1980 root       20   0  2800   164     0 S  0.0  0.0  0:00.00 /usr/sbin/sshd -f /var/etc/ssh/sshd_config
 1986 root       20   0  4304   176     0 S  0.0  0.0  0:00.00 supervising syslog-ng
 1987 root       20   0  4472  2468  2240 S  0.0  0.1  0:01.03 /usr/sbin/syslog-ng
 2134 root       20   0  2000    96     0 S  0.0  0.0  0:07.38 /usr/sbin/hostapd -P /var/run/wifi-phy1.pid -B /var/run/hostapd-phy1.conf
 2141 root       20   0  2000   108     0 S  0.0  0.0  0:27.48 /usr/sbin/hostapd -P /var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf
 2167 root       20   0  1076   492   472 S  0.0  0.0  0:00.00 udhcpc -p /var/run/udhcpc-eth1.pid -s /lib/netifd/dhcp.script -f -t 0 -i eth1 -C -O 212
 2183 root       20   0   720   404   384 S  0.0  0.0  0:00.08 odhcp6c -s /lib/netifd/dhcpv6.script -P0 -t120 eth1
 2272 nobody     20   0   876   680   640 S  0.0  0.0  0:00.45 /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf -k -x /var/run/dnsmasq/dnsmasq.pid

It is. But dnsmasq is by default not used for DNS on Omnia. There is kresd for that. It should, however, be properly restarted after each change of /tmp/resolv.conf.auto by script /etc/hotplug.d/iface/40-resolver-reload.

What exact issues are you facing? kresd should work properly even with empty list of upstream resolvers.

We are using the GSM connection as a backup one. When we pull the ethernet (WAN) cable out, all the traffic is routed do GSM, what is fine. When ethernet is connected back, then intranet (WAN is connected to company network) domain names cannot be resolved. Sometimes DNS stop to work directly after WAN cable pull out.

Should be dnsmasq on the list of running processes?

This could happen due to caching. Can you check the generated config file /tmp/kresd.config whether there is right set of DNS forwarders configured in any moment? We could then isolate whether the issue occurs somewhere in the init system or in the Knot itself.

Yes, it works as DHCP server.

Hi,

so what is current default configuration, kresd as DNS+IPv6 DHCP and dnsmasq as IPv4 DHCP or? If I remember, dnsmasq was disabled by default.

  • DNS: kresd
  • DHCP: dnsmasq
  • DHCPv6: odhcpd

Because to use dnsmasq for DHCP and don’t use odhcpd I don’t know (upstream compatibility, I think), seems too it support it: odhcpd [Old OpenWrt Wiki]

root@turris:~# ping google.com
^C
root@turris:~# cat /tmp/kresd.config
--Automatically generated file; DO NOT EDIT
modules = {
    'hints'
  , 'policy'
  , 'stats'
  , predict = {
        window = 30 -- 30 minutes sampling window
      , period = 24*(60/30) -- track last 24 hours
  }
}
hints.config('/etc/hosts')
net.bufsize(4096)
net.ipv4=true
net.ipv6=true
cache.open(20*MB)
cache.clear()
policy:add(policy.all(policy.FORWARD('10.0.0.21')))
policy:add(policy.all(policy.FORWARD('8.8.8.8')))
root@turris:~# 

it seems like if 10.0.0.21 is still used for DNS, but this is disconected now (cable is pulled out)

Hi @pgotze, did you get an answer on dnsmasq being disabled by default? I thought it was supposed to be enabled; and that my finding it disabled on my router yesterday indicated a problem/failure - thinking enough errors had been thrown that the os disabled it?

If i understood, dnsmasq is by default enabled as service for DHCP v4. I think in past it was not like that, because when i had turris new, it was disabled i think. But now its probably DHCP v4 server by default. Therefore it must run in fact.

Hi @pgotze, based on what I found after performing a factory reset, dnsmasq is enabled by default. Kresd appears to be disabled by default.

Well try these commands

netstat -lp | grep -I 53

netstat -lp | grep -I 67

on both is dnsmasq only listening?

Curious. No process is listening on either 53 or 67. Kresd, odhcpd and dnsmasq all are running. Will investigate further, as most of my servers are not receiving their ip assignments, thus are not showing up on the network. Also Kresd shows up as disabled during startup, so I would not expect it to be running.

Add “-n” option to netstat before greping, like this:

netstat -nlp | grep :53

Ahhh, thanks @white, here are the results:

netstat -nlp | grep :53
tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 2505/kresd
tcp 0 0 :::53 :::* LISTEN 2505/kresd
udp 0 0 0.0.0.0:53 0.0.0.0:* 2505/kresd
udp 0 0 :::53 :::* 2505/kresd

netstat -nlp | grep :67
udp 0 0 0.0.0.0:67 0.0.0.0:* 2192/dnsmasq

Appears to me that both processes are bound to the correct ports for their intended uses on the Omnia.

Yeahh thats what i thought. You wrote kresd is disabled, but its not. Both services are used, kresd as DNS as well as dnsmasq as DHCP v4.