24
Mon, Jun
3 New Articles

Putting the i(Series) in TCP/IP

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

IBM introduced TCP/IP protocol on the AS/400 with OS/400 V3R2. Still today, however, this protocol remains underutilized even though many iSeries TCP/IP applications have been added, including a Dynamic Host Configuration Protocol (DHCP) server and a Domain Name System (DNS) server. Today, the iSeries supports many TCP/IP applications you may not be aware of. In this article, we'll look at some of these applications and explore how to make the most of TCP/IP.

Your TCP/IP Configuration

Before we examine the TCP/IP "goodies," let's look at some of the components of your TCP/IP configuration. Navigate to the Configure TCP/IP menu by typing the command CFGTCP. Figure 1 shows the menu that is displayed.

http://www.mcpressonline.com/articles/images/2002/tcpip--091304--V400.png

Figure 1: This menu contains the options to configure TCP/IP. (Click images to enlarge.)

Option 1 displays the Work with TCP/IP Interfaces display, which is used to configure options related to each interface. When you modify interfaces through this display, you'll see the screen shown in Figure 2.

http://www.mcpressonline.com/articles/images/2002/tcpip--091304--V401.png

Figure 2: Use this screen to modify a TCP/IP interface.

On this screen, the Line Description can contain either the name of a previously created line description or special values *VIRTUALIP, *OPC, or *LOOPBACK. One unusual capability when creating a TCP/IP interface on the iSeries is that you can define two unique IP addresses to a single Ethernet adapter. This means that you can actually have your iSeries accessible to two distinct and separate subnets. Figure 3 illustrates this using the Work with TCP/IP Interfaces display.

http://www.mcpressonline.com/articles/images/2002/tcpip--091304--V402.png

Figure 3: A single iSeries Ethernet line can be assigned multiple IP addresses.

Notice that IP addresses 90.0.0.3 and 192.168.50.11 are both assigned to line ETHLINE. Based on the subnet masking shown, an IP address in the range of 90.0.0.1 through 90.254.254.254 will be able to access the system through address 90.0.0.3. Again, based on the subnet mask defined, any computer with an IP address in the range of 192.168.50.1 through 192.168.50.254 will have access to the system through IP address 192.168.50.11. Option 2 on this menu defines TCP/IP routes to other networks. If, for example, your iSeries existed on a TCP/IP network 192.168.50.0 with a subnet mask of 255.255.255.0 and you needed to give iSeries access to a network 192.168.51.0 with a subnet mask of 255.255.255.0, which is accessed through a router with an IP address of 192.168.50.254, you would use the ADDTCPRTE command to add a route for this network:

ADDTCPRTE RTEDEST('192.168.51.0')    
          SUBNETMASK('255.255.255.0')
          NEXTHOP('192.168.50.254')  

Alternatively, if the iSeries was in TCP/IP network 192.168.50.0 with a proxy server at IP address 192.168.50.1, you could configure the iSeries to allow Internet access by creating a default route using this command:

ADDTCPRTE RTEDEST('*DFTROUTE')    
          SUBNETMASK('*NONE')     
          NEXTHOP('192.168.50.1')  

TCP/IP port restrictions are defined through option 4 on the CFGTCP menu. You can use this screen to restrict access to specific TCP/IP services by user. Figure 4 shows the Work with TCP/IP Port Restrictions display.

http://www.mcpressonline.com/articles/images/2002/tcpip--091304--V403.png

Figure 4: With port restrictions, you can control access to a specific TCP/IP application.

You can specify a lower and upper port number as well as whether the application is TCP or UDP protocol. If a port restriction is created for a given port or range of ports, only the user specified will have access to the defined port or ports. In the example above, the user MFAUST will be the only one with access to ports 20 and 21, which are generally used for the FTP service. This leads us to the topic of TCP/IP applications.

iSeries TCP/IP Applications

The iSeries has a complete set of standard TCP/IP applications, yet I'm constantly amazed by how underutilized those applications are in most iSeries shops. The following table contains a list of the standard TCP/IP applications on the iSeries. Many of these applications will look familiar. Others may not.

