A web application running on CentOS 7 (app server) in a private LAN needs to make database connections to another CentOS 7 server (database server) running on the same private LAN.
When I type
systemctl stop firewalld on the app server, the database connections to the remote database server work perfectly. But when I type
systemctl start firewalld on the same application server, the web application is no longer able to connect to the remote database server.
This tells me that I need to create an outbound firewalld rule on the application server. But that would require knowing what port needs to be used for the outbound connections.
What specific commands can be used to determine which port is being used in the application server to make remote connections to the database server?