Question: How do I open and close ports with an iptables firewall setup? Answer: You can easily open ports on a dedicated server with these simply commands. Depending on whether you need to open a UDP or TCP port, use one or both of the following: iptables -A INUPT -p …