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, 05:30 AM   #21
David W. Hodgins
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On Sun, 06 Jan 2008 00:06:38 -0500, Bit Twister <BitTwister@mouse-potato.com> wrote:

> ** 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.


Change the above to ns1, not ns1.home.bogus.
I Don't remember exactly what I changed, but if you copy the complete files
from my prior article, they work on my system.

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, 05:30 AM   #22
herman.viaene@thuis.be
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

Bit Twister wrote:

> 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.

snip....

You helped me out a few times, so let me try to return the favor.
Back in MDK9.2 I got DNS working by manually fiddling the files. Apparently
now (2007.0 for me), these old files do not work anymore, so I just used
MCC - Network Services - DNS server, and it works!!!!

The only problem I have with this tool is that it gives very little feedback
(first define a server, then add hosts one by one), and it DOES NOT RESTART
named , so you have to do that yourself after finishing your changes.

Herman Viaene
--
Veel mensen danken hun goed geweten aan hun slecht geheugen. (G. Bomans)

Lots of people owe their good conscience to their bad memory (G. Bomans)
  Reply With Quote
Old 09-01-2008, 05:30 AM   #23
Bit Twister
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails SOLUTION

On Sun, 06 Jan 2008 10:18:34 +0100, wrote:

> Back in MDK9.2 I got DNS working by manually fiddling the files. Apparently
> now (2007.0 for me), these old files do not work anymore, so I just used
> MCC - Network Services - DNS server, and it works!!!!
>
> The only problem I have with this tool is that it gives very little feedback
> (first define a server, then add hosts one by one), and it DOES NOT RESTART
> named , so you have to do that yourself after finishing your changes.


Tried, your suggestion, and was not about to add 20+ hosts,
so I edited the forward and reverse files. Did a
service named restart
and found out named would not shutdown.
Sorry I did not keep the message. It was misleading as to the problem.
It was 5 am and was I chapped at yet another alligator biting my tail.
chkconfig --del named
reboot
urpme bind
urpmi bind --auto


My forward/reverse files look as follows:
$ head -17 /var/lib/named/var/named/master/home.zone
$TTL 1D
@ IN SOA wb.home.bogus. admin.wb.home.bogus. (
2008010601 ; Serial num yyymmddnn
1D ; Refresh
6H ; Retry
1W ; Expire
1H ; Minimum TTL
)
; DNS Servers
IN NS wb.home.bogus.
;
; Machine Names
localhost A 127.0.0.1
dnsmaster IN CNAME wb.home.bogus.
fw.home.bogus. IN A 192.168.1.11
wb.home.bogus. IN A 192.168.1.130
beta.home.bogus. IN A 192.168.1.131



$ head -14 /var/lib/named/var/named/reverse/home.reversed
$TTL 1D
@ IN SOA wb.home.bogus. wb.home.bogus.(
2008010601 ; Serial num yyymmddnn
8H ; Refresh
4H ; Retry
1W ; Expire
1D ; Minimum TTL
)
;
NS wb.home.bogus.
; Machine Ip addresses
11 IN PTR fw.home.bogus.
130 IN PTR wb.home.bogus.
131 IN PTR beta.home.bogus.


Here is my install procedure and script to automagically generate the 2 files.
Note: I am using OpenDNS.com name servers in forwarders.

Upside, the protect you from phishing scams by blocking the fraudulent
sites from resolving on your network.

Downside, They return 208.69.32.170 on a not found: 3(NXDOMAIN)

Here is a snippet from /etc/hosts
$ head -4 /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.11 fw.home.bogus fw
192.168.1.130 wb.home.bogus wb
192.168.1.131 beta.home.bogus beta


$ cat /local/doc/bind_install.txt
#************************************************* *************
#*
#* bind_install.txt - steps to install/setup bind for
#* Mandriva Linux 2008.0 in a 192.168.1.x LAN
#*
#************************************************* *************
exit 0 # just in case a newbie tries to run this as a script

As a user, click up a terminal and login as root as follows:
su - root

alias edt=gedit

#**************************************
#* install bind and update locate database
#**************************************

urpmi --wget bind --auto
/etc/cron.daily/mlocate.cron

cp /var/lib/named/etc/named.conf /var/lib/named/etc/named.conf_orig


#*************************************************
#* 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

// DNS servers
forwarders { 208.67.222.222; 208.67.220.220; };

And append these zones to the bottom:

zone "home.bogus" 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



#*************************************************
#* assuming eth0 is the LAN nic,
#* 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



