TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Linux & Opensource > Mandriva Linux

Notices

Internal DNS resolution look up fails

Mandriva Linux


Reply
 
Thread Tools Display Modes
Old 09-01-2008, 04:26 AM   #1
Bit Twister
Guest
 
Posts: n/a
Internal DNS resolution look up fails

First time DNS newbie here. After 11 hours of howto/documents/template
reading and attempts, I still can not resolve my node's name or ip.

$ hostname
wb.home.invalid

$ host wb.home.invalid
Host wb.home.invalid not found: 2(SERVFAIL)

$ host 192.168.1.130
Host 130.1.168.192.in-addr.arpa not found: 2(SERVFAIL)

Does that mean I have to create separate files for each ip on my LAN?
I thought my zone "1.168.192.in-addr.arpa" would keep me out of that
ditch. :-(



Clean install of bind on Mandriva Linux 2008

$ named -v
BIND 9.4.1-P1


$ grep hosts: /etc/nsswitch.conf
hosts: files dns nis

$ grep nameserver /etc/resolv.conf
nameserver 192.168.1.130

$ head -5 /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.11 fw.home.invalid fw
192.168.1.12 wb1.home.invalid wb1
192.168.1.130 wb.home.invalid wb
192.168.1.131 beta.home.invalid beta



Snippet from named.conf


zone "home.invalid" IN {
type master;
file "reverse/home.zone";
allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
type master;
file "reverse/home.reversed";
allow-update { none; };
};



$ cat /var/lib/named/var/named/reverse/home.zone
$ORIGIN .
$TTL 86400 ; 1 day
home.invalid IN SOA wb.home.invalid. (
1997022700 ; serial
86400 ; refresh (1 day)
21600 ; retry (6 hours)
3600000 ; expire (5 weeks 6 days 16 hours)
3600 ; minimum (1 hour)
)
NS wb.home.invalid.
$ORIGIN home.invalid.
$TTL 86400 ; 1 day

localhost A 127.0.0.1
fw A 192.168.1.11
wb1 A 192.168.1.12
wb A 192.168.1.130
beta A 192.168.1.131


$ cat /var/lib/named/var/named/reverse/home.reversed
$ORIGIN .
$TTL 86400 ; 1 day
1.168.192.in-addr.arpa IN SOA wb.home.invalid. (
1997022700 ; serial
28800 ; refresh (8 hours)
14400 ; retry (4 hours)
3600000 ; expire (5 weeks 6 days 16 hours)
86400 ; minimum (1 day)
)
NS wb.home.invalid.
$ORIGIN 1.168.192.in-addr.arpa.
$TTL 3600 ; 1 hour

11 PTR fw.home.invalid.
12 PTR wb1.home.invalid.
130 PTR wb.home.invalid.
131 PTR beta.home.invalid.
  Reply With Quote
Old 09-01-2008, 04:26 AM   #2
David W. Hodgins
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On Mon, 31 Dec 2007 12:59:56 -0500, Bit Twister <BitTwister@mouse-potato.com> wrote:

> First time DNS newbie here. After 11 hours of howto/documents/template
> reading and attempts, I still can not resolve my node's name or ip.


For simplicity's sake, change the following files in /etc to symlinks to
the same file in /var/lib/named/etc

$ ll /etc|grep /var
lrwxrwxrwx 1 root root 24 2007-11-30 15:51 hosts -> /var/lib/named/etc/hosts
lrwxrwxrwx 1 root root 31 2007-11-30 15:51 named.conf -> ../var/lib/named/etc/named.conf
lrwxrwxrwx 1 root root 30 2007-11-30 15:51 rndc.conf -> ../var/lib/named/etc/rndc.conf
lrwxrwxrwx 1 root root 29 2007-11-30 15:51 rndc.key -> ../var/lib/named/etc/rndc.key

> $ host wb.home.invalid
> Host wb.home.invalid not found: 2(SERVFAIL)


Note that the host command will ignore the /etc/hosts file, so the name must be
resolved via dns.

> $ grep nameserver /etc/resolv.conf
> nameserver 192.168.1.130


Catch-22, I think. 192.168.1.130 cannot yet be resolved (by dns). Try changing the nameserver
line to 127.0.0.1.

I'm not running a network, so my situation is quite different. The host and dig
commands will use my local nameserver, to resolve hodgins.homeip.net, to 127.0.0.1,
while dig +trace will go through the root servers, to get the dynamic ip.

Use dig (without +trace), to see which nameserver is responding.

$ grep hodgins /var/lib/named/etc/*
/var/lib/named/etc/adblock.conf:zone "hodgins.homeip.net" { type master; notify no; file "/etc/db.adblock"; };
/var/lib/named/etc/hosts:127.0.0.1 hodgins.homeip.net hodgins localhost localhost.localdomain

$ head -7 /var/lib/named/etc/adblock.conf
zone "hodgins.homeip.net" { type master; notify no; file "/etc/db.adblock"; };
zone "ads.ak.facebook.com" { type master; notify no; file "/etc/db.adblock"; };

// This list from
// last updated: 2007-06-12 21:24:25

zone "007arcadegames.com" { type master; notify no; file "/etc/db.adblock"; };

$ cat /var/lib/named/etc/db.adblock
$TTL 604800
@ IN SOA localhost. root.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
@ IN A 127.0.0.1 ;localhost
* IN A 127.0.0.1 ;localhost

Regards, Dave Hodgins

--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
  Reply With Quote
Old 09-01-2008, 04:27 AM   #3
Tony van der Hoff
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On 31 Dec at 17:59 Bit Twister <BitTwister@mouse-potato.com> wrote in
message <slrnfnibgr.ore.BitTwister@wb.home.invalid>

> First time DNS newbie here. After 11 hours of howto/documents/template
> reading and attempts, I still can not resolve my node's name or ip.
>

Well, I'm no expert, but I've been there, done that, and got it working
I can't really remember the details, but maybe a comparison with my files
will help you on your way.

> $ hostname wb.home.invalid
>

$hostname tony-lx.magpeway.net

> $ host wb.home.invalid Host wb.home.invalid not found: 2(SERVFAIL)
>

[tony@tony-lx ~]$ host tony-lx
tony-lx.magpieway.net is an alias for ns.magpieway.net.
ns.magpieway.net has address 192.168.10.7
tony-lx.magpieway.net is an alias for ns.magpieway.net.
tony-lx.magpieway.net is an alias for ns.magpieway.net.
ns.magpieway.net mail is handled by 10 mail.magpieway.net.

> $ host 192.168.1.130 Host 130.1.168.192.in-addr.arpa not found:
> 2(SERVFAIL)
>

[tony@tony-lx ~]$ host 192.168.10.7
7.10.168.192.in-addr.arpa domain name pointer tony-lx.magpieway.net.
7.10.168.192.in-addr.arpa domain name pointer .

> Does that mean I have to create separate files for each ip on my LAN? I
> thought my zone "1.168.192.in-addr.arpa" would keep me out of that
> ditch. :-(
>

Indeed; that's what it does
>
>
> Clean install of bind on Mandriva Linux 2008

Still on 2007.0 here...
>
> $ named -v BIND 9.4.1-P1
>

[tony@tony-lx ~]$ sudo named -v
BIND 9.3.2

>
> $ grep hosts: /etc/nsswitch.conf hosts: files dns nis
>

[tony@tony-lx ~]$ grep hosts: /etc/nsswitch.conf
hosts: files nis dns

> $ grep nameserver /etc/resolv.conf nameserver 192.168.1.130
>

[tony@tony-lx ~]$ grep nameserver /etc/resolv.conf
nameserver 127.0.0.1

> $ head -5 /etc/hosts 127.0.0.1 localhost.localdomain
> localhost 192.168.1.11 fw.home.invalid fw 192.168.1.12
> wb1.home.invalid wb1 192.168.1.130 wb.home.invalid wb
> 192.168.1.131 beta.home.invalid beta
>
>
>
> Snippet from named.conf
>
>
> zone "home.invalid" IN { type master; file "reverse/home.zone";
> allow-update { none; }; };
>
> zone "1.168.192.in-addr.arpa" IN { type master; file
> "reverse/home.reversed"; allow-update { none; }; };
>


zone "magpieway.net" {
type master;
notify no;
allow-transfer { localhost; };
file "zone/magpieway.net";
};

zone "10.168.192.in-addr.arpa" {
type master;
file "reverse/192.168.10";
};


>
>
> $ cat /var/lib/named/var/named/reverse/home.zone $ORIGIN . $TTL 86400
> ; 1 day home.invalid IN SOA wb.home.invalid. (
> 1997022700 ; serial
> 86400 ; refresh (1 day)
> 21600 ; retry (6 hours)
> 3600000 ; expire (5 weeks 6 days 16

hours)
> 3600 ; minimum (1 hour)
> )
> NS wb.home.invalid.
> $ORIGIN home.invalid. $TTL 86400 ; 1 day
>
> localhost A 127.0.0.1 fw A
> 192.168.1.11 wb1 A 192.168.1.12 wb A
> 192.168.1.130 beta A 192.168.1.131
>

;
; Zone file for magpieway.net
;
; The full zone file
;
$TTL 3D
@ IN SOA ns.magpieway.net. hostmaster.magpieway.net. (
200602211 ; serial, todays date + todays
serial #
8H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
TXT "Magpieway.Net, your DNS consultants"
NS ns ; Inet Address of name server
MX 10 mail.magpieway.net. ; Primary Mail Exchanger
;
localhost A 127.0.0.1
router A 192.168.10.254
TXT "The router"
;
ns A 192.168.10.7
MX 10 mail
www CNAME ns
tony-lx CNAME ns
mail CNAME ns
;
tony-lt A 192.168.10.9
MX 10 mail
TXT "Laptop"
;
tony-lw A 192.168.10.10
MX 10 mail
TXT "Wireless Laptop"
;
ws064 A 192.168.10.64
MX 10 mail
ws064.ltsp CNAME ws064
;
ws065 A 192.168.10.65
MX 10 mail
ws065.ltsp CNAME ws065
;
ws066 A 192.168.10.66
MX 10 mail
ws066.ltsp CNAME ws066
;
ws067 A 192.168.10.67
MX 10 mail
ws067.ltsp CNAME ws067
;
ws068 A 192.168.10.68
MX 10 mail
ws068.ltsp CNAME ws068


>
> $ cat /var/lib/named/var/named/reverse/home.reversed $ORIGIN . $TTL 86400
> ; 1 day 1.168.192.in-addr.arpa IN SOA wb.home.invalid. (
> 1997022700 ; serial
> 28800 ; refresh (8 hours)
> 14400 ; retry (4 hours)
> 3600000 ; expire (5 weeks 6 days 16

hours)
> 86400 ; minimum (1 day)
> )
> NS wb.home.invalid.
> $ORIGIN 1.168.192.in-addr.arpa. $TTL 3600 ; 1 hour
>
> 11 PTR fw.home.invalid. 12 PTR
> wb1.home.invalid. 130 PTR wb.home.invalid. 131
> PTR beta.home.invalid.
>

;
; Reverse zone file for 192.168.10
;
$TTL 3D
@ IN SOA ns.magpieway.net. hostmaster.magpieway.net.
(
200602212 ; Serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D) ; Minimum TTL
NS magpieway.net.
;
; Servers
254 IN PTR router.magpieway.net.
7 IN PTR .
7 IN PTR tony-lx.magpieway.net.
;
; hosts
9 IN PTR tony-lt.magpieway.net
10 IN PTR tony-lw.magpieway.net
;
; Workstations
64 IN PTR ws064.ltsp.magpieway.net.
65 IN PTR ws065.ltsp.magpieway.net.
66 IN PTR ws066.ltsp.magpieway.net.
67 IN PTR ws067.ltsp.magpieway.net.
68 IN PTR ws068.ltsp.magpieway.net.


Hope that helps,

--
Tony van der Hoff | mailto:
Buckinghamshire, England
  Reply With Quote
Old 09-01-2008, 04:27 AM   #4
Bit Twister
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On Tue, 1 Jan 2008 13:23:11 +0000, Tony van der Hoff wrote:
> On 31 Dec at 17:59 Bit Twister <BitTwister@mouse-potato.com> wrote in
>
>> $ host 192.168.1.130 Host 130.1.168.192.in-addr.arpa not found:
>> 2(SERVFAIL)

>
>> Does that mean I have to create separate files for each ip on my LAN? I
>> thought my zone "1.168.192.in-addr.arpa" would keep me out of that
>> ditch. :-(
>>

> Indeed; that's what it does


I found out there is a way to not have to create separate zone files.
You can have just one.

See the SOLUTION post I am about to post.

  Reply With Quote
Old 09-01-2008, 04:27 AM   #5
Bit Twister
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails SOLUTION

On Mon, 31 Dec 2007 17:59:56 +0000 (UTC), Bit Twister wrote:

Instructions for Mandriva 2008.0 bind DNS server install, settings, script
follows for creating a basic local DNS server for my LAN.

Assumption is eth0 is the LAN nic with a 192.168.1.x LAN with FQDN
settings for all nodes on the LAN in /etc/hosts. Example snippet

$ head -5 /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.11 fw.home.invalid fw
192.168.1.12 wb1.home.invalid wb1
192.168.1.130 wb.home.invalid wb
192.168.1.131 beta.home.invalid beta

Warning, node names can not contain an underscore.
named failure example:
192.168.1.12 wb_1.home.invalid wb_1


Since my domain is not registered, I added .invalid to .home. This
install is on wb.home.invalid

home.zone is for forward look ups.
Example:
$ host wb.home.invalid
wb.home.invalid has address 192.168.1.130

home.reversed is used for reverse look ups.
Example:
$ host 192.168.1.130
130.1.168.192.in-addr.arpa domain name pointer wb.home.invalid.

home.reversed contains all your LAN node's alias and last octant of ip address.

Snippet follows:
$ head -13 /var/lib/named/var/named/reverse/home.reversed
$TTL 86400 ; 1 day
1.168.192.in-addr.arpa. IN SOA ns1.wb.home.invalid. wb.home.invalid. (
19 ; serial
8H ; refresh
4H ; retry
1W ; expire
1D ; minimum
)
NS wb.home.invalid.
11 IN PTR fw.home.invalid.
12 IN PTR wb1.home.invalid.
130 IN PTR wb.home.invalid.
131 IN PTR beta.home.invalid.




#************************************************* *************
#*
#* bind_install.txt - steps to install/setup bind
#*
#************************************************* *************

alias edt=gedit

urpmi bind --auto

cp /var/lib/named/etc/named.conf /var/lib/named/etc/named.conf_orig
mv /var/lib/named/etc/hosts /var/lib/named/etc/hosts_orig
cp /etc/hosts /var/lib/named/etc/hosts
mv /etc/hosts /etc/hosts_bkup

ln -s /var/lib/named/etc/bogon_acl.conf /etc/bogon_acl.conf
ln -s /var/lib/named/etc/hosts /etc/hosts
ln -s /var/lib/named/etc/logging.conf /etc/logging.conf
ln -s /var/lib/named/etc/trusted_networks_acl.conf /etc/trusted_networks_acl.conf

#*************************************************
#* modify named's config to use opendns DNS servers
#* and add our zone files
#************************************************* *


edt /var/lib/named/etc/named.conf

And find forwarders and add/change these

// servers
forwarders { 208.67.222.222; 208.67.220.220; };

And append these zones to the bottom:

zone "home.invalid" IN {
type master;
file "master/home.zone";
allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
type master;
file "reverse/home.reversed";
allow-update { none; };
};

Click Save, Quit

#*************************************************
#* set eth0's DNS1 to use our node's DNS resolver
#************************************************* *

hostname --ip-address

edt /etc/sysconfig/network-scripts/ifcfg-eth0
and set
DNS1=value_from_above_hostname_command
Click Save, Quit


#*************************************************
#* set default domain name for resolvconf(8)
#************************************************* *

hostname --domain
edt /etc/resolvconf/resolv.conf.d/tail
and add
domain value_from_above_hostname_command
Click Save, Quit

#*************************************************
#* fix /etc/resolv.conf to use my node's ip address
#************************************************* *

/bin/cp /etc/resolvconf/resolv.conf.d/head /etc/resolv.conf
echo "nameserver $(hostname --ip-address)" >> /etc/resolv.conf
cat /etc/resolvconf/resolv.conf.d/tail >> /etc/resolv.conf

#*************************************************
#* generate zone files, restart named, test
#************************************************* *

/local/bin/set_home_zone

#*********** end bind_install.txt *****************************************





#!/bin/bash
#************************************************* *********************
#*
#* set_home_zone - create home.(zone/reverse) files from /etc/hosts
#*
#* Note: _out_fn names have to match zone names in /etc/named.conf
#*
#************************************************* *********************

_dom=$(hostname --domain)
_ns=$(hostname --fqdn)
set -- $(echo "$(grep $_ns /etc/hosts)")
_ns_ip=$1

_out_fn=/var/lib/named/var/named/master/home.zone

echo "\$TTL 86400 ; 1 day
${_dom}. IN SOA ns1.${_ns}. ${_ns}. (
19 ; serial
1D ; refresh
6H ; retry
1W ; expire
1H ; minimum
)
; DNS Servers
@ IN NS ns1
@ IN NS ns2

; Machine Names
@ IN A $_ns_ip
ns1 IN A $_ns_ip
ns2 IN A $_ns_ip

NS ${_ns}.
\$ORIGIN ${_dom}.
\$TTL 86400 ; 1 day" > $_out_fn
while read line
do
eval set -- $line
_ip=$1
if [ "${_ip:0:3}" = "192" ] ; then
printf "%s\t\tA\t%s\n" $3 $1 >> $_out_fn
fi
done < /etc/hosts
chmod 644 $_out_fn

_out_fn=/var/lib/named/var/named/reverse/home.reversed

echo "\$TTL 86400 ; 1 day
1.168.192.in-addr.arpa. IN SOA ns1.${_ns}. ${_ns}. (
19 ; serial
8H ; refresh
4H ; retry
1W ; expire
1D ; minimum
)
NS ${_ns}." > $_out_fn
while read line
do
eval set -- $line
_fq=$2
set -- $(IFS='.'; echo $1)
if [ "$2" = "168" ] ; then
printf "%s\tIN\tPTR\t%s.\n" $4 $_fq >> $_out_fn
fi
done < /etc/hosts
chmod 644 $_out_fn

printf "\n# service named restart\n"
service named restart
printf "\n# nslookup $(hostname --fqdn )\n"
nslookup $(hostname --fqdn)
printf "\n# nslookup $(hostname --alias)\n"
nslookup $(hostname --alias)
printf "\n# nslookup $_ns_ip\n"
nslookup $_ns_ip

#**************** end set_home_zone *****************
  Reply With Quote
Old 09-01-2008, 04:33 AM   #6
Bit Twister
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On Mon, 31 Dec 2007 15:04:06 -0500, David W. Hodgins wrote:
>> Bit Twister <BitTwister@mouse-potato.com> wrote:

>
> For simplicity's sake, change the following files in /etc to symlinks to
> the same file in /var/lib/named/etc


I had the links, line snipped to fit screen
$ ll /etc|grep /var
lrwxrwxrwx 1 root root bogon_acl.conf -> ../var/lib/named/etc/bogon_acl.conf
lrwxrwxrwx 1 root root hosts -> ../var/lib/named/etc/hosts
lrwxrwxrwx 1 root root named.conf -> ../var/lib/named/etc/named.conf
lrwxrwxrwx 1 root root rndc.conf -> ../var/lib/named/etc/rndc.conf
lrwxrwxrwx 1 root root rndc.key -> ../var/lib/named/etc/rndc.key

>
> Note that the host command will ignore the /etc/hosts file, so the
> name must be resolved via dns.


Yep, and leafnode needs bind/named to work for the same reason, which
got me into this ditch. :-(


>> $ grep nameserver /etc/resolv.conf
>> nameserver 192.168.1.130

>
> Catch-22, I think. 192.168.1.130 cannot yet be resolved (by dns).


Nope, that is why you put the name server's ip in /etc/resolv.conf

> Try changing the nameserver line to 127.0.0.1.


Did not help.


> Use dig (without +trace), to see which nameserver is responding.


Or
$ nslookup $(hostname)
Server: 192.168.1.130
Address: 192.168.1.130#53

** server can't find wb.home.invalid: SERVFAIL



Did manage to find/fix a syntax problem, but does not help.
Current configuration:


$ head -13 /var/lib/named/var/named/master/home.zone
$TTL 86400 ; 1 day
@ IN SOA home.invalid root (
19 ; serial
1D ; refresh
6H ; retry
1W ; expire
1H ; minimum
)
IN NS home.invalid
fw IN A 192.168.1.11
wb1 IN A 192.168.1.12
wb IN A 192.168.1.130
beta IN A 192.168.1.131

$ head -14 /var/lib/named/var/named/reverse/home.reversed
$TTL 86400 ; 1 day
@ IN SOA home.invalid. (
19 ; serial
8H ; refresh
4H ; retry
1W ; expire
1D ; minimum
)
IN NS wb.home.invalid.
IN PTR wb.home.invalid.
11 IN PTR fw.home.invalid.
12 IN PTR wb1.home.invalid.
130 IN PTR wb.home.invalid.
131 IN PTR beta.home.invalid.

$ grep -v // /etc/named.conf


include "/etc/rndc.key";

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { mykey; };
};

include "/etc/bogon_acl.conf";
include "/etc/trusted_networks_acl.conf";

include "/etc/logging.conf";

options {
version "";
directory "/var/named";
dump-file "/var/tmp/named_dump.db";
pid-file "/var/run/named.pid";
statistics-file "/var/tmp/named.stats";
zone-statistics yes;
coresize 100M;
auth-nxdomain yes;
query-source address * port *;
listen-on port 53 { any; };
cleaning-interval 120;
transfers-in 20;
transfers-per-ns 2;
lame-ttl 0;
max-ncache-ttl 10800;

forwarders { 208.67.222.222; 208.67.220.220; };


notify no;

transfer-format many-answers;

max-transfer-time-in 60;

interface-interval 0;


allow-recursion { trusted_networks; };

blackhole { bogon; };
};

zone "ac" { type delegation-only; };
zone "cc" { type delegation-only; };
zone "com" { type delegation-only; };
zone "cx" { type delegation-only; };
zone "lv" { type delegation-only; };
zone "museum" { type delegation-only; };
zone "net" { type delegation-only; };
zone "nu" { type delegation-only; };
zone "ph" { type delegation-only; };
zone "sh" { type delegation-only; };
zone "tm" { type delegation-only; };
zone "ws" { type delegation-only; };

zone "." IN {
type hint;
file "named.ca";
};

zone "localdomain" IN {
type master;
file "master/localdomain.zone";
allow-update { none; };
};

zone "localhost" IN {
type master;
file "master/localhost.zone";
allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
type master;
file "reverse/named.local";
allow-update { none; };
};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 .0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "reverse/named.ip6.local";
allow-update { none; };
};

zone "255.in-addr.arpa" IN {
type master;
file "reverse/named.broadcast";
allow-update { none; };
};

zone "0.in-addr.arpa" IN {
type master;
file "reverse/named.zero";
allow-update { none; };
};

zone "home.invalid" IN {
type master;
file "master/home.zone";
allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
type master;
file "reverse/home.reversed";
allow-update { none; };
};
  Reply With Quote
Old 09-01-2008, 04:34 AM   #7
Tony van der Hoff
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On 31 Dec at 17:59 Bit Twister <BitTwister@mouse-potato.com> wrote in
message <slrnfnibgr.ore.BitTwister@wb.home.invalid>

> First time DNS newbie here. After 11 hours of howto/documents/template
> reading and attempts, I still can not resolve my node's name or ip.
>

Well, I'm no expert, but I've been there, done that, and got it working
I can't really remember the details, but maybe a comparison with my files
will help you on your way.

> $ hostname wb.home.invalid
>

$hostname tony-lx.magpeway.net

> $ host wb.home.invalid Host wb.home.invalid not found: 2(SERVFAIL)
>

[tony@tony-lx ~]$ host tony-lx
tony-lx.magpieway.net is an alias for ns.magpieway.net.
ns.magpieway.net has address 192.168.10.7
tony-lx.magpieway.net is an alias for ns.magpieway.net.
tony-lx.magpieway.net is an alias for ns.magpieway.net.
ns.magpieway.net mail is handled by 10 mail.magpieway.net.

> $ host 192.168.1.130 Host 130.1.168.192.in-addr.arpa not found:
> 2(SERVFAIL)
>

[tony@tony-lx ~]$ host 192.168.10.7
7.10.168.192.in-addr.arpa domain name pointer tony-lx.magpieway.net.
7.10.168.192.in-addr.arpa domain name pointer .

> Does that mean I have to create separate files for each ip on my LAN? I
> thought my zone "1.168.192.in-addr.arpa" would keep me out of that
> ditch. :-(
>

Indeed; that's what it does
>
>
> Clean install of bind on Mandriva Linux 2008

Still on 2007.0 here...
>
> $ named -v BIND 9.4.1-P1
>

[tony@tony-lx ~]$ sudo named -v
BIND 9.3.2

>
> $ grep hosts: /etc/nsswitch.conf hosts: files dns nis
>

[tony@tony-lx ~]$ grep hosts: /etc/nsswitch.conf
hosts: files nis dns

> $ grep nameserver /etc/resolv.conf nameserver 192.168.1.130
>

[tony@tony-lx ~]$ grep nameserver /etc/resolv.conf
nameserver 127.0.0.1

> $ head -5 /etc/hosts 127.0.0.1 localhost.localdomain
> localhost 192.168.1.11 fw.home.invalid fw 192.168.1.12
> wb1.home.invalid wb1 192.168.1.130 wb.home.invalid wb
> 192.168.1.131 beta.home.invalid beta
>
>
>
> Snippet from named.conf
>
>
> zone "home.invalid" IN { type master; file "reverse/home.zone";
> allow-update { none; }; };
>
> zone "1.168.192.in-addr.arpa" IN { type master; file
> "reverse/home.reversed"; allow-update { none; }; };
>


zone "magpieway.net" {
type master;
notify no;
allow-transfer { localhost; };
file "zone/magpieway.net";
};

zone "10.168.192.in-addr.arpa" {
type master;
file "reverse/192.168.10";
};


>
>
> $ cat /var/lib/named/var/named/reverse/home.zone $ORIGIN . $TTL 86400
> ; 1 day home.invalid IN SOA wb.home.invalid. (
> 1997022700 ; serial
> 86400 ; refresh (1 day)
> 21600 ; retry (6 hours)
> 3600000 ; expire (5 weeks 6 days 16

hours)
> 3600 ; minimum (1 hour)
> )
> NS wb.home.invalid.
> $ORIGIN home.invalid. $TTL 86400 ; 1 day
>
> localhost A 127.0.0.1 fw A
> 192.168.1.11 wb1 A 192.168.1.12 wb A
> 192.168.1.130 beta A 192.168.1.131
>

;
; Zone file for magpieway.net
;
; The full zone file
;
$TTL 3D
@ IN SOA ns.magpieway.net. hostmaster.magpieway.net. (
200602211 ; serial, todays date + todays
serial #
8H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
TXT "Magpieway.Net, your DNS consultants"
NS ns ; Inet Address of name server
MX 10 mail.magpieway.net. ; Primary Mail Exchanger
;
localhost A 127.0.0.1
router A 192.168.10.254
TXT "The router"
;
ns A 192.168.10.7
MX 10 mail
www CNAME ns
tony-lx CNAME ns
mail CNAME ns
;
tony-lt A 192.168.10.9
MX 10 mail
TXT "Laptop"
;
tony-lw A 192.168.10.10
MX 10 mail
TXT "Wireless Laptop"
;
ws064 A 192.168.10.64
MX 10 mail
ws064.ltsp CNAME ws064
;
ws065 A 192.168.10.65
MX 10 mail
ws065.ltsp CNAME ws065
;
ws066 A 192.168.10.66
MX 10 mail
ws066.ltsp CNAME ws066
;
ws067 A 192.168.10.67
MX 10 mail
ws067.ltsp CNAME ws067
;
ws068 A 192.168.10.68
MX 10 mail
ws068.ltsp CNAME ws068


>
> $ cat /var/lib/named/var/named/reverse/home.reversed $ORIGIN . $TTL 86400
> ; 1 day 1.168.192.in-addr.arpa IN SOA wb.home.invalid. (
> 1997022700 ; serial
> 28800 ; refresh (8 hours)
> 14400 ; retry (4 hours)
> 3600000 ; expire (5 weeks 6 days 16

hours)
> 86400 ; minimum (1 day)
> )
> NS wb.home.invalid.
> $ORIGIN 1.168.192.in-addr.arpa. $TTL 3600 ; 1 hour
>
> 11 PTR fw.home.invalid. 12 PTR
> wb1.home.invalid. 130 PTR wb.home.invalid. 131
> PTR beta.home.invalid.
>

;
; Reverse zone file for 192.168.10
;
$TTL 3D
@ IN SOA ns.magpieway.net. hostmaster.magpieway.net.
(
200602212 ; Serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D) ; Minimum TTL
NS magpieway.net.
;
; Servers
254 IN PTR router.magpieway.net.
7 IN PTR .
7 IN PTR tony-lx.magpieway.net.
;
; hosts
9 IN PTR tony-lt.magpieway.net
10 IN PTR tony-lw.magpieway.net
;
; Workstations
64 IN PTR ws064.ltsp.magpieway.net.
65 IN PTR ws065.ltsp.magpieway.net.
66 IN PTR ws066.ltsp.magpieway.net.
67 IN PTR ws067.ltsp.magpieway.net.
68 IN PTR ws068.ltsp.magpieway.net.


Hope that helps,

--
Tony van der Hoff | mailto:
Buckinghamshire, England
  Reply With Quote
Old 09-01-2008, 04:34 AM   #8
Bit Twister
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On Tue, 1 Jan 2008 13:23:11 +0000, Tony van der Hoff wrote:
> On 31 Dec at 17:59 Bit Twister <BitTwister@mouse-potato.com> wrote in
>
>> $ host 192.168.1.130 Host 130.1.168.192.in-addr.arpa not found:
>> 2(SERVFAIL)

>
>> Does that mean I have to create separate files for each ip on my LAN? I
>> thought my zone "1.168.192.in-addr.arpa" would keep me out of that
>> ditch. :-(
>>

> Indeed; that's what it does


I found out there is a way to not have to create separate zone files.
You can have just one.

See the SOLUTION post I am about to post.

  Reply With Quote
Old 09-01-2008, 04:35 AM   #9
Bit Twister
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails SOLUTION

On Mon, 31 Dec 2007 17:59:56 +0000 (UTC), Bit Twister wrote:

Instructions for Mandriva 2008.0 bind DNS server install, settings, script
follows for creating a basic local DNS server for my LAN.

Assumption is eth0 is the LAN nic with a 192.168.1.x LAN with FQDN
settings for all nodes on the LAN in /etc/hosts. Example snippet

$ head -5 /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.11 fw.home.invalid fw
192.168.1.12 wb1.home.invalid wb1
192.168.1.130 wb.home.invalid wb
192.168.1.131 beta.home.invalid beta

Warning, node names can not contain an underscore.
named failure example:
192.168.1.12 wb_1.home.invalid wb_1


Since my domain is not registered, I added .invalid to .home. This
install is on wb.home.invalid

home.zone is for forward look ups.
Example:
$ host wb.home.invalid
wb.home.invalid has address 192.168.1.130

home.reversed is used for reverse look ups.
Example:
$ host 192.168.1.130
130.1.168.192.in-addr.arpa domain name pointer wb.home.invalid.

home.reversed contains all your LAN node's alias and last octant of ip address.

Snippet follows:
$ head -13 /var/lib/named/var/named/reverse/home.reversed
$TTL 86400 ; 1 day
1.168.192.in-addr.arpa. IN SOA ns1.wb.home.invalid. wb.home.invalid. (
19 ; serial
8H ; refresh
4H ; retry
1W ; expire
1D ; minimum
)
NS wb.home.invalid.
11 IN PTR fw.home.invalid.
12 IN PTR wb1.home.invalid.
130 IN PTR wb.home.invalid.
131 IN PTR beta.home.invalid.




#************************************************* *************
#*
#* bind_install.txt - steps to install/setup bind
#*
#************************************************* *************

alias edt=gedit

urpmi bind --auto

cp /var/lib/named/etc/named.conf /var/lib/named/etc/named.conf_orig
mv /var/lib/named/etc/hosts /var/lib/named/etc/hosts_orig
cp /etc/hosts /var/lib/named/etc/hosts
mv /etc/hosts /etc/hosts_bkup

ln -s /var/lib/named/etc/bogon_acl.conf /etc/bogon_acl.conf
ln -s /var/lib/named/etc/hosts /etc/hosts
ln -s /var/lib/named/etc/logging.conf /etc/logging.conf
ln -s /var/lib/named/etc/trusted_networks_acl.conf /etc/trusted_networks_acl.conf

#*************************************************
#* modify named's config to use opendns DNS servers
#* and add our zone files
#************************************************* *


edt /var/lib/named/etc/named.conf

And find forwarders and add/change these

// servers
forwarders { 208.67.222.222; 208.67.220.220; };

And append these zones to the bottom:

zone "home.invalid" IN {
type master;
file "master/home.zone";
allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
type master;
file "reverse/home.reversed";
allow-update { none; };
};

Click Save, Quit

#*************************************************
#* set eth0's DNS1 to use our node's DNS resolver
#************************************************* *

hostname --ip-address

edt /etc/sysconfig/network-scripts/ifcfg-eth0
and set
DNS1=value_from_above_hostname_command
Click Save, Quit


#*************************************************
#* set default domain name for resolvconf(8)
#************************************************* *

hostname --domain
edt /etc/resolvconf/resolv.conf.d/tail
and add
domain value_from_above_hostname_command
Click Save, Quit

#*************************************************
#* fix /etc/resolv.conf to use my node's ip address
#************************************************* *

/bin/cp /etc/resolvconf/resolv.conf.d/head /etc/resolv.conf
echo "nameserver $(hostname --ip-address)" >> /etc/resolv.conf
cat /etc/resolvconf/resolv.conf.d/tail >> /etc/resolv.conf

#*************************************************
#* generate zone files, restart named, test
#************************************************* *

/local/bin/set_home_zone

#*********** end bind_install.txt *****************************************





#!/bin/bash
#************************************************* *********************
#*
#* set_home_zone - create home.(zone/reverse) files from /etc/hosts
#*
#* Note: _out_fn names have to match zone names in /etc/named.conf
#*
#************************************************* *********************

_dom=$(hostname --domain)
_ns=$(hostname --fqdn)
set -- $(echo "$(grep $_ns /etc/hosts)")
_ns_ip=$1

_out_fn=/var/lib/named/var/named/master/home.zone

echo "\$TTL 86400 ; 1 day
${_dom}. IN SOA ns1.${_ns}. ${_ns}. (
19 ; serial
1D ; refresh
6H ; retry
1W ; expire
1H ; minimum
)
; DNS Servers
@ IN NS ns1
@ IN NS ns2

; Machine Names
@ IN A $_ns_ip
ns1 IN A $_ns_ip
ns2 IN A $_ns_ip

NS ${_ns}.
\$ORIGIN ${_dom}.
\$TTL 86400 ; 1 day" > $_out_fn
while read line
do
eval set -- $line
_ip=$1
if [ "${_ip:0:3}" = "192" ] ; then
printf "%s\t\tA\t%s\n" $3 $1 >> $_out_fn
fi
done < /etc/hosts
chmod 644 $_out_fn

_out_fn=/var/lib/named/var/named/reverse/home.reversed

echo "\$TTL 86400 ; 1 day
1.168.192.in-addr.arpa. IN SOA ns1.${_ns}. ${_ns}. (
19 ; serial
8H ; refresh
4H ; retry
1W ; expire
1D ; minimum
)
NS ${_ns}." > $_out_fn
while read line
do
eval set -- $line
_fq=$2
set -- $(IFS='.'; echo $1)
if [ "$2" = "168" ] ; then
printf "%s\tIN\tPTR\t%s.\n" $4 $_fq >> $_out_fn
fi
done < /etc/hosts
chmod 644 $_out_fn

printf "\n# service named restart\n"
service named restart
printf "\n# nslookup $(hostname --fqdn )\n"
nslookup $(hostname --fqdn)
printf "\n# nslookup $(hostname --alias)\n"
nslookup $(hostname --alias)
printf "\n# nslookup $_ns_ip\n"
nslookup $_ns_ip

#**************** end set_home_zone *****************
  Reply With Quote
Old 09-01-2008, 05:23 AM   #10
Bit Twister
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On Sat, 05 Jan 2008 20:41:06 -0500, David W. Hodgins wrote:
> On Sat, 05 Jan 2008 18:20:11 -0500,
> Bit Twister <BitTwister@mouse-potato.com> wrote:
>
>
> Change as follows,
>
> In /var/lib/named/etc/named.conf ...
> zone "bogus.home" IN {


Well duh, 4 hours sleep a day for the past 4 days working the leafnode
and dns problems has not helped.
Forgot to go back and change zone. Thanks, nice catch.

> In cat /var/lib/named/var/named/master/home.zone ...
> $TTL 1D
>
> @ IN SOA localhost. root.localhost (


Ok

# service named restart
Stopping named: [ OK ]
Starting named: [ OK ]

Still no look up :-(

# grep nameserver /etc/resolv.conf | grep -v '^#'
nameserver 192.168.1.130

[root@wb bin]# nslookup $(hostname)
Server: 192.168.1.130
Address: 192.168.1.130#53

** server can't find wb.home.bogus: NXDOMAIN

# grep nameserver /etc/resolv.conf | grep -v '^#'
nameserver 127.0.0.1

[root@wb bin]# edt /etc/resolv.conf
[root@wb bin]# nslookup $(hostname)
Server: 127.0.0.1
Address: 127.0.0.1#53

** server can't find wb.home.bogus: NXDOMAIN

# head -18 /var/lib/named/var/named/master/home.zone
$TTL 1D

@ IN SOA localhost. root.localhost (
2008010501 ; Serial num yyymmddnn
1D ; Refresh
6H ; Retry
1W ; Expire
1H ; Minimum TTL
)
; DNS Servers
IN NS ns1.home.bogus.
;
; Machine Names
localhost IN A 127.0.0.1
ns1 IN A 192.168.1.130
fw IN A 192.168.1.11
wb IN A 192.168.1.130
beta IN A 192.168.1.131

  Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 09:49 PM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional