If you have come across a problem of not able to access a service like httpd even if the server is running, most probably the Firewall is blocking the port. The quick way of checking it is to disable Firewall and try again. However this method of disabling firewall may not be recommended on production servers.

The following command tells you if firewall (iptables) is active on the Fedora Linux system.

[root@techpulp ~]# /sbin/service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination
1    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination

[root@techpulp ~]#

Use the following command to disable Firewall.

[root@techpulp ~]# /sbin/service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@techpulp ~]#

Use the following command to enable Firewall back.

[root@techpulp ~]# /sbin/service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@techpulp ~]#

If you are using a simple desktop system and not much concerned about security, you can also permanently disable firewall which is persistent across reboot.

[root@techpulp ~]# chkconfig --level=35 iptables off

In case of Debian Linux systems, run the following list of commands in the same order to disable firewall.

[root@techpulp ~]# iptables -X
[root@techpulp ~]# iptables -t nat -F
[root@techpulp ~]# iptables -t nat -X
[root@techpulp ~]# iptables -t mangle -F
[root@techpulp ~]# iptables -t mangle -X
[root@techpulp ~]# iptables -P INPUT ACCEPT
[root@techpulp ~]# iptables -P FORWARD ACCEPT
[root@techpulp ~]# iptables -P OUTPUT ACCEPT