I attempt to connect to SSH server at 192.168.0.1. 192.168.0.2 is the client computer. The command I use is
ssh -p1111 [email protected]
I get the error: connection refused. I have edited the config file to specify the same port in SSH. Below are my rules used in iptables. What should I do to make the connection work?
#!/bin/sh
iptables -F
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
iptables -A INPUT -p tcp --sport 1111 --src \
192.168.0.1 -j ACCEPT
iptables -A INPUT -p tcp --dport 1111 --dst \
192.168.0.2 -j ACCEPT
iptables -A INPUT -p tcp --sport 1111 --src \
192.168.0.2 -j ACCEPT
iptables -A INPUT -p tcp --dport 1111 --dst \
192.168.0.1 -j ACCEPT
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
iptables -A INPUT -f -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
iptables -A INPUT -m state --state INVALID -j LOG \
--log-level 4 --log-prefix 'InvalidDrop '
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m limit --limit 2/min -j LOG \
--log-level 4 --log-prefix 'In2/m '
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --sport 80 -j ACCEPT
iptables -A INPUT -p tcp --sport 443 -j ACCEPT
iptables -A INPUT -j LOG --log-level 4 --log-prefix 'InDrop '
iptables -A INPUT -j DROP
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A OUTPUT -m limit --limit 6/hour -j LOG \
--log-level 4 --log-prefix 'OutAllow6/h '
iptables -A OUTPUT -j ACCEPT
netstat -tnlp | grep 1111