PowerWire Logo
The trusted voice of the IBM Power community

Open Ports on IBM i

Open Ports on IBM i

In this article I will talk about another great open-source utility for our IBM i.

A couple of years ago I wrote an article on a great open-source utility called Service Command. It can be found at this link.

As part of this package, we have a command called SCOPENPORTS. I will show what a useful utility this is.

In the world of IBM i, managing services and jobs efficiently is crucial for maintaining system performance and security.

One tool that has gained popularity for its intuitive command-line interface is Service Commander.

Among its many features, the scopenports command stands out as a powerful utility for monitoring TCP/IP open ports on your system.

What is Service Commander?

Service Commander is a versatile tool designed to simplify the management of services and jobs on IBM i systems. It provides a range of commands to start, stop and monitor various services, making it an essential utility for system administrators.

Installing Service Commander

Firstly, we have to install Service Commander.

Service Commander is installed on your IBM i by using yum. From a shell session run the command listed below.

Bash

yum install service-commander
Bash

As with other open-source packages, you can install Service Commander using Open-Source Package Management from ACS.

Here you can see I have the Service Commander package installed.

A screenshot of a computer

Description automatically generated

Introducing the scopenports Command

The scopenports command is a constituent of Service Commander, which was introduced in version 0.7.0.

This command allows users to list all open ports on their IBM i system, providing valuable insights into network activity and potential security vulnerabilities.

Why Monitor Open Ports?

Monitoring open ports is essential for several reasons:

  1. Security: Identifying unexpected open ports can help detect potential security breaches or unauthorised services running on your system.
  2. Performance: Understanding which ports are in use can aid in troubleshooting network performance issues.
  3. Compliance: Regularly auditing open ports can ensure compliance with security policies and regulations.

How to Use scopenports

Using the scopenports command is straightforward, just enter scopenports on any TCP/IP shell session to your IBM i.

You can run it with or without the –mine option:

  • Without –mine: Running scopenports without any options will display all open ports on the system.
  • With –mine: Adding the –mine option will filter the results to show only the ports that your programs are listening on.

Here’s an example of how to use the command:

Bash

# List all open ports on the system
scopenports

# List only the ports my programs are listening on
scopenports --mine
Bash

The screen shot below shows all the jobs I am running.

Text

Description automatically generated

Conclusion

The scopenports command in Service Commander is a valuable tool for IBM i administrators.

By providing a clear view of open ports, it enhances your ability to manage network security and performance effectively.

Whether you’re troubleshooting an issue or conducting a routine audit, scopenports offers the insights you need to keep your system running smoothly.