Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to make my system resolve IPv4 addresses over an IPv6 connection because my IPv6 connection is more secure (yes, it really is. Long story). The IPv6 nameserver resolves IPv4 addresses; it works fine with "dig" command-line tool.

However, NetworkManager GUI doesn't accept IPv6 addresses for IPv4 DNS. Some guides advise to edit /etc/resolv.conf, but on Ubuntu that file has a notice that the file will be overwritten and should not be edited.

Is there any way to convince some part of NetworkManager that I really actually want it to use IPv6 DNS for IPv4? Or maybe there's some file other than /etc/resolv.conf? For the record, I'm on Ubuntu 12.04 (Precise).

share|improve this question
    
Why add an IPv4 DNS server at all I you have a working IPv6 DNS resolver? The computer will use any resolvers it has access to, unrestricted to what IP version you use. If you want, add a caching server at 127.0.0.1 and use that one. That server could use your IPv6. –  Anders May 1 '13 at 15:56
    
Unfortunately speficying no servers in IPv4 tab of NetworkManager GUI makes it use DHCP-supplied nameservers. /etc/resolv.conf already points to 127.0.0.1, so I suspect Ubuntu has some kind of DNS caching out of the box... I can even see the DNS packets coming through the loopback interface with Wireshark and then going to the IPv4 DNS over eth0. I just have no idea how to configure the local caching server to use the IPv6 link instead. –  Shnatsel May 1 '13 at 21:46
    
I have dnsmasq 2.59 running locally according to nmap. I wonder how it's configured in Ubuntu. –  Shnatsel May 1 '13 at 21:58
    
I guess I'll try sokratisg.net/2012/03/31/… and see where that gets me –  Shnatsel May 1 '13 at 22:06
    
So I got it working using a custom dnsmasq config, except I have to restart NetworkManager every time I boot the system to get internet to work. Weird. –  Shnatsel May 1 '13 at 23:26
add comment

1 Answer

It is true that in Ubuntu 12.04 and later you should not edit /etc/resolv.conf directly. Instead you enter nameserver information into the configuration file (or dialog box) for each utility that configures a network interface, whether it's ifup, NetworkManager, a VPN client, whatever.

Despite its being a dynamically generated file, /etc/resolv.conf has the same syntax as it always did. See resolv.conf(5) for its syntax.

Since you are using NetworkManager you should enter your DNS nameserver addresses in the "DNS servers" fields for the connection in question.

On the tab

Network indicator | Edit Connections... | <connection> | Edit... | IPv6 Settings

you should be able to enter the IPv6 address of your DNS nameserver into the "DNS servers" field. This address should then show up in resolv.conf and thus get used as a nameserver address by the glibc resolver.

share|improve this answer
    
I did this, but it only gets used for IPv6 addresses; IPv4 addresses are still requested from the DHCP-provided nameserver, no matter what I set in NetworkManager on the DHCP tab. –  Shnatsel May 10 '13 at 15:43
    
Try adding the line options single-request to the file /etc/resolvconf/resolv.conf.d/base. After doing this, run sudo resolvconf -u to update resolv.conf which should now contain the options single-request line. Please report whether or not this makes any difference. –  jdthood May 14 '13 at 9:29
1  
Are you using the NetworkManager-controlled local forwarding nameserver? (You are using it if resolv.conf contains nameserver 127.0.0.1.) If so then disable it: gksudo gedit /etc/NetworkManager/NetworkManager.conf; comment out the line dns=dnsmasq (i.e., put a '#' at the beginning of the line); save and sudo restart network-manager. –  jdthood May 14 '13 at 11:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.