How can I actually check whether I'm being blocked by a firewall between my Linux machine and a target host? In case the firewall is blocking the connection how to do I unblock it?
Is it possible to allow and deny connections from IPs in Firewall? Or is it just the IP Tables?
Firewalls(most of them) can either Reject or Deny/Drop the traffic. Reject action sends an ICMP Port/Destination Unreachable response back to the source while Drop/Deny action sends nothing back and will silently drop the connection. Which means the firewall is blocking the traffic.
Use the following syntax you can unblock an IP (the -d options deletes the rule from table):
# iptables -D INPUT -s xx.xxx.xx.xx -j DROP
# iptables -D INPUT -s 126.96.36.199 -j DROP
# service iptables save
To unblock or enable SSH access, go to the remote server and run the following command:
Using IPtables Firewall
# iptables -I INPUT -s 192.168.1.100/24 -p tcp --dport ssh -j ACCEPT
firewall-cmd --direct --add-rule ipv4 filter INPUT 1 -m tcp --source 192.168.1.100 -p tcp --dport 22 -j ACCEPT
To unblock ftp access
iptables -I INPUT -s 192.168.1.100 -p tcp --dport 20,21 -j ACCEPT or
firewall-cmd --direct --add-rule ipv4 filter INPUT 1 -m tcp --source 192.168.1.100 -p tcp --dport 20,21 -j ACCEPT
Try it out!