LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   [SOLVED] How to create a caching dns server in centos (https://www.linuxquestions.org/questions/linux-server-73/%5Bsolved%5D-how-to-create-a-caching-dns-server-in-centos-4175443873/)

LeoPap 01-07-2013 10:50 AM

Quote:

Originally Posted by unSpawn (Post 4864716)
Sorry for barging in this late in the thread.


I'd like to point out that AFAIK cached information won't survive a restart of Dnsmasq or the machine it runs on. Pdnsd OTOH does have persistent caching.

I believe that Pdnsd is too hard to configure! Dnsmasq is much easier and the most important TobiSGD has experience on it!

Any idea about my problem?

unSpawn 01-07-2013 11:25 AM

Quote:

Originally Posted by LeoPap (Post 4864720)
I believe that Pdnsd is too hard to configure!

Heh, I won't argue with those that accept as true that which is not based on anything.


Quote:

Originally Posted by LeoPap (Post 4864720)
Any idea about my problem?

If you have problems on your non-Linux PC when changing DNS servers then it makes sense to check the log files and run diagnostics (CMD.EXE tools like ipconfig, netsh and nslookup instead of ping) on that machine.

TobiSGD 01-07-2013 02:28 PM

Quote:

Originally Posted by unSpawn (Post 4864716)
I'd like to point out that AFAIK cached information won't survive a restart of Dnsmasq or the machine it runs on. Pdnsd OTOH does have persistent caching.

You are right, I didn't think about that, since I run the caching servers on a machine that runs 24/7 anyways.
I don't know much about Pdnsd, but after a short look at the documentation it seems to be not really difficult to setup and it may be much better for the OP's purpose than dnsmasq.

LeoPap 01-07-2013 02:56 PM

The server i have install the caching server is 24x7 open, so there is not any problem.
Tobi can you help me with my last problem?

Why my Windows pc, doesn't accept as DNS the ip of the caching dns server?

TobiSGD 01-07-2013 03:10 PM

If you have the config file like mine (except of course the interface-name) it should work, if you have your Windows system configured correctly (I use manual configuration on Windows, no DHCP).

LeoPap 01-07-2013 03:53 PM

The configuration of my windows pc is:

Ip 192.168.1.9
Subnet: 255.255.255.0
Gateway: 192.168.1.1

And when i use for dns the ip of the caching server ( 192.168.1.200 ) I don't have Internet connection on the windows pc.
Although the caching pc, is having Internet connection.

May I ask which Centos version you have? I have heard that 5.8 is more stable than the 6.3 I have.

Also I am using your configurations files.

Leo

TobiSGD 01-07-2013 04:34 PM

I am using Debian for this, not CentOS. I somehow don't like RPM distros.
But this shouldn't change anything for the configuration.
May it be possible that you have an active firewall on the server that prevents your Windows machine from connecting to the server?

LeoPap 01-07-2013 04:44 PM

On the Centos I have the ip tables active. Should I have to open port 53 on iptables?

I am thinking of re-setup the server with Centos 5.8, but I can't find anywhere the minimal version.

sleddog 01-07-2013 04:45 PM

Quote:

Originally Posted by LeoPap (Post 4864907)
And when i use for dns the ip of the caching server ( 192.168.1.200 ) I don't have Internet connection on the windows pc.

According to your previous post, you have dnsmasq listen on the local (loopback) interface:

listen-address=127.0.0.1

This means that only the server itself can connect to it.

You need to change that config to:

listen-address=192.168.1.200

Then other machines on the LAN can connect to it.

You'll also need to change the resolv.conf on the caching server to:

nameserver 192.168.1.200

LeoPap 01-07-2013 04:54 PM

And what about dns on caching server? Right now I have 127.0.0.1. Should I change it?
You can check my configuration files on post #11 on the previous page of this thread ( my configuration is the same as tobi's)

sleddog 01-07-2013 05:01 PM

Quote:

Originally Posted by LeoPap (Post 4864946)
And what about dns on caching server? Right now I have 127.0.0.1. Should I change it?
You can check my configuration files on post #11 on the previous page of this thread ( my configuration is the same as tobi's)

Yes. On the caching server edit /etc/resolv.conf to:

nameserver 192.168.1.200

Don't forget to restart dnsmasq after changing the config.

LeoPap 01-07-2013 05:09 PM

Should I change the dns from the system-config-network command as well?

So you are saying that I must change the 127.0.0.1 with 192.168.1.200, on the caching server and on the configuration files right?

Note: the caching server has ip 192.168.1.200

TobiSGD 01-07-2013 05:14 PM

Quote:

Originally Posted by sleddog (Post 4864940)
According to your previous post, you have dnsmasq listen on the local (loopback) interface:

listen-address=127.0.0.1

This means that only the server itself can connect to it.

You need to change that config to:

listen-address=192.168.1.200

Then other machines on the LAN can connect to it.

You'll also need to change the resolv.conf on the caching server to:

nameserver 192.168.1.200

127.0.0.1 is OK, as long as you also use the interface option.
It is also OK to use 127.0.0.1 in the resolv.conf file, works fine here.

Quote:

Originally Posted by LeoPap
On the Centos I have the ip tables active. Should I have to open port 53 on iptables?

Of course, if you want to connect with other machines on that port the port must be open.

sleddog 01-07-2013 05:15 PM

Just use a text editor. Edit the /etc/dnsmasq.conf file and set:

listen-address=192.168.1.200

And then restart dnsmasq.

Then edit /etc/resolv.conf and set:

nameserver 192.168.1.200

That's all. Test using 'dig' on the server and try to browse on a Windows machine.

LeoPap 01-07-2013 05:25 PM

Maybe I didn't explain well the configuration of my network.

I have a caching Linux pc with ip 192.168.1.200, gateway 182.168.1.1 and dns 127.0.0.1
When I ping and use the dig command from the Linux pc, I get valid results.

Now I want all the windows pc's, to has as dns the caching server in order to increase the browsing speed.

The problem is that when I change the dns of the windows pc, and I enter the ip of the caching server (192.168.1.200) then I don't have Internet connection.

I will try to open the port 53 on iptables. Then I will try replacing 127.0.0.1 with 192.168.1.200 on the caching server.

Thank you guys for your help so far!! I will post the results tomorrow!


All times are GMT -5. The time now is 07:09 AM.