0

I'm trying to add port 7777/udp to iptables on CentOS 7.

The command I use is:

iptables -t filter -I INPUT -p udp --dport 7777 -j ACCEPT
iptables -t filter -I INPUT -p udp --dport 27015 -j ACCEPT
iptables -t filter -I INPUT -p tcp --dport 27020 -j ACCEPT

But no matter what, the port is not addded.

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:27020
ACCEPT     udp  --  anywhere             anywhere             udp dpt:27015
ACCEPT     udp  --  anywhere             anywhere             udp dpt:interwise
ACCEPT     udp  --  anywhere             anywhere             udp dpt:cbt

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

The two ports listed are created in the same script and are regularly added. Why these two port are OK but 7777 is not?

Thanks in advance for your help!

4
  • 2
    Are either interwise or cbt equal to 7777 by any chance?
    – Celada
    Feb 22, 2017 at 20:55
  • I have no idea, I did not add the last two. How can I check?
    – GigiSan
    Feb 22, 2017 at 20:56
  • A quick search on Google yielded cbt = 7777. So I assume the name is just encoded when I add 7777?
    – GigiSan
    Feb 22, 2017 at 20:58
  • 1
    The output of iptables-save might be better for debugging (or restoring the firewall rules).
    – thrig
    Feb 22, 2017 at 21:04

1 Answer 1

2

first view the iptables properly using the command :-

iptables -L -n

-n will show port number instead of service associated with that port. This will clear things. use echo $? if iptables command is not showing any error. The result is zero means command is running fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .