Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
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.
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.
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.
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.
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:
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?
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.