Tuesday, 5 January 2016

Linux: Solution for 'Not Able to Access Remote Server'


If you're playing with the Linux servers, one of the bothering issue is that 
you're not able to access other server from the current server

Or, MySQL replication or other service will not work even if you're able to ping from one server to the other or vice versa


Or, you may not be able to access the Tomcat service through your browser


Or, any other such connectivity issue, here is the solution that I used:


Just reset all the Firewall(Iptables) rules and you're done!



First get into SUDO and check the applied rules. It should be looking like below:


[root@myhost ]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:opsession-prxy

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)

target     prot opt source               destination



In my case, the highlighted line is the culprit! It just says to REJECT all incoming connections !

Either you can modify the rules by removing this line, or just like me, remove all the rules !!


Here is how to remove/flush  the firewall rules:




[root@myhost ]# iptables --flush


Yes, that's it!


No comments:

Post a Comment

Note: only a member of this blog may post a comment.