05-04-2010, 11:06 AM
Heres a few examples regarding blocking ports and port ranges (you can use whatever chain you want, im using input as an example):
# iptables -A INPUT -p UDP --destination-port 7777:9000 -j DROP
^block ports on UDP ports 7777 to 9000
# iptables -D INPUT -p UDP --destination-port 7777:9000 -j DROP
^unblock those previously blocked ports (-D = delete the rule in the INPUT chain)
# service iptables (start/stop/restart/status)
^self explanatory, status is useful with grep when you have a long list of rules
I can provide more if needed.
# iptables -A INPUT -p UDP --destination-port 7777:9000 -j DROP
^block ports on UDP ports 7777 to 9000
# iptables -D INPUT -p UDP --destination-port 7777:9000 -j DROP
^unblock those previously blocked ports (-D = delete the rule in the INPUT chain)
# service iptables (start/stop/restart/status)
^self explanatory, status is useful with grep when you have a long list of rules
I can provide more if needed.