ilium007
Posts: 4
Joined: Mon Aug 27, 2012 12:22 am

DNS server issues

Tue Jul 07, 2015 2:57 pm

Hi - this has me stumped. I have set static DNS server names in /etc/network/interfaces (yes, I have resolvconf installed).

Code: Select all

auto lo
iface lo inet loopback

#auto eth0
#allow-hotplug eth0
#iface eth0 inet dhcp

auto eth0
iface eth0 inet static
address 192.168.10.7
netmask 255.255.255.0
gateway 192.168.10.1
dns-nameservers 209.222.18.222 209.222.18.218
But no matter what I do I end up with my router gateway (local DNS proxy) in the resulting /etc/resolv.conf:

Code: Select all

i@raspberrypi ~ $ 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
nameserver 192.168.10.1
nameserver 209.222.18.222
nameserver 209.222.18.218
search local
pi@raspberrypi ~ $
I do not want 192.168.10.1 in that list. I dont know where it is coming from. My only guess is the DHCP client that should NOT be doing anything as I am running a static IP config on eth0.

I am running Debian Wheezy:

Code: Select all

i@raspberrypi ~ $ cat /etc/debian_version
7.8
pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.18.11+ #781 PREEMPT Tue Apr 21 18:02:18 BST 2015 armv6l GNU/Linux
pi@raspberrypi ~ $
Any help would be appreciated.

liuxuanl
Posts: 1
Joined: Wed Feb 03, 2016 9:00 am

Re: DNS server issues

Wed Feb 03, 2016 9:05 am

auto eth0
iface eth0 inet static
address 192.168.10.7
netmask 255.255.255.0
gateway 192.168.10.1
dns-nameservers 209.222.18.222 209.222.18.218

you need to delete auto eth0

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: DNS server issues

Wed Feb 03, 2016 12:28 pm

Is this Raspbian Wheezy of Raspbian Jessie?

If it's Jessie then you're doing it wrong. Put the /etc/network/interfaces file back to the way it was (or re-install raspberrypi-net-mods). Do your stuff for your static IP address and DNS servers in /etc/dhcpcd.conf.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: DNS server issues

Wed Feb 03, 2016 2:19 pm

... it's wheezy as stated in the OP.

The easiest way is to change your /etc/dhcp/dhclient.conf file and add your DNS servers there:

Code: Select all

supersede domain-name-servers 8.8.8.8, 8.8.4.4;
Otherwise, if you prefer to do it in the interfaces file, you can add a hook in /etc/dhcp/dhclient-enter-hooks.d/. Create a executable script, say, keep_off_my_dns with:

Code: Select all

#!/bin/sh
make_resolv_conf() {
    exit 0
}
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

krattai
Posts: 8
Joined: Sat Oct 04, 2014 4:33 am

Re: DNS server issues

Wed Sep 28, 2016 8:53 pm

I have a similar problem, although in my case, it's on a dhcp connection.

I do have this working properly on a static IP pi, simply by setting interfaces as listed above.

The one I'm having problems with is configured in interfaces as follows:

Code: Select all

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
dns-nameservers 50.116.23.211 209.141.53.57
resolv.conf shows the following:

Code: Select all

# Generated by resolvconf
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 50.116.23.211
nameserver 209.141.53.57
I have also tried adding DNS to dhclient.conf:

Code: Select all

prepend domain-name-servers 50.116.23.211 209.141.53.57;
Raspbian Wheezy, as original OP. Also currently up to date.

Does anyone have any ideas how to get rid of the router issued DNS or how to get prepend to work, properly?

Return to “Advanced users”