How to open port 2195 in iptables CentOS 6 for activating the APNS
Asked Answered
B

4

21

I tried this solution:

iptables -I OUTPUT -p tcp --dport 2195 -j ACCEPT
/etc/init.d/iptables stop
/etc/init.d/iptables start

but still can't access the port.

If there are more ports that I have to open for APNS let me know.

Brothers answered 28/11, 2012 at 13:47 Comment(0)
H
44

How about:

iptables -A INPUT -p tcp --dport 2195 -j ACCEPT
service iptables restart

This may help too.

Hatley answered 28/11, 2012 at 15:5 Comment(2)
Just followed this tutorial: raywenderlich.com/3443/…Brothers
"iptables -A INPUT -p tcp --dport 2195 -j ACCEPT" There is a extra hyphen in dport.Skate
I
8

It didn't work for me completely, since my last rule was DROP ALL which basically negated all I added to iptables after.

It might be useful to use the -I switch:

iptables -I INPUT 1 -p tcp --dport 2195 -j ACCEPT

The INPUT 1 - means 1st Input rule instead of appending, to put rule in front of drop all

Ioannina answered 6/1, 2016 at 23:45 Comment(1)
This fixed my issue - thanks. NOTE: the command ends with the ACCEPT - the 1 following that above is commentary about the '1' that follows the 'INPUT'.Amarillo
I
7

See my anwser here: https://mcmap.net/q/156127/-how-can-i-use-iptables-on-centos-7-closed

For CentOS 7, you should use "firewall-cmd" command like so:

firewall-cmd --add-port=2195/tcp --permanent

iptables is not recommended if you use the firewalld service.

Indefeasible answered 30/11, 2015 at 14:40 Comment(0)
P
1

Try the following command, it worked for me:

$ sudo iptables -A INPUT -p tcp --jport 2195 -j ACCEPT

$ sudo /etc/init.d/iptables save

Pico answered 17/11, 2016 at 13:31 Comment(1)
/etc command should be executed after executing the before command.Pico

© 2022 - 2024 — McMap. All rights reserved.