Home > AS/400 Tips > iSeries programmer tips > The Lazy Coder: Fun with TCP/IP
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

The Lazy Coder: Fun with TCP/IP


Andrew Borts
06.16.2004
Rating: -3.75- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


I'm going to go over some REALLY COOL time-saving ideas so you can put your feet up and, well, be lazy like me. What do you think about securing your local network and setting the clock automatically? Sound good? OK, let's go secure that network!

Fun with numbers
The Internet is a public network (with a TON of funny numbers) that declares your address in cyberspace. That address consists of four sets of numbers known as "octets," which define your location. The importance of the numbers is that they tell the world which routers to hop over to so your information can point directly back to you. Most connections are "ask/response" where the remote systems say, "Hey, can you tell me about hybrid cars?" And the location of that document starts with an IP address, then a document location, which then displays on your browser. So far, so good.

Let's number our local network now, shall we? You remember I mentioned that we have all these neat numbers that direct the Internet where to go to get the information from. Well, that network (the Internet!) is a PUBLIC network. That public network routes all the numbers around. So that our world can be protected, we can number our INTERNAL or local network using NON-routable numbers that only we can see. Since those numbers can't be routed over the Internet, you create this barrier separating the local and Internet. These numbers are designated as follows:

Class A -- 10.0.0.0 - 10.255.255.255
Class B -- 172.16.0.0 - 172.31.255.255
Class C -- 192.168.0.0 - 192.168.255.255

The Class A number, which is ANYTHING with a 10 DOT in the address, gives your internal network MILLIONS of possibilities internally for numbering. OK -- WOW -- but with MILLIONS of possibilities, I still need to ROUTE that info around my internal network. The Class B and Class C local networks are far easier to manage, and they still offer the same NON-routable protections.

More information

Why have different numbers?
Our office systems have these sophisticated devices called firewalls. These systems BREAK the connection between the outside world and your safe cozy office. That ability to interrupt the connection from outside world to the inside world is a translation (Network Address Translation or NAT) from the outside to the inside. This conserves the Internet's addresses and protects your internal network from people on the outside. Wow! You're doing all that by simply numbering things.

But wait -- there's more! Let's organize them as well. My office at headquarters is huge, but we just got a remote office in Cleveland. Now what? From my internal address scheme, we can CHANGE one of the octets and send traffic to AND from the remote office rather efficiently. So the local office is 172.16.1.1, and the remote office is 172.16.2.1. Need more? The 172 private addresses allow for that, so 172.16.0.0 is your local office and your office in Cleveland would be 172.17.0.0. The routers know to send this to the remote office because they will be programmed to say, "If it's addressed outside this scheme, send it my way."

Be sure to set the proper "Sub-Net" mask so that your TCP/IP traffic is routed properly. For Class A networks, the minimum setting for the Sub-Net mask is "255.0.0.0", for Class B networks, the minimum setting is "255.255.0.0", and for Class C networks, the minimum setting is "255.255.255.0" -- the 0's are where the network resides. These can be calculated even further down, limiting how the networks are configured and route the communications within that particular segment. A neat trick is to treat your Class A network as a Class C network and segment accordingly.

These numbers are discussed in detail within documents on the Internet called "Request For Comments" (RFCs) in document number 1918. A copy of that can be seen at http://www.faqs.org/rfcs/rfc1918.html. All RFCs are searchable at http://www.faqs.org/rfcs/.

You can also use a "switch" inside your networks instead of a "hub" to route traffic INTERNALLY within your local office. Switches are intelligent devices that figure out where the addresses are and send ONLY the information to and from that device when requested. So, you ask for information from your AS/400 or iSeries, it figures out where THAT system is within the switch, and points your request to it, speeding up your network.

Now let's get lazy!
What helps you manage this within the OS/400 is software that gives each system connecting to your network its own number (if configured to receive it, that is) instead of your having to assign IP addresses to each system. Dynamic Host Configuration Protocol (DHCP) is a GREAT way to let the computers do the thinking for us. (By the way, this software is BUILT INTO OS/400.) You can declare lots of things, such as gateways, name servers, etc., which then get programmed into your systems when they plug into your network and ask for a connection. That also means, however, that if ANYONE plugs their computers into a network port and their PC "requests" a number, it will assign one.

Please consider your security implications before utilizing this sort of scheme. Assigning these configurations to PCs within your network is time-consuming, and changing them is also time-consuming, but it prevents outsiders from just "plugging in" and hacking within your networks. True, with some knowledge they can walk over to an existing workstation and figure out this scheme or utilize scanners to figure out the scheme, so you're merely slowing those ruffians down, not stopping them completely. Thorough password protection and proper security considerations minimize this threat to your network.

Let's set our clock
As of V5R1, OS/400 has the ability to set the clock on the system to the thousands of a second. This is called Simple Network Time Protocol (SNTP), which you can read gobs about at http://www.faqs.org/rfcs/rfc2030.html. SNTP simply looks at a designated time server and sets itself accordingly to the thousands of a second accuracy. WOW!

Name serving and other OS/400 servers
OS/400 comes from the factory with name serving, e-mail serving and receiving, PC file serving, and many more servers BUILT IN. If you have any questions about these other neato, coolie wow servers, let me know, and I'll answer them as best as I can -- OR I can write a whole article about them. But understand that ALL have their roots in the RFCs where the real understanding of the protocols can be found.

It's not all so serious
I've been citing all these neat RFCs that are SOO serious and boring. Well, not all of them are. Look at RFC1149 to understand TCP/IP Avian protocols. It details wrapping the pigeon's legs with each TCP/IP packet and routing the information -- or the new HTCPCP. Or look at the Hyper Text Coffee Pot Control Protocol. I never knew about that! When will the OS/400 support THOSE RFCs? I thought this system was TCP/IP-compliant!

Let me know what else you want to see
There are TONS of TCP/IP tools within OS/400. Let me know what you want to see, and I'll detail that technology in a future article. Until then, this is the Lazy Coder, putting his feet up and taking a nap . . .

-----------------------------------------
About the author: Andrew Borts is webmaster at United Auto Insurance Group in North Miami, Fla. He is often a frequent speaker at COMMON and is past president of The Southern National Users Group, an iSeries-AS/400 user group based in Deerfield Beach, Fla.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
iSeries programmer tips
What is an integrated database?
An automated CL method of moving a query from AS/400 to Excel
Using SQL on System i to create multicolored comment lines
Eight steps for creating program documentation using AS/400 utilities
DAYSPAST CLLE program for AS/400: Compares object creation date with today's date
Coloring source lines with COBOL and using a shortcut from within PDM
Date calculation commands for AS/400
There is very little RPG on System i can't do: From RPG nay to RPG yay!
Using SQL on System i to color source code and inline comments
Controlling spool files with APIs

Application Development
iSeries calling an .exe
Top 10 programmer tips
Formatted work job scheduler
Convert system date and time
Mixing free format code with embedded SQL
SQL update a field in one file from a field in another file
Webcasts for iSeries programmers
Programming advice from the pros
Easy code copying via the drag and drop method
Setting FTP time-outs

PC/Windows Connectivity
CA Express utility helps you manage SSL certificates
Windows XP SP2 causes problem for iSeries Access
Top 10 tips from our experts
The registration facility helps you tailor your system -- Part II
20 FTP tips in 20 minutes
Are your terminal sessions secure?
Top advice on connecting to the iSeries
Fast guide to PC/Windows connectivity resources
The Lazy Coder: Find your iSeries using a DNS or name server
Automatically check FTP process for errors

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.

HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 1999 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts