Friday, August 12, 2011

How to open port on Linux

Open port 8080
Open flle /etc/sysconfig/iptables:
# vi /etc/sysconfig/iptables


Append rule as follows:
#iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

Save and close the file. Restart iptables:
# /etc/init.d/iptables restart
Open port 8080 that port is open Run following command:

netstat -tulpn | less
Make sure iptables is allowing port 8080
iptables -L -n

Refer to iptables man page for more information about iptables usage and syntax:
man iptables
Since you should not give up your firewall, you will have to add a rule to open this port.

Do:
cd /etc/sysconfig
cp iptables iptables.save_it
vi iptables

You will find lines like this:

Enter a line right behind this to open port 8080:

#iptables -A INPUT -p tcp -m tcp --dport 8080 --syn -j ACCEPT

Save it and restart the service "iptables" as described above and your port 8080 will work.


https://help.ubuntu.com/community/IptablesHowTo

No comments:

Post a Comment