Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Author Topic: Getting DNS Address in Linux  (Read 5844 times)

tonyappuk

  • Reg Member
  • ***
  • Posts: 589
Getting DNS Address in Linux
« on: July 10, 2011, 06:05:32 PM »

Since we seem to have quite a number of Linux users on the Forum now I wonder if anyone can answer a question. Where does a Linux installation, live or hard disc, find it's DNS address? I ask because usually any modern distro will find the Internet without any help but just recently my installed Mint 10 and Debian 6 need help. If I add nameservers=required DNS url in /etc/resolv.conf they both find the net but the fix is not permanent. Also prior to this state of affairs most live CDs found the net although not all, Knoppix never did, now I don't think any do. I'm pretty certain this started after a mains problem in my rural area that upset my Speedtouch 546 router. My investigations and tweaks eventually restored Windows XP but not Linux.

My investigations show that my router preferred DNS is not one I recognise but Windows still works (presumably using the urls in the network, lan, properties, setup window),  hence my question - where does linux look and how? I think it must use dig but can anyone fill me in or point to an article that might inform, please?
Tony
Logged

roseway

  • Administrator
  • Senior Kitizen
  • *
  • Posts: 43562
  • Penguins CAN fly
    • DSLstats
Re: Getting DNS Address in Linux
« Reply #1 on: July 10, 2011, 06:35:40 PM »

I don't think there's a single answer to that. On Debian, the DNS addresses are listed in /etc/resolv.conf, but this file isn't intended to be edited directly. It's managed by Network Manager, and the configuration file is /etc/dhcp3/dhclient.conf (or /etc/dhcp/dhclient.conf).
Logged
  Eric

tonyappuk

  • Reg Member
  • ***
  • Posts: 589
Re: Getting DNS Address in Linux
« Reply #2 on: July 10, 2011, 06:57:24 PM »

Thanks, Eric. I'll pursue that for my Debian. It might also be the route Mint uses since its derivation via Ubuntu and Debian
Tony
Logged

geep

  • Reg Member
  • ***
  • Posts: 452
    • My ST546 Statistics
Re: Getting DNS Address in Linux
« Reply #3 on: July 10, 2011, 09:51:26 PM »

On Slackware - one of the startup scripts - /etc/rc.d/rc.inet1 - brings up the dhcpcd daemon. From the manpage:
Quote
dhcpcd is an implementation of the DHCP client specified in RFC2131 (when -r option is not specified) and RFC1541 (when -r option is specified).

It gets the host information (IP address, netmask, broadcast address, etc.) from a DHCP server and configures the network interface of the machine on which it is running. It also tries to renew the lease time according to RFC2131 or RFC1541 (obsolete).

It also creates /etc/resolv.conf on every boot - which is why your edits vanish. This is the first line of my (default) /etc/resolv.conf
Quote
# Generated by dhcpcd from eth0
# /etc/resolv.conf.head can replace this line
domain lan
nameserver 192.168.1.254
# /etc/resolv.conf.tail can replace this line

192.168.1.254 is my ST546 modem/router.

At startup I actually have a script called from /etc/rc.d/rc.local which edits my /etc/resolv.conf to use a local cacheing nameserver - dnsmasq - which runs on my PC. So my actual /etc/resolv.conf is:
Code: [Select]
# Generated by dhcpcd from eth0
# /etc/resolv.conf.head can replace this line
search lan
nameserver 127.0.0.1
nameserver 94.30.127.100
nameserver 89.145.254.78
nameserver 192.168.1.254
# /etc/resolv.conf.tail can replace this line

Then my /etc/rc.d/rc.local starts my local nameserver by
Code: [Select]
dnsmasq -o startLots of articles about this - Google for dnsmasq speedup. This is typical - http://blog.listepik.net/index.php/2010/09/27/speeding-up-dns-queries-with-dnsmasq/

Hope this helps.
Cheers,
Peter
Logged

tonyappuk

  • Reg Member
  • ***
  • Posts: 589
Re: Getting DNS Address in Linux
« Reply #4 on: July 11, 2011, 03:08:38 PM »

geep
That is also particularly useful and interesting since you use the same router. I'm still not entirely clear how if the router preferred DNS addresses are not valid (as I suspect) does Windows work and Linux doesn't. But I have more info now and I think I can see the way forward. Thanks.
Tony
Logged

roseway

  • Administrator
  • Senior Kitizen
  • *
  • Posts: 43562
  • Penguins CAN fly
    • DSLstats
Re: Getting DNS Address in Linux
« Reply #5 on: July 11, 2011, 03:17:03 PM »

I think that Windows, by default, sets the router address as its DNS address. You can do the same in Linux of course.
Logged
  Eric

geep

  • Reg Member
  • ***
  • Posts: 452
    • My ST546 Statistics
Re: Getting DNS Address in Linux
« Reply #6 on: July 11, 2011, 07:10:17 PM »

I'm not sure now how I setup the ST546. It was previously setup for using a Demon Internet account, and I know that it was a bit trial and error before I got it to work. Especially, I don't know where the ST546 got its DNS servers from - whether I entered them or whether it got them automatically. I am loathe to fiddle, as I find the ST546 web interface and documentation not at all intuitive (compared with the excellent interface of my old Netgear DG834).

