LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   config dns server (https://www.linuxquestions.org/questions/debian-26/config-dns-server-711981/)

tuananh87vn 03-16-2009 10:12 AM

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!

jdkaye 03-16-2009 10:41 AM

Quote:

Originally Posted by tuananh87vn (Post 3477123)
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.:D
cheers,
jdk

tuananh87vn 03-16-2009 11:21 AM

thanks, but if dhcp is not used, I set static IP instead. It doesn't seem to work =.=

tuananh87vn 04-09-2009 06:04 AM

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!

norobro 04-09-2009 10:05 AM

Sounds like you are still running dhcp.

Please post the contents of /etc/network/interfaces

tuananh87vn 04-09-2009 11:15 AM

Quote:

Originally Posted by norobro (Post 3503614)
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

norobro 04-09-2009 02:29 PM

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


farslayer 04-09-2009 03:59 PM

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.

tuananh87vn 04-10-2009 04:01 AM

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 =.=

farslayer 04-10-2009 08:24 AM

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.

JimBass 04-10-2009 09:24 AM

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


All times are GMT -5. The time now is 02:30 AM.