Tiny Core Linux

Tiny Core Extensions => TCE Q&A Forum => Topic started by: zab on June 30, 2010, 07:32:19 PM

Title: dnsmasq configuration in TCL?
Post by: zab on June 30, 2010, 07:32:19 PM
Hi guys,

I'd like to use "dnsmasq" as a DNS cache on my TCL box.
I found this pointer related to Ubuntu:
http://www.ubuntugeek.com/local-dns-cache-for-faster-browsing-on-ubuntu-machine.html

But I'm failing to find the equivalent to "/etc/dhcp3/dhclient.conf" on TCL?
Does someone already try dnsmasq?

Regards
Zab
Title: Re: dnsmasq configuration in TCL?
Post by: maro on June 30, 2010, 08:07:50 PM
I have not tried it myself, but have you read the .info file for the dnsmasq extension?
Title: Re: dnsmasq configuration in TCL?
Post by: combo3 on June 30, 2010, 08:17:09 PM
1. Install dnsmasq.tcz from the repository.

2. Then create the configuration file:

Code: [Select]
sudo cp /usr/local/etc/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
3. Edit /usr/local/etc/dnsmasq.conf to your specs.

4. Add the config file to /opt/.filetool.lst

Code: [Select]
echo "usr/local/etc/dnsmasq.conf" >> /opt./.filetool.lst
5. Run a backup
Title: Re: dnsmasq configuration in TCL?
Post by: zab on June 30, 2010, 08:34:11 PM
Thanks combo3, I already did all these steps.
But how can I ensure that now, I'm using "dnsmasq" as my primary DNS server?

In the above Ubuntu pointer, they prevent "dhcpc client" to override the "/etc/resolv.conf", and give "dnsmasq" a chance
to works (by putting "nameserver 127.0.0.1" as the first DNS server name) as the primary DNS server.
I'm unable to do that on TCL?
Title: Re: dnsmasq configuration in TCL?
Post by: ^thehatsrule^ on July 01, 2010, 02:47:02 AM
Is there a reason why you can't modify resolv.conf?
Title: Re: dnsmasq configuration in TCL?
Post by: zab on July 01, 2010, 04:58:57 AM
Quote
Is there a reason why you can't modify resolv.conf?

I was thinking that the content of "/etc/resolv.conf" was dynamic (as I'm using dhcpcd)!
Am I right?
Title: Re: dnsmasq configuration in TCL?
Post by: zab on July 01, 2010, 08:01:23 AM
I think I'm right. The content of "/etc/resolv.conf" is made by "udhcpc" (see /usr/share/udhcpc/default.script)
Title: Re: dnsmasq configuration in TCL?
Post by: curaga on July 01, 2010, 08:21:12 AM
So, you could either modify the script to always put your dns as the first one, or have a script to do so in bootlocal.sh.
Restore happens before dhcp, so if you modify the script and add to .filetool.lst, it should work fine.
Title: Re: dnsmasq configuration in TCL?
Post by: zab on July 01, 2010, 09:09:33 AM
let me try that Curaga
Title: Re: dnsmasq configuration in TCL?
Post by: zab on July 02, 2010, 08:55:45 PM
Quote
Restore happens before dhcp ... so if you modify the script and add to .filetool.lst, it should work fine.
As you said, restore happends before, so it overwrite anything (ex. from /opt/bootlocal.sh).

I decided to handle that with a one-liner script called "~.X.d/dnsmasq":
sed -i '1 i nameserver 127.0.0.1' /etc/resolv.conf

Now, trying (first DNS resolution):
$ dig yahoo.com
...
;; Query time: 34 msec


Any subsequent DNS resolution is blazingly fast:
$ dig yahoo.com
...
;; Query time: 2 msec

1000 thanks guys ;-)
Zab