1830231 Members
1704 Online
109999 Solutions
New Discussion

Re: How to open port?

 
SOLVED
Go to solution
OB_1
Occasional Contributor

How to open port?

hello,

I need to open ports 8005 and 8081 on my Red hat box. These ports will be used by Tomcat web server 4.0.6.

Please advise how to open these ports.

Thanks in advance
7 REPLIES 7
Huc_1
Honored Contributor

Re: How to open port?

You can use ipchains or iptables to setup ports

/etc/services is where the various port(s) <> number(s) are found

ipchains or iptables are started in respectively /etc/init.d/ipchains and /etc/init.d/iptables

theses use config file found respectively
/etc/sysconfig/iptables-config
and
/etc/sysconfig/ipchains-config

in ipchains this would open port 22 (ssh)

-A input -s 0/0 -d 0/0 22 -p tcp -y -j ACCEPT

any how have a look at man iptables
and for more info try link
http://www.groovyweb.uklinux.net/?page_name=Linux%20firewall%20Iptables%20Basics%20NHF

J-P
Smile I will feel the difference
Steven E. Protter
Exalted Contributor

Re: How to open port?

Huc, congrats on your hat.

You'll also need entries in /etc/services to reserve those ports for you application.

To make sure you have access control, the iptables/ipchains data is extremely important.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Huc_1
Honored Contributor

Re: How to open port?

Thanks, SEP You are the first to congratulated me I am touched... Keep looking at this new hat.. very pleased realy !

Ouadi, please forgive this Highjack of this post

J-P
Smile I will feel the difference
OB_1
Occasional Contributor

Re: How to open port?

Hello again,


Thanks for your feedback.
I had a look on iptables help but it seems too complicated for me.

Would anyone be kind enough to give me the exact syntax for iptables ?

Many thanks
Andrew Bruce
Valued Contributor

Re: How to open port?

Hi,

Working with IPTables/Chains, etc is not straight forward - I don't understand them properly, but that's not saying much!

I can recommend a firewall package called Shorewall (http://shorewall.sourceforge.net/). I happened across it the other week and it has two wonderful features:

1. It is documented extremely well
2. It is easy to configure.

Inline with the earlier responses, set up your ports in /etc/services and start using them.

Just make sure you have *some* kind of firewall configured to allow the appropriate connections!

Regards,

Andy Bruce
I Love it when a plan comes together!
U.SivaKumar_2
Honored Contributor
Solution

Re: How to open port?

Hi,

First of all . Are you Firewall in this Red Hat Box ?.

Paste the output of this command.

#iptables -L

Look for any DROP or REJECT rules.

If you have a firewall with strict DROP rule , then you will have to open those ports in the firewall.

#iptables -I INPUT -p tcp --dport 8005 -j ACCEPT

#iptables -I INPUT -p tcp --dport 8081 -j ACCEPT

#service iptables save

Install tomcat and start the tomcat service.

Thats it.

regards,

U.SivaKumar.




Innovations are made when conventions are broken
Huc_1
Honored Contributor

Re: How to open port?

If you are running a firewall it could also be
ipchains, in this case as root do

ipchains -L

ipchains is less used nowdays because iptables is more "pwerfull/flexible", so go for iptables, using U.SivaKumar example would be a better option.

I try the link Andy Bruce gave us but this returned an error so after searching i found this link http://www.shorewall.net/

I am reading the shorewall doc now ... very nice!

J-P
Smile I will feel the difference