LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How to setup a default DNS (https://www.linuxquestions.org/questions/debian-26/how-to-setup-a-default-dns-739429/)

cstrieder 07-11-2009 01:42 PM

How to setup a default DNS
 
Hi,

I have done the configuration of the wired network interface eth0 in the file /etc/network/interfaces, and it seems ok:
Code:

#This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# Ethernet
auto eth0
iface eth0 inet static
address 150.163.27.125
netmask 255.255.255.0
network 150.163.27.0
broadcast 150.163.27.255
gateway 150.163.27.254

# Wireless
#auto lo ath0
#iface lo inet loopback
allow-hotplug ath0
iface ath0 inet dhcp
        wpa-driver wext
        wpa-roam /etc/wpa_supplicant.conf

iface wireless_neusa inet dhcp

iface default inet dhcp

But every time I reboot the machine I need to setup the nameserver in the file /etc/resolv.conf.

Is there a way to setup a default nameserver? And what is the file I need to edit for this?

watcher69b 07-11-2009 08:05 PM

in the ifcfg-eth0
add

DNS1=x.x.x.x
NAMESERVER=x.x.x.x

/etc/resolv.conf likes DNS1= and ifcfg likes NAMESERVER=
so this makes them both happy

AlucardZero 07-11-2009 10:33 PM

Quote:

Originally Posted by watcher69b (Post 3604689)
in the ifcfg-eth0
add

DNS1=x.x.x.x
NAMESERVER=x.x.x.x

/etc/resolv.conf likes DNS1= and ifcfg likes NAMESERVER=
so this makes them both happy

This is Debian (assumed due to the section we're in and the existence of /etc/network/interfaces), not RedHat. ifcfg-eth0 doesn't exist.

cstrieder 07-12-2009 01:30 PM

Hi,

I did not understant both posts at all.

I am using Debian Lenny.

I put
Code:

nameserver 150.163.27.9
in the /etc/network/interfaces, but it does not help.

Code:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# Ethernet
auto eth0
iface eth0 inet static
address 150.163.27.125
netmask 255.255.255.0
network 150.163.27.0
broadcast 150.163.27.255
gateway 150.163.27.254
nameserver 150.163.27.9

# Wireless
#auto lo ath0
#iface lo inet loopback
allow-hotplug ath0
iface ath0 inet dhcp
        wpa-driver wext
        wpa-roam /etc/wpa_supplicant.conf

iface wireless_neusa inet dhcp

iface default inet dhcp

Any ideas?

scrooge74 07-16-2009 04:22 PM

You need to prepend the DNS address in /etc/dhcp3/dhclient.conf

prepend domain-name-servers 208.67.222.222,208.67.220.220;

those are OpenDNS servers, you can put any other if you want

cstrieder 07-18-2009 03:41 PM

Hi scrooge74,

I am trying what you say.

Do you know if it works with more then 2 dns addresses?

Thanks.

scrooge74 07-19-2009 08:50 AM

Quote:

Originally Posted by cstrieder (Post 3612057)
Hi scrooge74,

I am trying what you say.

Do you know if it works with more then 2 dns addresses?

Thanks.


Well open dns instructions are to use both of them (one is backup) and if you remember in XP you had two spots for the same.

Here you can check the instructions


All times are GMT -5. The time now is 10:22 PM.