Recently I stumbled upon a problem of opening a port in firewall in SuSE Linux. I did follow the steps mentioned in https://www.digitalocean.com/community/tutorials/iptables-essentials-common-firewall-rules-and-commands. The problem is that once you start the firewall service, the rules set using iptables are gone. No new SSH connections are allowed. Thankfully the existing SSH connection was active. I was searching for iptables-save command in SuSE Linux to save this iptables configuration. But there is no such command.
To open a port in firewall in SuSE Linux, there are 2 steps. One is to use YaST. The other is to modify /etc/sysconfig/SuSEfirewall2 file.
As I was using ssh to connect to the linux box, I had to use the 2nd option of modifying /etc/sysconfig/SuSEfirewall2 file.
First we need to know the service that is listening on the port uses TCP or UDP. If the service is TCP, we need to find FW_SERVICES_EXT_TCP property in the file. If it is UDP, we need to find FW_SERVICES_EXT_UDP property in the file.
Then we need to insert the port number that we need to open in the firewall.
Assume the existing property looks like this:
FW_SERVICES_EXT_TCP = "61491 61492"
If we need to open port 5000, the property need to be changed as:
FW_SERVICES_EXT_TCP = "61491 61492 50000"
FW_SERVICES_EXT_TCP = "50000 61491 61492" - This would be the final configuration.
References: