How to open ports 50000 to 60000 on iptables and firewalld?

I have  a Centos 6.5 VPS with iptables and firewalld installed on it.
I know how to open single ports on both systems but what I don't know is how to open a range lik ports 50000 to 60000.

Please assist.

Thanks in advance.
badwolfffAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MazdajaiCommented:
Try:

[code]iptables -A INPUT -p tcp --match multiport --dports 50000:60000 -j ACCEPT[/code]
0
Zephyr ICTCloud ArchitectCommented:
For Firewalld:

firewall-cmd [--zone=<zone>] [--permanent] --add-port=port-port/tcp[udp]

Open in new window

example:
firewall-cmd --zone=public --permanent --add-port=50000-60000/tcp

Open in new window


For iptables it would be something like this:
iptables -A INPUT -p tcp --match multiport --dports 50000:60000 -j ACCEPT

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
badwolfffAuthor Commented:
Thank you both. Now for some clarification. While you guys were writing I had already formulated a centos shell command. Just need to verify with you guys if it is ok:

I need to open these ports:
INCOMING TCP:     80,443,3478,4873,5060,5222,7770,8010
OUTGOING TCP:    80,443,1022,8010,9000,9001
OUTGOING SDP:    50000:60000

OUTGOING PORTS
/sbin/iptables -A OUTPUT -p tcp --match multiport --sports 80,443,3478,4873,5060,5222,7770,8010 -j ACCEPT
/sbin/iptables -A OUTPUT -p udp --match multiport --sports 50000:60000 -j ACCEPT

ICOMING PORTS
/sbin/iptables -A INPUT -p tcp --match multiport --dports 80,443,1022,8010,9000,9001 -j ACCEPT

Open in new window



Is it ok for me to run these commands?
Do I need to run these two commands afterwards:
sudo iptables-restore < /etc/iptables.firewall.rules
/sbin/service iptables save

Open in new window




And lastly, how would I do the equivalent of this in shell for firewalld?

thanks
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

badwolfffAuthor Commented:
I just had a doubt... does firewalld even exist for centos 6? I was about to activate it on the server but it seems it only exists for centos 7
0
badwolfffAuthor Commented:
I found this tutorial... do you think I can use this with iptables? And is the tutorial good?

http://www.woktron.com/secure/knowledgebase/77/Installation-CSF-Firewall-on-CentOS-5-and-6.html
0
Zephyr ICTCloud ArchitectCommented:
Yes, Firewalld is the default from Redhat/Centos 7 now, you can still use iptables if you want to, have to disable the firewalld of course.

I don't know about CSF, haven't looked into it ...

The iptables is looking good I think...
0
MazdajaiCommented:
I just had a doubt... does firewalld even exist for centos 6? I was about to activate it on the server but it seems it only exists for centos 7

As far as I know it is the front end for 7 only.
 
sudo iptables-restore < /etc/iptables.firewall.rules
/sbin/service iptables save

Open in new window


You will also need 'sudo service iptables reload'.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.