For over 15 years I've worked with companies that at one point or another decide it's time to start using their IBM i for more than green bar reports. They want to use Web Services, email and other applications that require connectivity, something most people take for granted on the PC.
In this series I'm going to touch on the configuration issues I run into most. Starting with DNS servers.
For some reason, a lot of IBM i admins prefer to use IP addresses instead of host names. This is WRONG.
If the IP address changes, your application will be using the wrong values. If you use a host name with a proper DNS server, when the IP changes (but the host name stays the same), things will normally work just fine.
The single biggest overlooked item IBM i administrators seem to be missing is configuring the DNS servers so your IBM i can actually resolve host names (such as domain names or other server names) to their IP address. Instead of setting up DNS servers, they will use PING on their PC to find the IP address of a name and either use that IP address, or even worse, set up a Host Table Entry using that IP address (this is my BIGGEST pet peave!). This totally defeats the purpose of DNS servers in the first place (How Domain Names Work).
Imagine you have an application that processes credit cards or retrieves shipping information using a web service. You'd use a product such as GETURI from BVSTools or Scott Klement's HTTP API for this. Another example is sending email. Normally you'll need to provide the outgoing server information (either in the CHGSMTPA command, or when using something like MAILTOOL Plus, specifying the mail router on the command itself).
At first, you'd try using the host name in the documentation for the application, but, you get an error that says "cannot resolve host name" or something similar. Frustrated, you choose one of the previously mentioned scenarios (most likely just using the IP address you get using PING on the host name on your PC). Things work, you're happy, and you move on to other projects.
A month later your phone is ringing off the hook saying that the credit card (or shipping or email application) isn't working. After some debugging you find the Web Service (or email) call is erroring out. You have no idea why. But after a few calls, some emails and support, you realize the IP address has changed for the web service or mail router. So, now do you:
If you chose option 1, you're wrong. If you chose option 2, that's what this article will help with.
Your IBM i (AS/400) is no different than a PC. It needs to be able to look up host names using DNS servers. And this does NOT mean using a host table entry. A host table entry is similar to updating the "hosts" file on your Windows PC. Rarely if ever should that be done. (Yes, there are cases where you would do it, but not for standard host names).
On your PC, if you open a DOS window and issue the command
ipconfig /all you will get some information about your PC's connection information. Included in that are the DNS servers that it's using. Now, those are normally automatically filled in if you're using DHCP. Your IBM i needs the same information, but must be manually inputted. Where you ask?
CFGTCP Option 12
The CFGTCP command should only be used by those comfortable as one wrong move could really mess things up. But in this case, we're looking at setting up our IBM i with the proper DNS information so that it can resolve host names just like any other machine out there.
Examine the following screenshot of the Option 12 from the CFGTCP command (the CHGTCPDMN command will also get you there):
Notice the section near the bottom that reads "Domain name server:". This is where you will enter the IP addresses of the DNS server(s) that your organization uses. In this case, I'm using Google's public DNS servers, only because they are more reliable than the DNS servers used by my ISP (long story...).
You'll also notice the "Host name search priority" option. If set to *REMOTE it will use the DNS servers listed to try and resolve a host name first, then any local settings (ie, Host Table Entries). I always like to set this to *REMOTE instead of *LOCAL because if I had a dime for every customer I've helped where there are Host Table Entries set up that really mess things up I'd be rich (well, maybe I could take the family out for steak....).
Once the proper DNS servers are listed you should be able to use the PING command on the IBM i command line and resolve to the correct IP address of that host. And, when that IP address changes, it will happen seamlessly in the background, unlike if you were to "hard code" the IP address or use a Host Table Entry.
Now, there may be a case where you don't get a PING reply. That's OK! As long as it resolves the host name to an IP address, that's all you care about. Not all servers are set up to return replies to PING.
So, instead of just "getting by", spend the time to get your DNS servers set up properly. Spending the extra 10 minutes to call your network administrator to find out the DNS server IP address(es) and using them instead of hard-coding IP values or using Host Table Entries will save you HOURS in the future when things change (and you know they will). And, your IBM i will now work like it should and be able to communicate with the rest of the World Wide Web.
Thanks for the information especially about using 3rd party DNS servers. I have also had issues with my ISP's DNS servers and since changing to 3rd party DNS servers (in this case GOOGLE), all those problems have gone bye bye. It took me a while to figure out the correct way to configure
DNS on my IBM but thanks to SPLTOOLS which I have owned for quite a while, I have gotten my PHD in setting up DNS and all the related settings on my IBM POWER 7 the right way (mostly with your help!)