# [SOLVED]NetworkManager not work with dnsmasq

## Jusong

i set /etc/NetworkManager/NetworkManager.conf follow the instructions in the wiki https://wiki.gentoo.org/wiki/NetworkManager#Dnsmasq

```

[main]

plugins=keyfile

dns=dnsmasq

```

then restart NetworkManger,and cat /etc/reslov.conf got

```
nameserver 127.0.0.1
```

use dig to test dnsmasq is ok，but after a while the /etc/reslov.conf changed to 

```
nameserver 10.0.0.1
```

and dig test that dns server is 10.0.0.1, dnsmasq not work, i don't know why the file of /etc/reslov.conf changed automatic, anybody can help me?Last edited by Jusong on Tue Oct 25, 2016 6:48 am; edited 3 times in total

----------

## Roman_Gruber

So what is your question?

----------

## xaviermiller

Moved to the Chinese subforum

----------

## xaviermiller

Re-moved to an english sub-forum  :Smile: 

----------

## Jusong

 *xaviermiller wrote:*   

> Re-moved to an english sub-forum 

 

thanks  :Very Happy: 

----------

## Logicien

NetworkManager can write in /etc/resolv.conf but other applications can do it too like Dnsmasq itself, Dhcpcd, Dhclient and Resolvconf. If NetworkManager have some configured connexions it can write again in /etc/resolv.conf using a Dhcp client for example. The configuration of Dnsmasq can do so too. Most applications who touch /etc/resolv.conf can be configure to not write in.

I suppose that Dnsmasq have some public Dns servers in it's configuration to resolv domain names because, 127.0.0.1 resolv nothing unless it lead to Named and it's public Dns servers for the resolution.

You can have a more precise idea of what is running related to the domain names resolution with the command

```
ps aux | grep -i -e dh -e dns -e name -e net -e reso -e wpa
```

----------

## Jusong

 *Logicien wrote:*   

> NetworkManager can write in /etc/resolv.conf but other applications can do it too like Dnsmasq itself, Dhcpcd, Dhclient and Resolvconf. If NetworkManager have some configured connexions it can write again in /etc/resolv.conf using a Dhcp client for example. The configuration of Dnsmasq can do so too. Most applications who touch /etc/resolv.conf can be configure to not write in.
> 
> I suppose that Dnsmasq have some public Dns servers in it's configuration to resolv domain names because, 127.0.0.1 resolv nothing unless it lead to Named and it's public Dns servers for the resolution.
> 
> You can have a more precise idea of what is running related to the domain names resolution with the command
> ...

 

the output:

```

root      2141  0.0  0.3 581780 13704 ?        Ssl  10:00   0:04 /usr/sbin/NetworkManager --no-daemon

root      2203  0.0  0.1  36716  5700 ?        Ss   10:00   0:01 /usr/sbin/wpa_supplicant -u

root      2244  0.0  0.2  16816  9736 ?        S    10:00   0:00 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /run/dhclient-wlp4s0.pid -lf /var/lib/NetworkManager/dhclient-b3dbbb03-03f4-4cd8-a3b5-fd0ca87186e2-wlp4s0.lease -cf /var/lib/NetworkManager/dhclient-wlp4s0.conf wlp4s0

```

there is dhclient work with my NM, i try to uncomment below line in /etc/dhcp/dhclient.conf

```
prepend domain-name-servers 127.0.0.1;
```

and then restart NM, exec cat /etc/resolv.conf got 

```
# Generated by NetworkManager

nameserver 127.0.0.1

nameserver 10.0.0.1
```

and dig www.gentoo.org show that dns server is 127.0.0.1, so it looks like work well, thanks for your reminder  :Very Happy: 

----------