Service/Application
Description
FTP
File Transfer Protocol. Used to send and receive files to and from an iSeries.
TELNET
Terminal emulation protocol used to log into the iSeries or remote systems.
HTTP
Hypertext Transfer Protocol. Used by Internet browser-based applications.
DNS
Domain Name Service. Used to keep track of server names and associated IP addresses.
DHCP
Dynamic Host Configuration Protocol. Used to automatically configure TCP/IP network clients based on parameters defined on the DHCP server.
POP
Post Office Protocol. Used to retrieve email from an Internet mail server.
SNMP
Simple Network Management Protocol. Allows TCP/IP-based devices (computers, printers, routers) to be monitored using a single protocol.
SMTP
Simple Mail Transfer Protocol. Also used for email purposes, generally used to send messages to an Internet mail server.
REXEC
Remote execution command protocol. Allows commands to be issued from a client to execute on the server.
BOOTP
Bootstrap Protocol. Similar to DHCP. Used to assign IP addresses to network-connected devices.
LPD
Line Printer Daemon protocol. The TCP/IP standard for sending data to a network-connected printer within a TCP/IP network.

FTP

FTP is commonly used to download files from Internet Web sites. What you may not know is that you can also use FTP to execute commands and call programs on the iSeries. This is extremely useful when you want to create a process that will run a program on the iSeries to create a data file to be downloaded. Here's an example:

open 192.168.50.11
mfaust
secret
quot RCMD ADDLIBLE QTEMP
quot RCMD ADDLIBLE MYLIB
quot RCMD CALL BLDFTPDTA
get ftpfile.ftpmbr ftpfile.txt
quit

This sample FTP script starts by connecting to the system at IP address 192.168.50.11. The next two lines send the user name and password to be used to log into the system. Next, the FTP command QUOT is used with the ADDLIBLE command to add any required libraries to the current FTP session's library list. The QUOT FTP command allows us to run OS/400 commands from an FTP session. The FTP session works much like a Client Access 5250 session or Telnet session in that, when you log in, your session receives a default library list that is currently defined on the QFTP job description. Any libraries added to this library list (as in the example) will remain in the session library list until the session is logged out or ended. The next command in the script again uses the QUOT command to execute the command CALL BLDFTPDTA, which would be a program to build the data to be downloaded. Then, the FTP command "get ftpfile.ftpmbr ftpfile.txt" retrieves the contents of the physical file named ftpfile with the physical file member named ftpmbr into the PC file ftpfile.txt. Finally, the quit command ends the FTP session.

This technique could be modified slightly to send data to the iSeries and then run a program to process the data sent. This would be done by first replacing the "get" command with a "send ftpfile.txt ftpfile.ftpmbr" command and then moving the QUOT CALL command to after the new send command. You can execute this script from a Windows-based PC client by using the FTP command's –S option:

FTP –S c:myftpscp.scp

Telnet

Telnet protocol is used by within the Personal Communications portion of iSeries Access for Windows for terminal emulation purposes. What you may not realize is that most other terminal emulators will also allow you to access an interactive display session on the iSeries. To do this from a Windows workstation, simply go to a command prompt and type this:

TELNET 192.168.50.11

When this statement is executed, a connection will be attempted to the specified IP. Since the destination system is an iSeries, an iSeries sign-on screen will be displayed for this IP address (Figure 5).

http://www.mcpressonline.com/articles/images/2002/tcpip--091304--V404.png

Figure 5: A sign-on display from a Telnet session looks like this.

The drawback to using the Windows Telnet client for this type of connection is that the keyboard mapping does not conform to iSeries standards. This means that function keys and other control keys have to be sent using unusual key sequences. "Roll up," for example, is achieved by pressing CTRL+U, while CTRL+D is "Roll down." The current key mapping info can be viewed via the DSPVTMAP command when signed into the iSeries from a VT100 Telnet client. The following table shows the standard keyboard mappings.

