Do you have java on the box? I just put dnsjava on my box and tried this
and it worked in qsh. www.dnsjava.org
java -cp dnsjava-2.1.7.jar dig @8.8.4.4 medtronsoftware.com
; java dig 0.0
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64220
;; flags: qr rd ra ; qd: 1 an: 1 au: 0 ad: 0
;; QUESTIONS:
;; medtronsoftware.com., type = A, class = IN
;; ANSWERS:
medtronsoftware.com. 3599 IN A 75.131.68.42
;; AUTHORITY RECORDS:
;; ADDITIONAL RECORDS:
;; Message size: 53 bytes
;; Query time: 782 ms
Kevin Bucknum
Senior Programmer Analyst
MEDDATA/MEDTRON
Tel: 985-893-2550
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Rob Berendt
Sent: Thursday, December 22, 2016 3:23 PM
To: Midrange Systems Technical Discussion
Subject: RE: How to do a dns lookup on a system without
And, FYI, Scott's example did include something where he says that
gethostbyname can return multiple IP addresses and how to process that
with a DO loop.
In our situation 'fecal matter occurs' and we actually had this issue.
One of the reasons we need to look at this carefully. So when he says
"however, it's very unusual to need to work with anything but the first
address in the list" he doesn't have our buddy Murphy working with him.
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600
Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
From: Rob Berendt <rob@xxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Date: 12/22/2016 04:15 PM
Subject: RE: How to do a dns lookup on a system without
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
That's a good question.
Now I remember why I prefer NSLOOKUP to PING. NSLOOKUP has the
DMNNAMSVR
parameter. The problem with using PING is that PING may not refresh in
the time needed. Let me detail this for you...
We're doing a HA switch.
As part of the switch we do this long convoluted process from IBM i to
automatically change our DNS from our primary IP address to our backup
IP
address.
This process has IBM i talking to one pc, which must be signed on as a
particular user. This pc then talks to our DNS and updates the DNS. We
used to talk to the DNS server directly but a Windows server upgrade
slapped the cones of silence on it and killed IBM i from being able to
run
remote commands on it.
What I am trying to do is to have a test process in place to ensure the
communication works by changing a dummy name from one IP address to
another and nslookup the name, from that server, and get the IP address
and ensure that the switch worked.
If I use nslookup and specify the dns server it will get the current IP
address. If I try PING I have to flush the DNS cache a few times,
sacrifice an unblemished ram and maybe it will return the newest IP
address. Flushing the cache involves the manual process of CFGTCP, 12.
Change TCP/IP domain information and entering through that.
Now that I study this gethostbyname doesn't allow me to specify the
domain
name server so it may not be any better than ping.
That's the long way of saying, damn it, you're right!
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.