An administrator is attempting to block SSH connections to 192.168.10.24 using the Linux firewall. After implementing a rule, a connection refused error is displayed when attempting to SSH to 192.168.10.24.
Which of the following rules was MOST likely implemented?
A. iptables -A -p tcp -d 192.168.10.24 -dropt 22 -j REJECT
B. iptables -A -p tcp -d 192.168.10.24 -dropt 22 -j DROP
C. iptables -A -p tcp -d 192.168.10.24 -dropt 22 -j FORWARD
D. iptables -A -p tcp -d 192.168.10.24 -dropt 22 -j REFUSE
REJECT is the key word here. Connection refused = REJECT
A might be the correct, but it dint worked for me
this worked for me.
[root@centos7 ~]# iptables -A OUTPUT -p tcp -d –dport 22 -j REJECT
[root@centos7 ~]# ssh
ssh: connect to host port 22: Connection refused
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# firewall-cmd –reload
success
[root@centos7 ~]# ssh
The authenticity of host ‘ ()’ can’t be established.
Are you sure you want to continue connecting (yes/no)? ^C
[root@centos7 ~]#