Operating System - Linux
1830218 Members
2282 Online
109999 Solutions
New Discussion

Re: difference nslookup between Linux and HP-UX

 
Billa-User
Regular Advisor

difference nslookup between Linux and HP-UX

hello,

i have following issue :
- HP-UX 11.31 dns-server BIND 9.3.2
- Linux SLES 10 dns-server BIND 9.3.4

i want the same output of command "nslookup"
what option's i have to use for Linux with command "nslookup" ?

following command i made:

1. login at dns-server
2. nslookup
3. server localhost
4.

detail out in the attachment,
first part "HP-UX"
second part "Linux"

regards,tom
7 REPLIES 7
Viktor Balogh
Honored Contributor

Re: difference nslookup between Linux and HP-UX

> i want the same output of command "nslookup"

do you want these to be the same to the letter? the output looks semantically equivalent to me:

HP-UX:

Trying DNS
Name: server.example.com
Address: 192.164.170.32

Linux:

Non-authoritative answer:
32.170.164.192.in-addr.arpa name = server.example.com

****
Unix operates with beer.
Billa-User
Regular Advisor

Re: difference nslookup between Linux and HP-UX

hello,

@the output looks semantically equivalent to me:

your are right, semantically is it the same , but the output is different :

for me , it is easier to parse the output of HP-UX with following shell script below.

HP-UX:

Trying DNS
Name: server.example.com
Address: 192.164.170.32

nslookup_localhost="server localhost"
ip_address="192.164.170.32"

dns_hostentry=`nslookup <<-EOF | grep '^Name:' |tail -1 | awk '{print $NF}'
${nslookup_localhost}
${ip_address}
exit
EOF `

i idea of me is , to make two different shell commands :

ux_version="uname -s"

and nslookup parse should be different for $ux_version

regards,tom

Viktor Balogh
Honored Contributor

Re: difference nslookup between Linux and HP-UX

> for me , it is easier to parse the output of HP-UX with following shell script below.

ok, clear. so you can handle the HP-UX part. For linux, I would suggest to use the dig command, which has a +short option, it is easy to parse:

# dig +short example.com
192.0.32.10
#



****
Unix operates with beer.
Billa-User
Regular Advisor

Re: difference nslookup between Linux and HP-UX

hello,

hmm , when i type

dig +short example.com

the command doesn't ask me for an input (ip)

do you have another unix version?
i tried for HP-UX and Linux
Billa-User
Regular Advisor

Re: difference nslookup between Linux and HP-UX

hello,
i tried some options, now it is ok:

with hostname:
dig server.example.com +short @localhost

with ip-address
dig -x 192.164.170.32 +short @localhost

@ dig +short example.com
do you forget the "server-name" to "dig"?
regards
Viktor Balogh
Honored Contributor

Re: difference nslookup between Linux and HP-UX

> do you forget the "server-name" to "dig"?

no, I just didn't declared the DNS server IP, it is not a must. I think if you leave the "@localhost" part in your command, it will use the dns server which was specified in /etc/resolv.conf. But not sure if every linux distro works this way, I tried it on OpenSUSE.
****
Unix operates with beer.
Steven Schweda
Honored Contributor

Re: difference nslookup between Linux and HP-UX

> i want the same output of command "nslookup"

One way to do that is to use the same
"nslookup" program everywhere. If you find
some source, and build it on all your
systems, then you should get similar results
everywhere.