0

I have this configuration in my server in the Network Manager connection:

/etc/NetworkManager/system-connections/wired-connection

[connection]
id=wired-connection
uuid=0c501f08acc5497cb7...
type=8023ethernet

[8023ethernet]

[ipv4]
method=manual
dns=8.8.8.8;
address1=192.168.1.250/24,192.168.1.1

[ipv6]
method=auto
ip6privacy=0

/etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=true

But my file /etc/resolv.conf (symbolic link) is not overwritten by the Network Manager. If I add manually the line nameserver 8.8.8.8 to the file it works well, but it is only a temporal solution. If I open the IP configuration, in the interface of Kubuntu, I see the DNS fields empty.

I also tried with this command, but it didn't work dpkg-reconfigure resolvconf

The route of my original configuration file is in /run/resolvconf/resolv.conf

And I found this file, it belongs to an old configuration /etc/resolvconf/resolv.conf.d/original

nameserver 213.60.205.175
nameserver 213.60.205.174
nameserver 212.51.33.110

Should I remove or edit this file to make it work?

I can access only remotely to the server, due to this I would like to be sure that's going to work. If not I could break the connection

Thanks in advance

Update 03/08/15. Output of /usr/share/resolvconf/dump-debug-info

###### Start of debugging information for resolvconf ######
### ls -l /etc/resolvconf
total 16
-rw-r--r-- 1 root root  172 dic 13  2012 interface-order
drwxr-xr-x 2 root root 4096 jul  8 18:33 resolv.conf.d
drwxr-xr-x 2 root root 4096 jul  8 18:33 update.d
drwxr-xr-x 2 root root 4096 jul  8 19:11 update-libc.d
### cat /etc/resolvconf/interface-order
# interface-order(5)
lo.inet*
lo.dnsmasq
lo.pdnsd
lo.!(pdns|pdns-recursor)
lo
tun*
tap*
hso*
em+([0-9])?(_+([0-9]))*
p+([0-9])p+([0-9])?(_+([0-9]))*
eth*
ath*
wlan*
ppp*
*
### ls -l /etc/resolvconf/resolv.conf.d
total 8
-rw-r--r-- 1 root root   0 dic 13  2012 base
-rw-r--r-- 1 root root 151 dic 13  2012 head
-rw-r--r-- 1 root root  77 jul  8 18:21 original
-rw-r--r-- 1 root root   0 jul  8 18:26 tail
### cat /etc/resolvconf/resolv.conf.d/base
### cat /etc/resolvconf/resolv.conf.d/head
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
### cat /etc/resolvconf/resolv.conf.d/original
nameserver 213.60.205.175
nameserver 213.60.205.174
nameserver 212.51.33.110
### cat /etc/resolvconf/resolv.conf.d/tail
### ls -l /etc/resolvconf/run
ls: no se puede acceder a /etc/resolvconf/run: No existe el archivo o el directorio
### ls -l /run/resolvconf
total 4
-rw-r--r-- 1 root root   0 jul 29 10:10 enable-updates
drwxr-xr-x 2 root root  40 jul 29 10:10 interface
-rw-r--r-- 1 root root 151 ago  3 09:40 resolv.conf
### cat /run/resolvconf/enable-updates
### cat /run/resolvconf/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
### ls -l /run/resolvconf/interface
total 0
### ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 29 jul 24 12:59 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
### lsattr /etc/resolv.conf
lsattr: La operación no está soportada Mientras se leían las banderas en /etc/resolv.conf
### cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
### cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=true
###### End of debugging information for resolvconf ######

I'm using Kubuntu 14.04 by the way

ChesuCR
  • 175

3 Answers3

2

The dnsmasq executable binary is included in the dnsmasq-base package.

When dns=dnsmasq appears uncommented in NetworkManager.conf, NetworkManager runs a dnsmasq instance to serve as a local forwarding nameserver.

The dnsmasq package includes configuration files which support running a dnsmasq instance independently of NetworkManager. The latter dnsmasq instance is configured by /etc/dnsmasq.conf.

The resolvconf utility is used by network interface configurers to manage nameserver information. On the basis of information that it has been provided it writes a file /run/resolvconf/resolv.conf which is intended to be used to configure the libc resolver. The file is activated in this role by creating a symbolic link from /etc/resolv.conf to /run/resolvconf/resolv.conf.

NetworkManager and ifup send nameserver information to resolvconf. Normally /etc/resolv.conf is a symbolic link to /run/resolvconf/resolv.conf and all works well.

In case dns=dnsmasq appears uncommented in NetworkManager.conf, NetworkManager supplies resolvconf with the nameserver address 127.0.1.1 which appears in resolv.conf; NetworkManager's slave dnsmasq process listens at address 127.0.1.1 and forwards queries to external nameservers at addresses that NetworkManager has been configured to know about or has learned about via DHCP.

The questioner's first remark is:

But my file /etc/resolv.conf (symbolic link) is not overwritten by the Network Manager. 

This indicates that there is a misconfiguration. /etc/resolv.conf should be a symbolic link to /run/resolvconf/resolv.conf and resolvconf should update the latter when some network interface is configured or deconfigured. Given that you have dns=dnsmasq in NetworkManager.conf, the nameserver line in resolv.conf should be nameserver 127.0.1.1, unless you have the server instance of dnsmasq running in which case it might be nameserver 127.0.0.1, thus directing the libc resolver to use the server instance of dnsmasq which listens at 127.0.0.1.

The questioner's subsequent question is:

[...] /etc/resolvconf/resolv.conf.d/original [...]
Should I remove or edit this file to make it work?

This file (original) which is simply a copy of /etc/resolv.conf at the time the resolvconf package is installed, normally has no effect. It is kept by the resolvconf package in case the package is uninstalled, then this original file is put back at /etc/resolv.conf. In some cases /etc/resolvconf/resolv.conf.d/tail is a symbolic link to original but that is non-standard and if this holds for your system then you should change /etc/resolvconf/resolv.conf.d/tail to be an empty file or a symbolic link to /dev/null.

jdthood
  • 12,467
  • Thank you for your good explanation. In fact /etc/resolv.conf is a symbolic link to /run/resolvconf/resolv.conf, but it doesn't take any nameserver. And tail is simply a empty file. If I write manually nameserver 127.0.1.1 in the file /run/resolvconf/resolv.conf it doesn't work. It works only when I write nameserver 8.8.8.8. I also checked the file /etc/hosts and it has these two lines: 127.0.0.1 localhost and 127.0.1.1 my-pc-name. I still don't know what is wrong. – ChesuCR Jul 31 '15 at 09:27
  • When I say my-pc-name I mean my hostname – ChesuCR Jul 31 '15 at 09:32
  • I just looked at the output of dump-debug-info which you posted in your question. Everything looks normal, except that there are no resolvconf records, i.e., no files in /run/resolvconf/interface/. Normally NetworkManager submits to resolvconf a record named "NetworkManager" comprising either nameserver 127.0.1.1 plus the domain search path statement (if dns=dnsmasq in NetworkManager.conf) or nameserver EXTERNALNAMESERVERADDRESS plus the domain search path statement (otherwise). But for some reason this does not appear to have happened. – jdthood Aug 07 '15 at 09:10
  • You may need to add a dns-nameserver option line to the appropriate stanza in the file /etc/network/interfaces. See ifup(8), interfaces(5), resolvconf(8) and /usr/share/doc/resolvconf/README.gz for more info. Then also try setting [ifupdown] managed=false in NetworkManager.conf; then I believe ifup will configure the interface instead of NetworkManager. – jdthood Aug 07 '15 at 09:20
  • You can also try removing and re-installing the resolvconf package. Please let us know the results of these experiments. – jdthood Aug 08 '15 at 19:42
  • Thank you @jdthood for your interest. I would like to experiment more in that server and find a permanent solution, but it is very risky because if something is not working as expected maybe I loose the communication with the server and that could be a big problem (the server is far away). Finally I just added manually nameserver 8.8.8.8 to the /etc/resolv.conf file as a temporary solution. If I find out something new or if I can make some tests I'll let you know :), and sorry for the late comment – ChesuCR Sep 08 '15 at 20:34
0

What worked for me is enabling resolvconf service:

sudo systemctl enable resolvconf
sudo reboot

The problem was resolvconf not starting at startup after installing some VPN crap.

0

It seems you're using dnsmasq which is a caching DNS server.

If you want to add a DNS server, you can exec this command :

echo nameserver X.X.X.X | sudo resolvconf -a IFACE.PROGNAME
sudo service dnsmasq restart 

where IFACE.PROGNAME is the name of the network you use (eth0, eth1, wlan0...)

For a permanent change, you can create a /etc/resolv.dnsmasq.conf with

nameserver  8.8.8.8

and edit the /etc/dnsmasq.conf and set :

resolv-file=/etc/resolv.dnsmasq.conf

Another solution, could be to disable the use of dnsmasq by commenting the line

dns=dnsmasq

in the file /etc/NetworkManager/NetworkManager.conf. And use /etc/resolv.conf file.

aklmie
  • 1,046
  • It seems I don't have installed dnsmasq, then I'm going to use the last option, thanks
    `p   dnsmasq                - Small caching DNS proxy and DHCP/TFTP server`
    
    – ChesuCR Jul 30 '15 at 08:46