A
A
Alzasr2015-06-23 09:54:56
linux
Alzasr, 2015-06-23 09:54:56

iptables rules not working. Where is the mistake?

I'm trying to set up iptables.

[email protected]:~# iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
DROP       22   --  0.0.0.0/0            0.0.0.0/0

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

I'm watching this through ssh connected to port 22, i.e. the rules don't work. Where did I go wrong?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
H
Heizenberg, 2015-06-23
@Alzasr

sudo iptables -A INPUT -p tcp -d 192.168.1.200 --dport 22 -j DROP
instead of 192.168.1.200 is your IP

K
krypt3r, 2015-06-23
@krypt3r

I'm no iptables guru but try REJECT instead of DROP

Z
Zzzz9, 2015-06-23
@Zzzz9

I would like to see the rules, otherwise INPUT (policy ACCEPT), who drops what, is not clear.

R
Reechart, 2015-06-23
@Reechart

I recommend dropping either by destination IP or by incoming interface

S
Sergey, 2015-06-26
@Yestestvenno

If this is centos, then try to configure 1 any rule through the SETUP command and then edit (I noticed such a bug in 6.5) also in version 7 there is a new crap that acts as a filter (disable or configure)
PS to restart, do not use restart better service iptables stop, service iptables start

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question