#************************************************* *************
#* create /etc/resolv.conf with node's ip address
#* and add search line.
#*
#* Note: If you want to add extra nameserver values
#* add them above the echo "search $(hostname --domain)" line
#************************************************* **************

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

#************************************************* ****************
#* Use /etc/hosts to generate zone files, restart named, and test
#************************************************* ****************

/local/bin/set_home_zone

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


$ cat /local/bin/set_home_zone
#!/bin/bash
#************************************************* ******************
#*
#* set_home_zone - create named/bind home.(zone/reverse) files
#* from /etc/hosts
#*
#* Note: _out_fn names have to match zone names in /etc/named.conf
#*
#* set_home_zone expects your /etc/hosts to look something like
#*
#* $ head -4 /etc/hosts
#* 127.0.0.1 localhost.localdomain localhost
#* 192.168.1.11 fw.home.invalid fw
#* 192.168.1.130 wb.home.invalid wb
#* 192.168.1.131 beta.home.invalid beta
#*
#* and names do not contain an underscore
#*
#* See
#*
#* Assume you have followed /local/doc/bind_install.txt
#* and have the xmessage package installed.
#************************************************* ******************


_debug=0 # 0=production 1=check/testing

_exe=$0
_log_fn=$(echo /tmp/$(basename $_exe).log)
_time_out="-timeout 16"

#*************************************
#* get this node's domain, tld2,
#* name and ip
#*************************************

_dom=$(hostname --domain)
_ns=$(hostname --fqdn)
_alias=$(hostname --alias)
set -- $(IFS='.'; echo $_dom)
_tld2=$2
set -- $(echo "$(grep $_ns /etc/hosts)")
_ns_ip=$1

_zone_loc=/var/lib/named/var/named/master
_zone_fn=home.zone
_rev_loc=/var/lib/named/var/named/reverse
_rev_fn=home.reversed

if [ $_debug -gt 0 ] ; then # we create files in our account
_zone_loc=$PWD # for testing
_rev_loc=$PWD
_time_out="-timeout 6"
fi

#*************************************
#* build forward zone
#*************************************

_out_fn=$_zone_loc/$_zone_fn

echo "\$TTL 1D
@ IN SOA ${_ns}. admin.${_ns}. (
$(date +%Y%m%d)01 ; Serial num yyymmddnn
1D ; Refresh
6H ; Retry
1W ; Expire
1H ; Minimum TTL
)
; DNS Servers
IN NS ${_ns}.
;
; Machine Names
localhost A 127.0.0.1
dnsmaster IN CNAME ${_ns}." > $_out_fn
while read line
do
eval set -- $line
_ip=$1
if [ "${_ip:0:3}" = "192" ] ; then
printf "%s.\t\tIN\tA\t%s\n" $2 $1 >> $_out_fn
fi
done < /etc/hosts
chmod 644 $_out_fn

#*************************************
#* build reverse zone
#*************************************

_out_fn=$_rev_loc/$_rev_fn

echo "\$TTL 1D
@ IN SOA ${_ns}. ${_ns}.(
$(date +%Y%m%d)01 ; Serial num yyymmddnn
8H ; Refresh
4H ; Retry
1W ; Expire
1D ; Minimum TTL
)
;
NS ${_ns}.
; Machine Ip addresses " > $_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

#*************************************
#* test results
#*************************************


if [ $_debug -eq 0 ] ; then
_cmd="named-checkconf -t /var/lib/named /etc/named.conf"
echo "# $_cmd "
$_cmd > $_log_fn
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
xmessage $_time_out-display :0 -file $_log_fn &
fi
cat $_log_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
fi
_cmd="named-checkzone -t $_zone_loc ${_dom} $_zone_fn"
echo "# $_cmd "
$_cmd > $_log_fn
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
echo "$_zone_loc/$_zone_fn" >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
fi
cat $_log_fn

printf "\n# cat -n %s/%s\n" $_zone_loc $_zone_fn
cat -n $_zone_loc/$_zone_fn


_cmd="named-checkzone -t $_rev_loc 1.168.192.in-addr.arpa $_rev_fn"
echo "$ $_cmd"

$_cmd > $_log_fn 2>&1
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
echo "$_zone_loc/$_rev_fn" >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
fi
cat $_log_fn

printf "\n$ cat -n %s/%s\n" $_rev_loc $_rev_fn
cat -n $_rev_loc/$_rev_fn

