DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2009-01-11 12:06:36

kaiyoti
New member
Registered: 2009-01-11
Posts: 3

dnsmasq hosts file not being read?

Has anyone got dnsmasq to work with etc/hosts?

I have a few XP workstations with their dns set to to NAS's DNS Server... in my ffp/etc/hosts file i have

Code:

209.85.171.100 agoogleserver

I restart by

Code:

sh /ffp/etc/dnsmasq.sh restart

On my XP machines I do a flushdns and registerdns, and technically if I try to access agoogleserver in my browser, it should be able to reach google as if I were to just type in 209.85.171.100 in my browser? Well that didn't work.

So I dug around and thought maybe the hosts file path might be different for the dns323...
in my /ffp/etc/dnsmasq.conf I added

Code:

no-hosts
addn-hosts=/ffp/etc/myhosts

using the same config in myhosts:

Code:

209.85.171.100 agoogleserver

Restarted... flushed, registered

Still not working. Am I doing something wrong here? I know the dnsmasq.conf is being used because if I add:

Code:

address=/someweirdnonexistentpage.com/209.85.171.100

That'll take me to google when I type in someweirdnonexistentpage.com into my browser.

Any help would be appreciated.

Thanks.

Last edited by kaiyoti (2009-01-11 12:11:06)

Offline

 

#2 2009-01-11 16:19:01

silversurfer
Member
Registered: 2008-07-20
Posts: 95

Re: dnsmasq hosts file not being read?

I think that the problem with the hosts file is caused by the missing domain part.

Try putting:

Code:

209.85.171.100 agoogleserver.com

into your hosts file and see what happens when you access agoogleserver.com. This should work.
There is no host name without a domain part in the Domain Name System.

There should be a way to supply only short names in the hosts file but you need to configure dnsmasq to expand these to the full name automatically using a preconfigured domain.

By the way you don't need to use your browser to check name lookup in Windows. An easier way to do it is using the command "nslookup". Once started it will tell you which name server it is using and which address this name server has. In the command prompt of nslookup you can type in a name and it will tell you the corresponding address if it finds one.
You can change the name server used by nslookup by typing "server <ip address>".

Offline

 

#3 2009-01-12 00:16:34

kaiyoti
New member
Registered: 2009-01-11
Posts: 3

Re: dnsmasq hosts file not being read?

Yah I used this before

Code:

expand-hosts

I'll give your suggestions a go.

Thanks for that nslookup tip, much easier. smile

Edit... Still not working, just says "non-existent domain"

if I add

Code:

address=/agoogleserver/209.85.171.100

into my dnsmasq.conf and nslookup agoogleserver, it'll work just fine.

Is there anyway of getting a verbose status from dnsmasq to see all the hosts forwarded? Or some sort of status showing what hosts file it's reading from?

Last edited by kaiyoti (2009-01-12 00:30:46)

Offline

 

#4 2009-01-12 01:56:05

silversurfer
Member
Registered: 2008-07-20
Posts: 95

Re: dnsmasq hosts file not being read?

You should probably take a look into the manpages of dnsmasq - here for example.

I'm using dnsmasq on my server, not the NAS, so I can only look there. On my server dnsmasq uses syslog and logs to "/var/log/daemon.log" and I can see entries there telling me which nameserver it is using and how many entries it reads from "/etc/hosts" when starting. That's good for checking if it read the correct hosts file.

For testing I enabled an option in the dnsmasq.conf called "log-queries" which provides some output when a DNS query is made.
For example it tells me if the query was forwarded to another DNS server and which one it is. If it is a local entry then it says that it looked into "/etc/hosts" and got the address from there.

By the way the option "address=/<domain>/<ip address>" is just another way to specify fixed addresses. If you really can't get the hosts method to work I would stick to this option if I was you.

Offline

 

#5 2009-01-12 04:10:01

kaiyoti
New member
Registered: 2009-01-11
Posts: 3

Re: dnsmasq hosts file not being read?

Cool, I try that out.

Thanks

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB