|
Rob, My intention is to build / find a utility that returns the DNS name in batch mode. NSLOOKUP works, but only in interactive mode, no out file option. I get no output with DIG for 208.39.73.153, so I guess DIG is not 100%. So why is DIG failing with some IPv4 addresses? Paul -----Original Message----- From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx Sent: Tuesday, May 19, 2015 8:11 AM To: Midrange Systems Technical Discussion Subject: Re: Input IPv4 address - return DNS name DIG HOSTNAME('10.17.6.33') REVERSE(*YES) IPVSN(*IPV4ONLY) SHORT(*YES) IDENTIFY(*YES) TOSTMF('/rob/digout') dspf '/rob/digout' ....+....1....+....2....+....3....+....4....+ ************Beginning of data************** ************End of Data******************** I, personally, don't see a lot of use in that. I tried it by client name and by IP address. No, I do not have a host table entry for it and NSLOOKUP works. If I try something in our DMZ versus something on the same subnet it works ....+....1....+....2....+....3....+....4....+....5 ************Beginning of data************** gdweb3.dekko.com. from server 10.10.4.250 in 1 ms. ************End of Data******************** It didn't work too well for nra.org, nor the address returned by pinging nra.org. But NSLOOKUP seemed to work. I do see a lot of pressure to use DIG versus NSLOOKUP. 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: "Steinmetz, Paul" <PSteinmetz@xxxxxxxxxx> To: "'Midrange Systems Technical Discussion'" <midrange-l@xxxxxxxxxxxx> Date: 05/18/2015 04:37 PM Subject: Input IPv4 address - return DNS name Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx> I've created a utility that inputs an IPv4 address and returns the DNS name. It uses the DIG command with the out file option. Does anything exist that does something similar? I'm planning on using this as part of a larger project to create and populate a log file of all external communications, (FTP, SSL, SSH, etc) 0008.00 PGM PARM(&IPV4 &DNSNAM) 0009.00 0010.00 /* VARIABLE DECLARATIONS */ 0011.00 0012.00 DCL VAR(&IPV4) TYPE(*CHAR) LEN(30) 0013.00 DCL VAR(&DNSNAM) TYPE(*CHAR) LEN(256 ) 0014.00 0015.00 RMVLNK OBJLNK('/DIGOUT') 0016.00 0017.00 DIG HOSTNAME(&IPV4) REVERSE(*YES) + 0018.00 IPVSN(*IPV4ONLY) SHORT(*YES) + 0019.00 IDENTIFY(*YES) TOSTMF(DIGOUT) 0020.00 0021.00 CPYFRMIMPF FROMSTMF('/DIGOUT') TOFILE(QGPL/DIGOUT) + 0022.00 MBROPT(*REPLACE) RCDDLM(*LF) + 0023.00 RPLNULLVAL(*FLDDFT) 0024.00 0025.00 CALL PGM(DIGCONV) PARM(&DNSNAM) /* Search DIG + 0026.00 outfile, find and return DNS name */ 0027.00 0028.00 DMPCLPGM 0029.00 0030.00 END: ENDPGM 0001.00 H DEBUG 0009.00 ************************************************************************** 0010.00 Fdigout ipe f 3965 disk 0011.00 ************************************************************************** 0012.00 dsearchfor s 12 0013.00 ************************************************************************** 0014.00 * Input Parameters 0015.00 idigout AA 01 0016.00 0017.00 * Record type 0018.00 0019.00 i 1 3965 irec 0020.00 ************************************************************************** 0021.00 C *entry plist 0022.00 C parm dnsfnd 256 0023.00 0024.00 c eval searchfor = 'from server ' 0025.00 c exsr search 0026.00 ************************************************************************** 0027.00 C search begsr 0028.00 ************************************************************************** 0029.00 /free 0030.00 pos = %scan(searchfor: irec :1); 0031.00 if pos <> 0; 0032.00 dnsfnd = %Subst(irec:1 :pos-3); 0033.00 endif; 0034.00 /end-free 0035.00 c endsr Thank You _____ Paul Steinmetz IBM i Systems Administrator Pencor Services, Inc. 462 Delaware Ave Palmerton Pa 18071 610-826-9117 work 610-826-9188 fax 610-349-0913 cell 610-377-6012 home psteinmetz@xxxxxxxxxx http://www.pencor.com/
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.