M
M
Minusator2017-07-26 16:05:40
CentOS
Minusator, 2017-07-26 16:05:40

How to create such a rule for iptables Centos 7?

Good day!
How to allow connection on port 22 on centos 7 server, for example from subnet 0.0.0.0/24?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Chuev, 2017-07-26
@Minusator

iptables -A INPUT -p tcp --dport 22 -s 0.0.0.0/24 -j ACCEPT

You can also deny the connection to everyone except from the subnet:
iptables -A INPUT -p tcp --dport 22 -s !0.0.0.0/24 -j DROP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question