dnsmasq not starting from NetworkManager with SELinux enabled.

OpenWrt - Dnsmasq
OpenWrt – Dnsmasq (Photo credit: magicfab)

 

Some time back I posted on dnsmasq starting from Network Manager and how to setup dnsmasq.

 

Now, couple of days back , I setup dnsmasq in NetworkManager but was astonished to see that there was no dnsmasq running. I checked with dig and saw that there was no response from localhost for dns queries. Checked “ps -eaf|grep dns” and found that there was no dnsmasq running. I knew that once you mention “dns=dnsmasq” in the NetworkManager then it should start up but that was not happening. And then I checked audit log, found that some permissions were denied by SELinux.

 

First check if dnsmasq is indeed having issues because of SELinux:

 

grep -C 5 sealert /var/log/messages

 

If you do see something then time to fix it.

 

grep dnsmasq /var/log/audit/audit.log
audit2allow -M mypol && semodule -i mypol.pp
systemctl restart NetworkManager

 

And with this, you should be done, though you might have to repeat this multiple times.

 

 

Enhanced by Zemanta

dnsmasq – use with Network Manager.

Niles Machine Company
Niles Machine Company (Photo credits: roadtrafficsigns.com)

 

Well if you have not heard about dnsmasq:

 

Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server.
It is designed to provide DNS and, optionally, DHCP, to a small network.
It can serve the names of local machines which are not in the global
DNS. The DHCP server integrates with the DNS server and allows machines
with DHCP-allocated addresses to appear in the DNS with names configured
either in each host or in a central configuration file. Dnsmasq supports
static and dynamic DHCP leases and BOOTP for network booting of diskless
machines.

 

and for the installation :

 

sudo yum install dnsmasq

 

So, now that it is installed, all you need to do is add the following in file: /etc/NetworkManager/NetworkManager.conf

 

dns=dnsmasq

 

in the main section. Restart your network manager using sysctl and you should see that command:

 

dig google.com

 

should show result like below:

 

google.com. 185 IN A 74.125.236.169
google.com. 185 IN A 74.125.236.174
google.com. 185 IN A 74.125.236.160
google.com. 185 IN A 74.125.236.161
;; Query time: 50 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Jan 14 17:16:39 2013
;; MSG SIZE rcvd: 215

 

If it does not, then you might want to add a dispatcher to Network Manager that adds localhost to your “/etc/resolv.conf” file. And here is the name of the file – /etc/NetworkManager/dispatcher.d/localhost-prepend and the contents

 

#!/bin/bash
# Prepend localhost to resolv.conf for dnsmasq

if [[ ! $(grep 127.0.0.1 /etc/resolv.conf) ]]; then
  sed -i '1s|^|nameserver 127.0.0.1n|' /etc/resolv.conf
fi

 

Thats all there is to it 🙂

 

 

Enhanced by Zemanta

dnstop – top like utility for Fedora and other *nix

For installation :

sudo yum install dnstop

And now some description:

dnstop is a libpcap application (ala tcpdump) that displays various
tables of DNS traffic on your network.

dnstop supports both IPv4 and IPv6 addresses.

To help find especially undesirable DNS queries, dnstop provides a
number of filters.

dnstop can either read packets from the live capture device, or from a
tcpdump savefile.

Couple of days back, I realized there was too much network activity on my
system, although I was not doing anything. Fired up wireshark and to my
astonishment, there was too much of DNS traffic on the network. But the
problem was analyzing the data in wireshark and this is where dnstop came
into light. It helped me narrow down the issue within minutes and problems
resolved.

And how to run it :

sudo dnstop eth1

 

Enhanced by Zemanta