firewall-cmdcommand as shown below. We will also discuss how to check open ports remotely with the
In this tutorial you will learn:
- How to check open ports on RHEL 8.
- How to check services on RHEL 8.
- How to check open ports remotely using
- How to list open ports and service with
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||RHEL 8 / CentOS 8|
|Other||Privileged access to your Linux system as root or via the |
|Conventions|| # - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
How to check open ports on RHEL 8 / CentOS 8 Linux step by step instructions
When checking for open firewall ports on RHEL 8 / CentOS 8 Linux it is important to know that firewall ports can be opened in two main different ways. Firstly, the firewall port can be opened as part of a pre-configured service. For example:
# firewall-cmd --zone=public --permanent --add-service=httpSecondly, the ports can be open directly as custom user predefined ports. Example:
# firewall-cmd --permanent --add-port 8080/tcp
- Check service ports opened:
# firewall-cmd --list-services cockpit dhcpv6-client http https sshThe above services have their relevant ports open.
- Check for ports opened:
# firewall-cmd --list-ports 20/tcp 8080/tcpThe above ports, namely
8080are open for incoming traffic.
- Check for all open ports and services:
# firewall-cmd --list-all
- Lastly you can get a precise overview of all open ports by the
nmapcommand for any remote Linux host. For example the below
nmapcommand will probe 1000 most commonly used ports:
$ nmap rhel8 Host is up (0.78s latency). Not shown: 994 filtered ports PORT STATE SERVICE 20/tcp closed ftp-data 22/tcp open ssh 80/tcp open http 443/tcp closed https 8080/tcp closed http-proxy 9090/tcp closed zeus-adminPlease note that
closedmeans that the firewall port is open, however, the underlining service on the actual RHEL 8 / CentOS 8 server is not running. It is also possible to check for a specific port. For example:
$ nmap -p 80 rhel8 PORT STATE SERVICE 80/tcp open http
nmapcommand usage examples.