Standard Keyboard Mappings
5250 Function
VT Key(s)
5250 Function
VT Key(s)
5250 Attention
CTRL-A or ESC+A
Redraw Screen
CTRL-L or ESC+L
5250 Help
CTRL-? Or ESC+H
F1
ESC-1 or F1
Page Down (Roll Up)
CTRL-D or CTRL-F
F2
ESC-2 or F2
Page Up (Roll Down)
CTRL-B or CTRL-U
F3
ESC-3 or F3
System Request
CTRL-C or ESC+S
F4
ESC-4 or F4
Insert
ESC+I or ESC+DEL or INSERT
F5
ESC-5
Delete
DEL
F6
ESC-6
Enter
RETURN
F7
ESC-7
Backspace
BACKSPC
F8
ESC-8
Duplicate
ESC+D
F9
ESC-9
Erase Input
CTRL-E
F10
ESC-0
Error Reset
CTRL-R or ESC+R
F11
ESC--
Field Exit
CTRL-K or CTRL-X or ESC+X
F12
ESC-=
Field Minus
ESC+M
F13
ESC-!
Home
CTRL-O
F14
ESC-@
New Line
ESC+Line Feed
F15
ESC-#
Print
CTRL-P or ESC+P
F16
ESC-$
Field Advance
TAB
F17
ESC-%
Field Backspace
ESC+TAB
F18
ESC-^
Cursor Up
Up arrow
F19
ESC-&
Cursor Down
Down Arroe
F20
ESC-*
Cursor Left
Left Arrow
F21
ESC-(
Cursor Right
Right Arrow
F22
ESC-)
Clear Screen
ESC+C
F23
ESC-_
Test Request
CTRL-T
F24
ESC-+
Toggle Indicator Lights
ESC+T



Despite the keyboard mapping issue, this can be useful when you need to access the iSeries from a PC that doesn't have iSeries Access for Windows installed. Since most "non-Windows" operating systems include a Telnet client, this can also be an option for accessing an iSeries from a machine running Linux or UNIX.

HTTP

HTTP is used by WebSphere and the other iSeries Web server options (Apache, Tomcat, etc.). This has become one of the more commonly used iSeries TCP/IP components, and with good reason. The universal appeal of Web browser interfaces in addition to the multitude of options now available for developing HTTP browser-based applications on the iSeries make this a great alternative for developing iSeries applications. Conveniently, the iSeries includes an administrative console that is (ironically enough) browser-based. You can access this application from your Web browser through port 2001 by navigating to http://xxx.xxx.xxx.xxx:2001/, where xxx.xxx.xxx.xxx represents the IP address of your iSeries. Figure 6 shows the browser-based admin tool for the iSeries Web server.

http://www.mcpressonline.com/articles/images/2002/tcpip--091304--V405.png

Figure 6: This is the browser-based HTTP admin console.

From this console, you can configure Web servers as well as start and stop individual server instances.

LPD

LPD servers not only allow iSeries printers to be accessed from a TCP/IP client, but also allow the iSeries to access any network-connected, TCP/IP-enabled printer, including printers connected through general-purpose interface boxes like the HP Jetdirect printer server boxes. When configuring these devices, you have two separate options: creating a *LAN device description for the printer or creating a remote output queue. To configure a device description as *LAN, the print server must support either IBM or HP Printer Job Languages (PJL) by defining the System Driver Program (SYSDRVPGM) parameter as either *IBMPJLDRV or *HPPJLDRV on the CRTDEVPRT command. Here's an example:

CRTDEVPRT DEVD(LDPPRT01) DEVCLS(*LAN) TYPE(3812) MODEL(1)    
     LANATTACH(*IP) PORT(9100) FONT(11)                  
     TRANSFORM(*YES) MFRTYPMDL(*HPPCL6) 
     RMTLOCNAME('192.168.50.1')    

This command creates a printer device description for a LAN-attached HP/PCL6-compatible IP printer named LPDPRT01 at IP address 192.168.50.1. Older print server devices that do not support either of these options can also be used for iSeries printing by using the CRTOUTQ command:

CRTOUTQ OUTQ(RMTQUENAME) RMTSYS(*INTNETADR) RMTPRTQ(PR1)  
        CNNTYPE(*IP) DESTTYPE(*OTHER) MFRTYPMDL(*HPLJIII)     
        INTNETADR('192.168.50.99')

Replace RMTQUENAME with a name identifying your printer and replace 192.168.50.99 with the IP address of your printer. You can also use the MFRTYPMDL parameter to define the manufacturer type and model number of the printer being defined. And you can use the RMTPRTQ option to define the name of the specific port to which the printer is connected in the case of multi-port printer servers. With this option, you can also specify a shared printer name when connecting to a printer on an iSeries or Windows printer server. This is where using the iSeries as a TCP/IP printer server comes into play. For example, you can send a text file from a Windows-based PC to an iSeries printer using this LPR command:

LPR MYFILE.TXT –S xxx.xxx.xxx.xxx –P prtdevname

Here, xxx.xxx.xxx.xxx represents the iSeries IP address and prtdevname represents the printer device description on the iSeries. You can also create an LPR port that points to an iSeries printer from a Windows-based PC. To add a generic text printer using this method, go to the Windows control panel and select Add Printer. When the wizard is displayed, click Next and identify that you are installing a local printer. (This may not make sense, but Windows looks at an LPR printer device as a local printer port, not a network printer.) Then, select the Create a New Port radio button and choose the LPR Port option from the drop-down box. You'll see the dialog shown in Figure 7.

http://www.mcpressonline.com/articles/images/2002/tcpip--091304--V406.png

Figure 7: Use this dialog when adding an LPR port to the iSeries in Windows.

On this dialog, the first box defines the IP address of your iSeries. The second box identifies the name of the device description for the corresponding iSeries printer. Click OK, and the wizard will prompt you for the device manufacturer's name and model. After you select the appropriate printer from the provided list, your new printer will be installed.

SMTP

The iSeries also has the ability to send Internet email messages using SMTP. The configuration requirements are minimal and begin with using the CHGSMTPA command:

CHGSMTPA MAILROUTER('192.168.50.3')

The IP address shown represents the IP address of the server used to relay Internet email messages on your network. Next, use the ADDDIRE command to create a gateway for sending messages to the mail server:

ADDDIRE USRID(INTERNET GATEWAY) USRD('Context switching entry')  SYSNAME(TCPIP) MSFSRVLVL(*USRIDX) PREFADR(NETUSRID *IBM ATCONTXT)

Finally, use the CHGDSTA command to define the route to your SMTP server:

CHGDSTA SMTPRTE(INTERNET GATEWAY)

This command uses the previously created directory entry as the route for any SMTP email messages. Once you've made these configuration changes, you can send messages using the SNDDST command:

SNDDST TYPE(*LMSG) TOINTNET((This email address is being protected from spambots. You need JavaScript enabled to view it.')) 
       DSTD('Test SMTP Message')                             
       LONGMSG('This is a test message to illustrate how easy 
                it is to configure the iSeries for sending  
                SMTP Internet mail messages.')               

After you replace the sample email address with a valid Internet email address, the message is sent to the desired recipient.

For more information on using the iSeries for SMTP, see The iSeries and AS/400 Programmer's Guide to Cool Things.

These are just a few examples of the powerful TCP/IP-based applications available. In addition to these canned applications, you can create your own custom IP-enabled applications using the iSeries Socket APIs. When you consider all of the IP options available, it's easy to see why IBM put the i(Series) in TCP/IP.

Mike Faust is an Application Programmer for Fidelity Integrated Financial Solutions in Maitland, Florida. Mike is also the author of the books The iSeries and AS/400 Programmer's Guide to Cool Things and Active Server Pages Primer. You can contact Mike at This email address is being protected from spambots. You need JavaScript enabled to view it..


Mike Faust

Mike Faust is a senior consultant/analyst for Retail Technologies Corporation in Orlando, Florida. Mike is also the author of the books Active Server Pages Primer, The iSeries and AS/400 Programmer's Guide to Cool Things, JavaScript for the Business Developer, and SQL Built-in Functions and Stored Procedures. You can contact Mike at This email address is being protected from spambots. You need JavaScript enabled to view it..


MC Press books written by Mike Faust available now on the MC Press Bookstore.

Active Server Pages Primer Active Server Pages Primer
Learn how to make the most of ASP while creating a fully functional ASP "shopping cart" application.
List Price $79.00

Now On Sale

JavaScript for the Business Developer JavaScript for the Business Developer
Learn how JavaScript can help you create dynamic business applications with Web browser interfaces.
List Price $44.95

Now On Sale

SQL Built-in Functions and Stored Procedures SQL Built-in Functions and Stored Procedures
Unleash the full power of SQL with these highly useful tools.
List Price $49.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: