LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-13-2006, 08:41 AM   #1
Luc484
Member
 
Registered: Dec 2004
Distribution: Kubuntu
Posts: 62

Rep: Reputation: 15
Setting up a dns server with djbdns


Hi. I'm trying to setup a dns server on my pc. The pc is the server of a small lan, and it is connected to a adsl modem (no router). I would like to give names to the hosts in my lan so that I can do something like:
Code:
ping hist1
instead of:
Code:
ping 192.168.0.1
I've been able to do this, but I'm not able to make the Internet connection work as well. In /etc/resolv.conf of the hosts I wrote:
Code:
nameserver 192.168.0.1
where 192.168.0.1 is the IP of my dns and dhcp server. In /etc/resolv.conf of the server I have the usual dns server I had before. The server connects correctly to the internet, but the hosts cannot.
This is my data file:
Code:
.luc4.homelinux.org:192.168.0.1:a:259200
=host1.luc4.homelinux.org:192.168.0.4:86400
=host2.luc4.homelinux.org:192.168.0.2:86400
Am I lacking something? Why do host1 and host2 can ping each other but not Internet addresses while the server can do only viceversa?
Thanks for any help.
 
Old 08-13-2006, 09:00 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Haven't used the dns you talk about (we use BIND).

On the nameserver running your DNS stuff you should add "nameserver 127.0.0.1" to /etc/resolv.conf. This will make it interrogate itself.

The other two hosts should have the IP of the above nameserver in /etc/resolv.conf.

Your DNS should do the routing to external nameservers based on its config. (In BIND one creates a hints entry so it can find external root nameservers.)

Also to just type the hostname (hist1) instead of the Fully Qualified Domain Name (FQDN) e.g. hist1.mydomain.com you should add a search statement to the /etc/resolv.conf:

search mydomain.com

This will make an FQDN out of any entry you make that isn't. So that hist1 when typed will automatically search as hist1.mydomain.com. Yahoo.com however would be an FQDN so would not append mydomain.com to the search.
 
Old 08-13-2006, 09:43 AM   #3
Luc484
Member
 
Registered: Dec 2004
Distribution: Kubuntu
Posts: 62

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jlightner
Haven't used the dns you talk about (we use BIND).

On the nameserver running your DNS stuff you should add "nameserver 127.0.0.1" to /etc/resolv.conf. This will make it interrogate itself.

The other two hosts should have the IP of the above nameserver in /etc/resolv.conf.

Your DNS should do the routing to external nameservers based on its config. (In BIND one creates a hints entry so it can find external root nameservers.)
Yes. This is what I tried already, but I was not able to create the correct line in djbdns to make it find the external dns server to access the Internet. Is there anyone who can tell me how I should add the line in /var/tinydns/root/data? I think that is the place where I'm doing something wrong.

Quote:
Originally Posted by jlightner
Also to just type the hostname (hist1) instead of the Fully Qualified Domain Name (FQDN) e.g. hist1.mydomain.com you should add a search statement to the /etc/resolv.conf:

search mydomain.com

This will make an FQDN out of any entry you make that isn't. So that hist1 when typed will automatically search as hist1.mydomain.com. Yahoo.com however would be an FQDN so would not append mydomain.com to the search.
Yes. Thanks.

Last edited by Luc484; 08-13-2006 at 09:44 AM.
 
Old 08-13-2006, 02:01 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I don't see where you have an external nameserver defined anywhere (either in your data file or your /etc/resolv.conf). You can always just add the external nameserver (presumably your ISP's nameserver) to /etc/resolv.conf. Just add it below the entry for your own DNS server. Anything not resolved by yours will fall through to the ISP's. The downside here is you have to do that on all 3 hosts.
 
Old 08-13-2006, 02:36 PM   #5
Luc484
Member
 
Registered: Dec 2004
Distribution: Kubuntu
Posts: 62

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jlightner
I don't see where you have an external nameserver defined anywhere (either in your data file or your /etc/resolv.conf). You can always just add the external nameserver (presumably your ISP's nameserver) to /etc/resolv.conf. Just add it below the entry for your own DNS server. Anything not resolved by yours will fall through to the ISP's. The downside here is you have to do that on all 3 hosts.
Ok, so I left everything as it was, and modified /etc/resolv.conf on the server like this:

Code:
nameserver 127.0.0.1
nameserver 80.20.6.36
nameserver 212.216.112.112
where the last two IPs are my ISP's nameservers. /etc/resolv.conf on the other hosts are:

Code:
nameserver 192.168.0.1
nameserver 80.20.6.36
Now it seems to work but there is something strange though. Everything seem slow. This is the result of the ping on one of the hosts:

Code:
pluca luca # ping www.google.it
PING www.l.google.com (66.249.93.99) 56(84) bytes of data.
64 bytes from 66.249.93.99: icmp_seq=1 ttl=239 time=414 ms
64 bytes from 66.249.93.99: icmp_seq=2 ttl=239 time=179 ms
64 bytes from 66.249.93.99: icmp_seq=3 ttl=239 time=332 ms
64 bytes from 66.249.93.99: icmp_seq=4 ttl=239 time=138 ms
64 bytes from 66.249.93.99: icmp_seq=5 ttl=239 time=81.7 ms
64 bytes from 66.249.93.99: icmp_seq=6 ttl=239 time=71.4 ms

--- www.l.google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 26919ms
rtt min/avg/max/mdev = 71.474/202.794/414.245/127.867 ms
The rtt seems ok, but look at the complete time. It is very slow. Far slower than before. The same happens when pinging hosts inside the lan using their names like host1. Any idea why?

Last edited by Luc484; 08-13-2006 at 02:39 PM.
 
Old 08-13-2006, 02:52 PM   #6
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Is it slower when you ping by name than when you ping by IP?

If so then the issue is likely one of the nameservers timing out so that its falling through to the other.

If not then it is likely a network config issue. Most common I've seen is having your NICs set to autonegotiate on 10/100 networks. You should set them to 100 Full Duplex and turn off autonegotiate. (I'm assuming your DSL does 100/Full). autonegotiate just doesn't work well for 10/100 - it has to be used for 1000 as there is no way to turn it off at that speed.
 
Old 08-13-2006, 03:22 PM   #7
Luc484
Member
 
Registered: Dec 2004
Distribution: Kubuntu
Posts: 62

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jlightner
Is it slower when you ping by name than when you ping by IP?

If so then the issue is likely one of the nameservers timing out so that its falling through to the other.
Yes, it is slower when I ping by name. And how can I fix this? It is happening with both pinging inside my lan and outside it only by name. Maybe there is a way to set a smaller time out?
Thanks again for your help.
 
Old 08-13-2006, 08:13 PM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You can add:

options timeout:3

To /etc/resolv.conf. (Haven't done this but recall a coworker setting it once so syntax may not be exact - got it from the man page for resolv.conf [man resolv.conf]. Sets timeout to 3 seconds. I think the default is 5 seconds.

It might help to reverse order of your nameservers in resolv.conf.
 
Old 08-14-2006, 04:10 AM   #9
Luc484
Member
 
Registered: Dec 2004
Distribution: Kubuntu
Posts: 62

Original Poster
Rep: Reputation: 15
Thanks. Seems better with that option set to 1. If I try to reverse, putting my ISP's nameserver first, I ping Internet but not inside my lan. The response is unknown host.
 
Old 08-15-2006, 12:25 PM   #10
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Glad it helped.

You definitely want your internal first. The external probably has a hints to the root name servers in the world. None of them will know your domain unless you've registered it at a Registrar so would come back as invalid.
 
  


Reply



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
djbDNS - dns server unkn0wn Linux - Networking 0 04-08-2006 02:36 AM
What can djbdns, (or any DNS Server/cacher) do for me? Gsee *BSD 32 01-05-2005 07:42 AM
Setting up djbdns on Slackware 9.1 (2.6.7) thekore Slackware 1 07-07-2004 01:23 PM
Setting up a DNS server fastnet Linux - Networking 2 03-18-2004 05:03 AM
dns: bind/djbdns koningshoed Linux - Security 8 08-09-2002 12:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:59 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
Open Source Consulting | Domain Registration