I can list its servers - it uses my ISP (ADSL24/Murphx) servers - by logging in via telnet, or via the web interface Broadband Connection > Internet Services > View more...
Code: [Select]
telnet 192.168.1.254
Trying 192.168.1.254...
Connected to 192.168.1.254.
Escape character is '^]'.
Username : Administrator
Password :
------------------------------------------------------------------------

                             ______  SpeedTouch 5x6
                         ___/_____/\
                        /         /\  6.2.17.5 UK
                  _____/__       /  \
                _/       /\_____/___ \  Copyright (c) 1999-2007, THOMSON
               //       /  \       /\ \
       _______//_______/    \     / _\/______
      /      / \       \    /    / /        /\
   __/      /   \       \  /    / /        / _\__
  / /      /     \_______\/    / /        / /   /\
 /_/______/___________________/ /________/ /___/  \
 \ \      \    ___________    \ \        \ \   \  /
  \_\      \  /          /\    \ \        \ \___\/
     \      \/          /  \    \ \        \  /
      \_____/          /    \    \ \________\/
           /__________/      \    \  /
           \   _____  \      /_____\/
            \ /    /\  \    /___\/
             /____/  \  \  /
             \    \  /___\/
              \____\/

------------------------------------------------------------------------
_{Administrator}=>dns server route list

DNS Server Entries:
  DNS Server     Source              Metric  Intf     State  Domain            
D 94.30.127.100                        10    Internet  UP      *            
D 89.145.254.78                        10    Internet  UP      *            

{Administrator}=>Connection closed by foreign host.

There are also CLI commands to delete and add DNS servers - but I guess you already know that. I have never used them; only the list command shown above.

I also run Windows, both XP and Win7 as real machines, and Win2k, XP and Vista as Virtual Machines - guests on VMWare Player & VirtualBox - on my Slackware host. They've never had problems getting addresses. I usually point my Virtual Machines to use dnsmasq's cache on the host. So in Windows I override the automatic DNS server setup by specifying my host machine explicitly - 192.168.1.64. I have previously configured the ST546 to always give my PC the same address.

I leave the ST546 running 24/7, and I do notice that after some days the web interface report Home Network > Device and Home Network > Interfaces show rubbish. They don't show correctly the devices currently connected. They show long-dead virtual and real machines.

I forgot this bit - added - I can see when dhcpcd starts by looking in the log file /var/log/messages. Maybe it will show any problems. I guess all Linux have something similar.

Code: [Select]
Jul 11 17:53:15 dad kernel: [   25.953620] REISERFS (device sdb6): Using r5 hash to sort names
Jul 11 17:53:15 dad logger: /etc/rc.d/rc.inet1:  /sbin/ifconfig lo 127.0.0.1
Jul 11 17:53:15 dad logger: /etc/rc.d/rc.inet1:  /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
Jul 11 17:53:16 dad logger: /etc/rc.d/rc.inet1:  /sbin/dhcpcd -t 10  eth0
Jul 11 17:53:16 dad dhcpcd[1786]: version 5.2.11 starting
Jul 11 17:53:16 dad kernel: [   28.007958] r8169 0000:04:00.0: eth0: link up
Jul 11 17:53:16 dad kernel: [   28.007964] r8169 0000:04:00.0: eth0: link up
Jul 11 17:53:18 dad dhcpcd[1786]: eth0: broadcasting for a lease
Jul 11 17:53:18 dad dhcpcd[1786]: eth0: offered 192.168.1.64 from 192.168.1.254
Jul 11 17:53:18 dad dhcpcd[1786]: eth0: acknowledged 192.168.1.64 from 192.168.1.254
Jul 11 17:53:18 dad dhcpcd[1786]: eth0: checking for 192.168.1.64
Jul 11 17:53:23 dad dhcpcd[1786]: eth0: leased 192.168.1.64 for 86400 seconds
Jul 11 17:53:23 dad dhcpcd[1786]: forked to background, child pid 1817
Jul 11 17:53:23 dad rpc.statd[1891]: Version 1.2.3 starting


Cheers,
Peter
« Last Edit: July 11, 2011, 07:48:03 PM by geep »
Logged

silversurfer44

  • Kitizen
  • ****
  • Posts: 4421
  • Lord Muck
    • Ben Novice Weather
Re: Getting DNS Address in Linux
« Reply #7 on: July 11, 2011, 07:25:33 PM »

On my Linux setup I always put the router ip address as the DNS server address for my connections. The only time I may change that is if the router allows my own DNS server addresses to be used and the ISP supplied address is not very good.
Logged
Colin II : It's no good being a pessimist, it wouldn't work anyway.

tonyappuk

  • Reg Member
  • ***
  • Posts: 589
Re: Getting DNS Address in Linux
« Reply #8 on: July 11, 2011, 07:42:56 PM »

I usually use my browser to inspect the Speedtouch settings but it is certainly not very user friendly. However thank you all for your input and I'll go back to my tweaking.
Tony
Logged