LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-16-2009, 11:12 AM   #1
tuananh87vn
LQ Newbie
 
Registered: Mar 2009
Posts: 19

Rep: Reputation: 0
config dns server


hello, I'm using debian 5 and I'm trying to configure the dns server for my machine.

I've already set static IP for my machine then tried to set up the dns server. But either i tried by GUI or by command-line all the ips of dns server disappeared each time i reboot the system

can anybody tell me how to fix the dns server for my machine using command-line?

I tried with the file /etc/resolv.conf but it just works before i reboot. after that, everthing is removed!
 
Old 03-16-2009, 11:41 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
Quote:
Originally Posted by tuananh87vn View Post
hello, I'm using debian 5 and I'm trying to configure the dns server for my machine.

I've already set static IP for my machine then tried to set up the dns server. But either i tried by GUI or by command-line all the ips of dns server disappeared each time i reboot the system

can anybody tell me how to fix the dns server for my machine using command-line?

I tried with the file /etc/resolv.conf but it just works before i reboot. after that, everthing is removed!
Assuming you're using dhcp, edit the /etc/dhcp3/dhclient.conf file.
Add the line:
Code:
prepend domain-name-servers dns-server1,dns-server2;
where you replace dns-server1 and 2 by the ip number of the dns servers you want to use. My ISP would override anything I put in resolv.conf or /etc/network/interfaces but it can't override the prepend statement in dhclient.conf. heh heh heh.
cheers,
jdk
 
Old 03-16-2009, 12:21 PM   #3
tuananh87vn
LQ Newbie
 
Registered: Mar 2009
Posts: 19

Original Poster
Rep: Reputation: 0
thanks, but if dhcp is not used, I set static IP instead. It doesn't seem to work =.=
 
Old 04-09-2009, 07:04 AM   #4
tuananh87vn
LQ Newbie
 
Registered: Mar 2009
Posts: 19

Original Poster
Rep: Reputation: 0
guys,
why in some debian machines, the dns server is set static, which will not change each time I reboot the machine. the /etc/resolve.conf has nothing but the nameserver defined

but in my debian machine, dns servers are lost each time of rebooting. i notice there's comment like "DON'T EDIT THIS FILE BY HAND... WILL BE OVERWRITTEN" in /etc/resolve.conf => is it something like dns setting is still automatic, not manual?

what's fucked up with my machine? I'm fed up with having to re-configure the dns server each time turn on the machine in order to have internet connection.

Give me hands, plz!!!

thanks!

Last edited by tuananh87vn; 04-09-2009 at 07:06 AM.
 
Old 04-09-2009, 11:05 AM   #5
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 329Reputation: 329Reputation: 329Reputation: 329
Sounds like you are still running dhcp.

Please post the contents of /etc/network/interfaces
 
Old 04-09-2009, 12:15 PM   #6
tuananh87vn
LQ Newbie
 
Registered: Mar 2009
Posts: 19

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by norobro View Post
Sounds like you are still running dhcp.

Please post the contents of /etc/network/interfaces
here we go
Quote:
# 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

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.111
netmask 255.255.255.0
gateway 192.168.1.1

auto eth0
I guess I've already made it static

Last edited by tuananh87vn; 04-09-2009 at 12:17 PM.
 
Old 04-09-2009, 03:29 PM   #7
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 329Reputation: 329Reputation: 329Reputation: 329
I know that dhclient-script overwrites resolv.conf each time that it is run. Thought maybe you still had a dhcp statement in your "interfaces" file.

My "interfaces" file is essentially the same as yours except that "auto eth0" comes before the static configuration statements. I don't know if that makes a difference.
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

auto lo eth0
iface lo inet loopback

mapping eth0
	script grep
	map eth0

allow-hotplug eth0

iface eth0 inet static
address 192.168.2.2
netmask 255.255.255.0
gateway 192.168.2.1
broadcast 192.168.2.255
 
Old 04-09-2009, 04:59 PM   #8
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,243
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
I don't think you need both auto eth0 and allow-hot-plug eth0 that's redundant imho..
Other than that, nothing jumps out at me..

I commented out allow-hotplug eth0 and replaced it with auto eth0 so without question the interface always comes up.
I would use allow-hotplug if I had a PCMCIA or USB network interface that may or may not be present.
I can't say that is what is causing your issue though, since it does appear to be configured as a static IP


Quote:
Lines beginning with the word "auto" are used to identify the physical interfaces to be brought up when ifup is run with the -a option.

Lines beginning with "allow-" are used to identify interfaces that should be brought up automatically by various subsytems.
 
Old 04-10-2009, 05:01 AM   #9
tuananh87vn
LQ Newbie
 
Registered: Mar 2009
Posts: 19

Original Poster
Rep: Reputation: 0
awww, i comment out both allow-hot-plug and auto eth0 yet another auto eth0 appears right when I restart the network... thing still doesn't work =.=
 
Old 04-10-2009, 09:24 AM   #10
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,243
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
appears ? you mean the interfaces file is being altered automatically ?

is network-manager installed ? if so rip out that piece of junk.. it's probably fighting you, and making changes willy nilly to your network configs.

aptitude purge network-manager

then see what happens.
 
Old 04-10-2009, 10:24 AM   #11
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
I thought this problem (random DHCP client problems) was solved years ago, but maybe its making a comeback? It used to be (by used to be I'm talking about Debian Woody and Sarge, v3.0 and v3.1) that if you ever used DHCP to get addresses, DHCP client would still run, even after you set the machine to use static addresses. You have at least a DHCP client installed to have received a DHCP address. Try removing that with apt-get/aptitude/dpkg or whatever you use to install/uninstall packages. I believe the current DHCP client package is dhcp3-client, which is what I'm suggesting you remove. See what you have installed with the command:

Code:
dpkg --list |grep dhcp
Peace,
JimBass
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to config suse10 for DNS and Mail Server finding-suse Linux - General 5 03-21-2006 02:18 AM
RHEL 3 - DNS Server Config - Help Required krishvij Linux - Newbie 3 02-27-2005 11:36 PM
dns config server could be reach butchick Linux - Newbie 4 04-17-2004 12:50 AM
DNS Zone file config for mail server viniosity Linux - Software 4 09-16-2003 04:59 PM
Newbie Here . . . Having Problems with Apache Server Config and DNS. flem26 Linux - Newbie 6 03-08-2003 08:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration