Login as root, then
iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
This code open a tcp 80 port for the machine. For udp try
-p udp -m udp
Do not forget to save the work by iptables-save