WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: dnsmasq configuration in TCL?  (Read 3902 times)

Offline zab

  • Jr. Member
  • **
  • Posts: 51
dnsmasq configuration in TCL?
« on: June 30, 2010, 04: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

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: dnsmasq configuration in TCL?
« Reply #1 on: June 30, 2010, 05:07:50 PM »
I have not tried it myself, but have you read the .info file for the dnsmasq extension?

Offline combo3

  • Full Member
  • ***
  • Posts: 148
Re: dnsmasq configuration in TCL?
« Reply #2 on: June 30, 2010, 05: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

Offline zab

  • Jr. Member
  • **
  • Posts: 51
Re: dnsmasq configuration in TCL?
« Reply #3 on: June 30, 2010, 05: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?

Offline ^thehatsrule^

  • Administrator
  • Hero Member
  • *****
  • Posts: 1726
Re: dnsmasq configuration in TCL?
« Reply #4 on: June 30, 2010, 11:47:02 PM »
Is there a reason why you can't modify resolv.conf?

Offline zab

  • Jr. Member
  • **
  • Posts: 51
Re: dnsmasq configuration in TCL?
« Reply #5 on: July 01, 2010, 01: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?

Offline zab

  • Jr. Member
  • **
  • Posts: 51
Re: dnsmasq configuration in TCL?
« Reply #6 on: July 01, 2010, 05:01:23 AM »
I think I'm right. The content of "/etc/resolv.conf" is made by "udhcpc" (see /usr/share/udhcpc/default.script)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: dnsmasq configuration in TCL?
« Reply #7 on: July 01, 2010, 05: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.
The only barriers that can stop you are the ones you create yourself.

Offline zab

  • Jr. Member
  • **
  • Posts: 51
Re: dnsmasq configuration in TCL?
« Reply #8 on: July 01, 2010, 06:09:33 AM »
let me try that Curaga

Offline zab

  • Jr. Member
  • **
  • Posts: 51
Re: dnsmasq configuration in TCL?
« Reply #9 on: July 02, 2010, 05: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