How do I open custom ports in my iptables firewall? [closed]

I need IPTables, like everyone else, but I don't use it enough to really keep my knowledge complete and fresh.

The setup utility in CentOS is too basic. It doesn't seem to allow me to open up custom ports, just standard ones.

I need a text-based way to open up custom ports in my firewall. What should I do?


Solution 1:

system-config-firewall-tui is the "stock" text-based firewall configuration tool for RHEL/CentOS. It is perfectly capable of opening custom ports.

Press Tab until you reach Customize on the first screen. enter image description here

Then hit Tab until you reach Forward to skip the list of standard ports. enter image description here

Then hit Tab until you reach Add, then press Enter. enter image description here

Then enter the port (e.g. 5900) and protocol (e.g. tcp) and press Enter. enter image description here

When done adding ports, hit Tab until you reach Close. enter image description here

Finally, hit Tab until you reach OK. Your firewall is now saved. enter image description here