_cmd="grep ${_dom} /etc/named.conf"
_cnt=$($_cmd | grep -c { )
if [ $_cnt -ne 1 ] ; then
echo "ERROR: " > $_log_fn
echo "/etc/named.conf does not contain a" >> $_log_fn
echo "zone \"${_dom}\" IN {" >> $_log_fn
echo "stanza" >> $_log_fn
echo " " >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
cat $_log_fn
fi
/bin/rm -f $_log_fn

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

On Sun, 06 Jan 2008 10:18:34 +0100, wrote:

> Back in MDK9.2 I got DNS working by manually fiddling the files. Apparently
> now (2007.0 for me), these old files do not work anymore, so I just used
> MCC - Network Services - DNS server, and it works!!!!
>
> The only problem I have with this tool is that it gives very little feedback
> (first define a server, then add hosts one by one), and it DOES NOT RESTART
> named , so you have to do that yourself after finishing your changes.


Tried, your suggestion, and was not about to add 20+ hosts,
so I edited the forward and reverse files. Did a
service named restart
and found out named would not shutdown.
Sorry I did not keep the message. It was misleading as to the problem.
It was 5 am and was I chapped at yet another alligator biting my tail.
chkconfig --del named
reboot
urpme bind
urpmi bind --auto


My forward/reverse files look as follows:
$ head -17 /var/lib/named/var/named/master/home.zone
$TTL 1D
@ IN SOA wb.home.bogus. admin.wb.home.bogus. (
2008010601 ; Serial num yyymmddnn
1D ; Refresh
6H ; Retry
1W ; Expire
1H ; Minimum TTL
)
; DNS Servers
IN NS wb.home.bogus.
;
; Machine Names
localhost A 127.0.0.1
dnsmaster IN CNAME wb.home.bogus.
fw.home.bogus. IN A 192.168.1.11
wb.home.bogus. IN A 192.168.1.130
beta.home.bogus. IN A 192.168.1.131



$ head -14 /var/lib/named/var/named/reverse/home.reversed
$TTL 1D
@ IN SOA wb.home.bogus. wb.home.bogus.(
2008010601 ; Serial num yyymmddnn
8H ; Refresh
4H ; Retry
1W ; Expire
1D ; Minimum TTL
)
;
NS wb.home.bogus.
; Machine Ip addresses
11 IN PTR fw.home.bogus.
130 IN PTR wb.home.bogus.
131 IN PTR beta.home.bogus.


Here is my install procedure and script to automagically generate the 2 files.
Note: I am using OpenDNS.com name servers in forwarders.

Upside, the protect you from phishing scams by blocking the fraudulent
sites from resolving on your network.

Downside, They return 208.69.32.170 on a not found: 3(NXDOMAIN)

Here is a snippet from /etc/hosts
$ head -4 /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.11 fw.home.bogus fw
192.168.1.130 wb.home.bogus wb
192.168.1.131 beta.home.bogus beta


$ cat /local/doc/bind_install.txt
#************************************************* *************
#*
#* bind_install.txt - steps to install/setup bind for
#* Mandriva Linux 2008.0 in a 192.168.1.x LAN
#*
#************************************************* *************
exit 0 # just in case a newbie tries to run this as a script

As a user, click up a terminal and login as root as follows:
su - root

alias edt=gedit

#**************************************
#* install bind and update locate database
#**************************************

urpmi --wget bind --auto
/etc/cron.daily/mlocate.cron

cp /var/lib/named/etc/named.conf /var/lib/named/etc/named.conf_orig


#*************************************************
#* 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

// DNS servers
forwarders { 208.67.222.222; 208.67.220.220; };

And append these zones to the bottom:

zone "home.bogus" 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



#*************************************************
#* assuming eth0 is the LAN nic,
#* 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



#************************************************* *************
#* create /etc/resolv.conf with node's ip address
#* and add search line.
#*
#* Note: If you want to add extra nameserver values
#* add them above the echo "search $(hostname --domain)" line
#************************************************* **************

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

#************************************************* ****************
#* Use /etc/hosts to generate zone files, restart named, and test
#************************************************* ****************

/local/bin/set_home_zone

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


$ cat /local/bin/set_home_zone
#!/bin/bash
#************************************************* ******************
#*
#* set_home_zone - create named/bind home.(zone/reverse) files
#* from /etc/hosts
#*
#* Note: _out_fn names have to match zone names in /etc/named.conf
#*
#* set_home_zone expects your /etc/hosts to look something like
#*
#* $ head -4 /etc/hosts
#* 127.0.0.1 localhost.localdomain localhost
#* 192.168.1.11 fw.home.invalid fw
#* 192.168.1.130 wb.home.invalid wb
#* 192.168.1.131 beta.home.invalid beta
#*
#* and names do not contain an underscore
#*
#* See
#*
#* Assume you have followed /local/doc/bind_install.txt
#* and have the xmessage package installed.
#************************************************* ******************


_debug=0 # 0=production 1=check/testing

_exe=$0
_log_fn=$(echo /tmp/$(basename $_exe).log)
_time_out="-timeout 16"

#*************************************
#* get this node's domain, tld2,
#* name and ip
#*************************************

_dom=$(hostname --domain)
_ns=$(hostname --fqdn)
_alias=$(hostname --alias)
set -- $(IFS='.'; echo $_dom)
_tld2=$2
set -- $(echo "$(grep $_ns /etc/hosts)")
_ns_ip=$1

_zone_loc=/var/lib/named/var/named/master
_zone_fn=home.zone
_rev_loc=/var/lib/named/var/named/reverse
_rev_fn=home.reversed

if [ $_debug -gt 0 ] ; then # we create files in our account
_zone_loc=$PWD # for testing
_rev_loc=$PWD
_time_out="-timeout 6"
fi

#*************************************
#* build forward zone
#*************************************

_out_fn=$_zone_loc/$_zone_fn

echo "\$TTL 1D
@ IN SOA ${_ns}. admin.${_ns}. (
$(date +%Y%m%d)01 ; Serial num yyymmddnn
1D ; Refresh
6H ; Retry
1W ; Expire
1H ; Minimum TTL
)
; DNS Servers
IN NS ${_ns}.
;
; Machine Names
localhost A 127.0.0.1
dnsmaster IN CNAME ${_ns}." > $_out_fn
while read line
do
eval set -- $line
_ip=$1
if [ "${_ip:0:3}" = "192" ] ; then
printf "%s.\t\tIN\tA\t%s\n" $2 $1 >> $_out_fn
fi
done < /etc/hosts
chmod 644 $_out_fn

#*************************************
#* build reverse zone
#*************************************

_out_fn=$_rev_loc/$_rev_fn

echo "\$TTL 1D
@ IN SOA ${_ns}. ${_ns}.(
$(date +%Y%m%d)01 ; Serial num yyymmddnn
8H ; Refresh
4H ; Retry
1W ; Expire
1D ; Minimum TTL
)
;
NS ${_ns}.
; Machine Ip addresses " > $_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

#*************************************
#* test results
#*************************************


if [ $_debug -eq 0 ] ; then
_cmd="named-checkconf -t /var/lib/named /etc/named.conf"
echo "# $_cmd "
$_cmd > $_log_fn
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
xmessage $_time_out-display :0 -file $_log_fn &
fi
cat $_log_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
fi
_cmd="named-checkzone -t $_zone_loc ${_dom} $_zone_fn"
echo "# $_cmd "
$_cmd > $_log_fn
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
echo "$_zone_loc/$_zone_fn" >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
fi
cat $_log_fn

printf "\n# cat -n %s/%s\n" $_zone_loc $_zone_fn
cat -n $_zone_loc/$_zone_fn


_cmd="named-checkzone -t $_rev_loc 1.168.192.in-addr.arpa $_rev_fn"
echo "$ $_cmd"

$_cmd > $_log_fn 2>&1
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
echo "$_zone_loc/$_rev_fn" >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
fi
cat $_log_fn

printf "\n$ cat -n %s/%s\n" $_rev_loc $_rev_fn
cat -n $_rev_loc/$_rev_fn

_cmd="grep ${_dom} /etc/named.conf"
_cnt=$($_cmd | grep -c { )
if [ $_cnt -ne 1 ] ; then
echo "ERROR: " > $_log_fn
echo "/etc/named.conf does not contain a" >> $_log_fn
echo "zone \"${_dom}\" IN {" >> $_log_fn
echo "stanza" >> $_log_fn
echo " " >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
cat $_log_fn
fi
/bin/rm -f $_log_fn

#**************** end set_home_zone *****************
  Reply With Quote
Old 09-01-2008, 05:31 AM   #25
herman.viaene@thuis.be
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

Bit Twister wrote:

> 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.

snip....

You helped me out a few times, so let me try to return the favor.
Back in MDK9.2 I got DNS working by manually fiddling the files. Apparently
now (2007.0 for me), these old files do not work anymore, so I just used
MCC - Network Services - DNS server, and it works!!!!

The only problem I have with this tool is that it gives very little feedback
(first define a server, then add hosts one by one), and it DOES NOT RESTART
named , so you have to do that yourself after finishing your changes.

Herman Viaene
--
Veel mensen danken hun goed geweten aan hun slecht geheugen. (G. Bomans)

Lots of people owe their good conscience to their bad memory (G. Bomans)
  Reply With Quote
Old 09-01-2008, 05:32 AM   #26
David W. Hodgins
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On Sun, 06 Jan 2008 00:06:38 -0500, Bit Twister <BitTwister@mouse-potato.com> wrote:

> ** 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.


Change the above to ns1, not ns1.home.bogus.
I Don't remember exactly what I changed, but if you copy the complete files
from my prior article, they work on my system.

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, 05:32 AM   #27
Bit Twister
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails SOLUTION

On Sun, 06 Jan 2008 10:18:34 +0100, wrote:

> Back in MDK9.2 I got DNS working by manually fiddling the files. Apparently
> now (2007.0 for me), these old files do not work anymore, so I just used
> MCC - Network Services - DNS server, and it works!!!!
>
> The only problem I have with this tool is that it gives very little feedback
> (first define a server, then add hosts one by one), and it DOES NOT RESTART
> named , so you have to do that yourself after finishing your changes.


Tried, your suggestion, and was not about to add 20+ hosts,
so I edited the forward and reverse files. Did a
service named restart
and found out named would not shutdown.
Sorry I did not keep the message. It was misleading as to the problem.
It was 5 am and was I chapped at yet another alligator biting my tail.
chkconfig --del named
reboot
urpme bind
urpmi bind --auto


My forward/reverse files look as follows:
$ head -17 /var/lib/named/var/named/master/home.zone
$TTL 1D
@ IN SOA wb.home.bogus. admin.wb.home.bogus. (
2008010601 ; Serial num yyymmddnn
1D ; Refresh
6H ; Retry
1W ; Expire
1H ; Minimum TTL
)
; DNS Servers
IN NS wb.home.bogus.
;
; Machine Names
localhost A 127.0.0.1
dnsmaster IN CNAME wb.home.bogus.
fw.home.bogus. IN A 192.168.1.11
wb.home.bogus. IN A 192.168.1.130
beta.home.bogus. IN A 192.168.1.131



$ head -14 /var/lib/named/var/named/reverse/home.reversed
$TTL 1D
@ IN SOA wb.home.bogus. wb.home.bogus.(
2008010601 ; Serial num yyymmddnn
8H ; Refresh
4H ; Retry
1W ; Expire
1D ; Minimum TTL
)
;
NS wb.home.bogus.
; Machine Ip addresses
11 IN PTR fw.home.bogus.
130 IN PTR wb.home.bogus.
131 IN PTR beta.home.bogus.


Here is my install procedure and script to automagically generate the 2 files.
Note: I am using OpenDNS.com name servers in forwarders.

Upside, the protect you from phishing scams by blocking the fraudulent
sites from resolving on your network.

Downside, They return 208.69.32.170 on a not found: 3(NXDOMAIN)

Here is a snippet from /etc/hosts
$ head -4 /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.11 fw.home.bogus fw
192.168.1.130 wb.home.bogus wb
192.168.1.131 beta.home.bogus beta


$ cat /local/doc/bind_install.txt
#************************************************* *************
#*
#* bind_install.txt - steps to install/setup bind for
#* Mandriva Linux 2008.0 in a 192.168.1.x LAN
#*
#************************************************* *************
exit 0 # just in case a newbie tries to run this as a script

As a user, click up a terminal and login as root as follows:
su - root

alias edt=gedit

#**************************************
#* install bind and update locate database
#**************************************

urpmi --wget bind --auto
/etc/cron.daily/mlocate.cron

cp /var/lib/named/etc/named.conf /var/lib/named/etc/named.conf_orig


#*************************************************
#* 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

// DNS servers
forwarders { 208.67.222.222; 208.67.220.220; };

And append these zones to the bottom:

zone "home.bogus" 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



#*************************************************
#* assuming eth0 is the LAN nic,
#* 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



#************************************************* *************
#* create /etc/resolv.conf with node's ip address
#* and add search line.
#*
#* Note: If you want to add extra nameserver values
#* add them above the echo "search $(hostname --domain)" line
#************************************************* **************

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

#************************************************* ****************
#* Use /etc/hosts to generate zone files, restart named, and test
#************************************************* ****************

/local/bin/set_home_zone

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


$ cat /local/bin/set_home_zone
#!/bin/bash
#************************************************* ******************
#*
#* set_home_zone - create named/bind home.(zone/reverse) files
#* from /etc/hosts
#*
#* Note: _out_fn names have to match zone names in /etc/named.conf
#*
#* set_home_zone expects your /etc/hosts to look something like
#*
#* $ head -4 /etc/hosts
#* 127.0.0.1 localhost.localdomain localhost
#* 192.168.1.11 fw.home.invalid fw
#* 192.168.1.130 wb.home.invalid wb
#* 192.168.1.131 beta.home.invalid beta
#*
#* and names do not contain an underscore
#*
#* See
#*
#* Assume you have followed /local/doc/bind_install.txt
#* and have the xmessage package installed.
#************************************************* ******************


_debug=0 # 0=production 1=check/testing

_exe=$0
_log_fn=$(echo /tmp/$(basename $_exe).log)
_time_out="-timeout 16"

#*************************************
#* get this node's domain, tld2,
#* name and ip
#*************************************

_dom=$(hostname --domain)
_ns=$(hostname --fqdn)
_alias=$(hostname --alias)
set -- $(IFS='.'; echo $_dom)
_tld2=$2
set -- $(echo "$(grep $_ns /etc/hosts)")
_ns_ip=$1

_zone_loc=/var/lib/named/var/named/master
_zone_fn=home.zone
_rev_loc=/var/lib/named/var/named/reverse
_rev_fn=home.reversed

if [ $_debug -gt 0 ] ; then # we create files in our account
_zone_loc=$PWD # for testing
_rev_loc=$PWD
_time_out="-timeout 6"
fi

#*************************************
#* build forward zone
#*************************************

_out_fn=$_zone_loc/$_zone_fn

echo "\$TTL 1D
@ IN SOA ${_ns}. admin.${_ns}. (
$(date +%Y%m%d)01 ; Serial num yyymmddnn
1D ; Refresh
6H ; Retry
1W ; Expire
1H ; Minimum TTL
)
; DNS Servers
IN NS ${_ns}.
;
; Machine Names
localhost A 127.0.0.1
dnsmaster IN CNAME ${_ns}." > $_out_fn
while read line
do
eval set -- $line
_ip=$1
if [ "${_ip:0:3}" = "192" ] ; then
printf "%s.\t\tIN\tA\t%s\n" $2 $1 >> $_out_fn
fi
done < /etc/hosts
chmod 644 $_out_fn

#*************************************
#* build reverse zone
#*************************************

_out_fn=$_rev_loc/$_rev_fn

echo "\$TTL 1D
@ IN SOA ${_ns}. ${_ns}.(
$(date +%Y%m%d)01 ; Serial num yyymmddnn
8H ; Refresh
4H ; Retry
1W ; Expire
1D ; Minimum TTL
)
;
NS ${_ns}.
; Machine Ip addresses " > $_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

#*************************************
#* test results
#*************************************


if [ $_debug -eq 0 ] ; then
_cmd="named-checkconf -t /var/lib/named /etc/named.conf"
echo "# $_cmd "
$_cmd > $_log_fn
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
xmessage $_time_out-display :0 -file $_log_fn &
fi
cat $_log_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
fi
_cmd="named-checkzone -t $_zone_loc ${_dom} $_zone_fn"
echo "# $_cmd "
$_cmd > $_log_fn
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
echo "$_zone_loc/$_zone_fn" >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
fi
cat $_log_fn

printf "\n# cat -n %s/%s\n" $_zone_loc $_zone_fn
cat -n $_zone_loc/$_zone_fn


_cmd="named-checkzone -t $_rev_loc 1.168.192.in-addr.arpa $_rev_fn"
echo "$ $_cmd"

$_cmd > $_log_fn 2>&1
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
echo "$_zone_loc/$_rev_fn" >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
fi
cat $_log_fn

printf "\n$ cat -n %s/%s\n" $_rev_loc $_rev_fn
cat -n $_rev_loc/$_rev_fn

_cmd="grep ${_dom} /etc/named.conf"
_cnt=$($_cmd | grep -c { )
if [ $_cnt -ne 1 ] ; then
echo "ERROR: " > $_log_fn
echo "/etc/named.conf does not contain a" >> $_log_fn
echo "zone \"${_dom}\" IN {" >> $_log_fn
echo "stanza" >> $_log_fn
echo " " >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
cat $_log_fn
fi
/bin/rm -f $_log_fn

#**************** end set_home_zone *****************
  Reply With Quote
Old 09-01-2008, 05:32 AM   #28
David W. Hodgins
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On Sun, 06 Jan 2008 00:06:38 -0500, Bit Twister <BitTwister@mouse-potato.com> wrote:

> ** 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.


Change the above to ns1, not ns1.home.bogus.
I Don't remember exactly what I changed, but if you copy the complete files
from my prior article, they work on my system.

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, 05:33 AM   #29
Bit Twister
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails SOLUTION

On Sun, 06 Jan 2008 10:18:34 +0100, wrote:

> Back in MDK9.2 I got DNS working by manually fiddling the files. Apparently
> now (2007.0 for me), these old files do not work anymore, so I just used
> MCC - Network Services - DNS server, and it works!!!!
>
> The only problem I have with this tool is that it gives very little feedback
> (first define a server, then add hosts one by one), and it DOES NOT RESTART
> named , so you have to do that yourself after finishing your changes.


Tried, your suggestion, and was not about to add 20+ hosts,
so I edited the forward and reverse files. Did a
service named restart
and found out named would not shutdown.
Sorry I did not keep the message. It was misleading as to the problem.
It was 5 am and was I chapped at yet another alligator biting my tail.
chkconfig --del named
reboot
urpme bind
urpmi bind --auto


My forward/reverse files look as follows:
$ head -17 /var/lib/named/var/named/master/home.zone
$TTL 1D
@ IN SOA wb.home.bogus. admin.wb.home.bogus. (
2008010601 ; Serial num yyymmddnn
1D ; Refresh
6H ; Retry
1W ; Expire
1H ; Minimum TTL
)
; DNS Servers
IN NS wb.home.bogus.
;
; Machine Names
localhost A 127.0.0.1
dnsmaster IN CNAME wb.home.bogus.
fw.home.bogus. IN A 192.168.1.11
wb.home.bogus. IN A 192.168.1.130
beta.home.bogus. IN A 192.168.1.131



$ head -14 /var/lib/named/var/named/reverse/home.reversed
$TTL 1D
@ IN SOA wb.home.bogus. wb.home.bogus.(
2008010601 ; Serial num yyymmddnn
8H ; Refresh
4H ; Retry
1W ; Expire
1D ; Minimum TTL
)
;
NS wb.home.bogus.
; Machine Ip addresses
11 IN PTR fw.home.bogus.
130 IN PTR wb.home.bogus.
131 IN PTR beta.home.bogus.


Here is my install procedure and script to automagically generate the 2 files.
Note: I am using OpenDNS.com name servers in forwarders.

Upside, the protect you from phishing scams by blocking the fraudulent
sites from resolving on your network.

Downside, They return 208.69.32.170 on a not found: 3(NXDOMAIN)

Here is a snippet from /etc/hosts
$ head -4 /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.11 fw.home.bogus fw
192.168.1.130 wb.home.bogus wb
192.168.1.131 beta.home.bogus beta


$ cat /local/doc/bind_install.txt
#************************************************* *************
#*
#* bind_install.txt - steps to install/setup bind for
#* Mandriva Linux 2008.0 in a 192.168.1.x LAN
#*
#************************************************* *************
exit 0 # just in case a newbie tries to run this as a script

As a user, click up a terminal and login as root as follows:
su - root

alias edt=gedit

#**************************************
#* install bind and update locate database
#**************************************

urpmi --wget bind --auto
/etc/cron.daily/mlocate.cron

cp /var/lib/named/etc/named.conf /var/lib/named/etc/named.conf_orig


#*************************************************
#* 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

// DNS servers
forwarders { 208.67.222.222; 208.67.220.220; };

And append these zones to the bottom:

zone "home.bogus" 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



#*************************************************
#* assuming eth0 is the LAN nic,
#* 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



#************************************************* *************
#* create /etc/resolv.conf with node's ip address
#* and add search line.
#*
#* Note: If you want to add extra nameserver values
#* add them above the echo "search $(hostname --domain)" line
#************************************************* **************

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

#************************************************* ****************
#* Use /etc/hosts to generate zone files, restart named, and test
#************************************************* ****************

/local/bin/set_home_zone

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


$ cat /local/bin/set_home_zone
#!/bin/bash
#************************************************* ******************
#*
#* set_home_zone - create named/bind home.(zone/reverse) files
#* from /etc/hosts
#*
#* Note: _out_fn names have to match zone names in /etc/named.conf
#*
#* set_home_zone expects your /etc/hosts to look something like
#*
#* $ head -4 /etc/hosts
#* 127.0.0.1 localhost.localdomain localhost
#* 192.168.1.11 fw.home.invalid fw
#* 192.168.1.130 wb.home.invalid wb
#* 192.168.1.131 beta.home.invalid beta
#*
#* and names do not contain an underscore
#*
#* See
#*
#* Assume you have followed /local/doc/bind_install.txt
#* and have the xmessage package installed.
#************************************************* ******************


_debug=0 # 0=production 1=check/testing

_exe=$0
_log_fn=$(echo /tmp/$(basename $_exe).log)
_time_out="-timeout 16"

#*************************************
#* get this node's domain, tld2,
#* name and ip
#*************************************

_dom=$(hostname --domain)
_ns=$(hostname --fqdn)
_alias=$(hostname --alias)
set -- $(IFS='.'; echo $_dom)
_tld2=$2
set -- $(echo "$(grep $_ns /etc/hosts)")
_ns_ip=$1

_zone_loc=/var/lib/named/var/named/master
_zone_fn=home.zone
_rev_loc=/var/lib/named/var/named/reverse
_rev_fn=home.reversed

if [ $_debug -gt 0 ] ; then # we create files in our account
_zone_loc=$PWD # for testing
_rev_loc=$PWD
_time_out="-timeout 6"
fi

#*************************************
#* build forward zone
#*************************************

_out_fn=$_zone_loc/$_zone_fn

echo "\$TTL 1D
@ IN SOA ${_ns}. admin.${_ns}. (
$(date +%Y%m%d)01 ; Serial num yyymmddnn
1D ; Refresh
6H ; Retry
1W ; Expire
1H ; Minimum TTL
)
; DNS Servers
IN NS ${_ns}.
;
; Machine Names
localhost A 127.0.0.1
dnsmaster IN CNAME ${_ns}." > $_out_fn
while read line
do
eval set -- $line
_ip=$1
if [ "${_ip:0:3}" = "192" ] ; then
printf "%s.\t\tIN\tA\t%s\n" $2 $1 >> $_out_fn
fi
done < /etc/hosts
chmod 644 $_out_fn

#*************************************
#* build reverse zone
#*************************************

_out_fn=$_rev_loc/$_rev_fn

echo "\$TTL 1D
@ IN SOA ${_ns}. ${_ns}.(
$(date +%Y%m%d)01 ; Serial num yyymmddnn
8H ; Refresh
4H ; Retry
1W ; Expire
1D ; Minimum TTL
)
;
NS ${_ns}.
; Machine Ip addresses " > $_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

#*************************************
#* test results
#*************************************


if [ $_debug -eq 0 ] ; then
_cmd="named-checkconf -t /var/lib/named /etc/named.conf"
echo "# $_cmd "
$_cmd > $_log_fn
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
xmessage $_time_out-display :0 -file $_log_fn &
fi
cat $_log_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
fi
_cmd="named-checkzone -t $_zone_loc ${_dom} $_zone_fn"
echo "# $_cmd "
$_cmd > $_log_fn
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
echo "$_zone_loc/$_zone_fn" >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
fi
cat $_log_fn

printf "\n# cat -n %s/%s\n" $_zone_loc $_zone_fn
cat -n $_zone_loc/$_zone_fn


_cmd="named-checkzone -t $_rev_loc 1.168.192.in-addr.arpa $_rev_fn"
echo "$ $_cmd"

$_cmd > $_log_fn 2>&1
if [ $? -ne 0 ] ; then
echo "$_cmd failure" >> $_log_fn
echo "$_zone_loc/$_rev_fn" >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
fi
cat $_log_fn

printf "\n$ cat -n %s/%s\n" $_rev_loc $_rev_fn
cat -n $_rev_loc/$_rev_fn

_cmd="grep ${_dom} /etc/named.conf"
_cnt=$($_cmd | grep -c { )
if [ $_cnt -ne 1 ] ; then
echo "ERROR: " > $_log_fn
echo "/etc/named.conf does not contain a" >> $_log_fn
echo "zone \"${_dom}\" IN {" >> $_log_fn
echo "stanza" >> $_log_fn
echo " " >> $_log_fn
xmessage $_time_out -display :0 -file $_log_fn &
cat $_log_fn
fi
/bin/rm -f $_log_fn

#**************** end set_home_zone *****************
  Reply With Quote
Old 09-01-2008, 05:33 AM   #30
David W. Hodgins
Guest
 
Posts: n/a
Re: Internal DNS resolution look up fails

On Sun, 06 Jan 2008 00:06:38 -0500, Bit Twister <BitTwister@mouse-potato.com> wrote:

> ** 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.


Change the above to ns1, not ns1.home.bogus.
I Don't remember exactly what I changed, but if you copy the complete files
from my prior article, they work on my system.

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
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 06:51 AM.


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