Howto Open Port Range In iptables Firewall

FREQUENTLY ASKED QUESTIONS (Firewall/iptables)
Q: How to open a port range in iptables firewall?


Opening a port range in iptables firewall for example open TCP ports40 to port 50. Run the below commands from terminal as root user.


Open a Port Range in iptables
[root@server~]# iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 40:50 -j ACCEPT


[root@server ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]

[root@server ~]# service iptables restart
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]



Test the Opened ports
Check the opened ports by connecting to appropriate ports of the server. And also check all the changes are written to the iptables configuration file located in  etc/sysconfig/iptables
[root@server ~]# cat /etc/sysconfig/iptables 

Sample output displayed below


None


Check Related Posts:

Was this helpfull ?

0 comments:

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons