Can't passthrough port 80 through iptables

Support for security such as Firewalls and securing linux
Post Reply
emmet
Posts: 14
Joined: 2014/09/18 12:45:42

Can't passthrough port 80 through iptables

Post by emmet » 2014/09/22 16:56:08

(spare me for using iptables for the time being.)

I've opened port 80 in iptables but I still can't browse the (Apache) initial page. What am i missing here?

Code: Select all

# iptables -nL --line-numbers
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     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:80
4    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
5    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
6    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
and here are the tests probe.

Code: Select all

$ curl -a 192.168.77.50
curl: (7) Failed connect to 192.168.77.50:80; Connection refused

$ telnet 192.168.77.50 80
Trying 192.168.77.50...
telnet: connect to address 192.168.77.50: Connection refused
telnet: Unable to connect to remote host
Thanks in advance.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: Can't passthrough port 80 through iptables

Post by gerald_clark » 2014/09/22 17:07:23

CentOS 7 by default uses firewalld, not iptables.
https://access.redhat.com/documentation ... walls.html

emmet
Posts: 14
Joined: 2014/09/18 12:45:42

Re: Can't passthrough port 80 through iptables

Post by emmet » 2014/09/22 17:28:41

"Hello Firewalld, nice to shake hands with you..."

thanks gerald_clark. firewalld works.

Just in case someone is looking for opening port 80 in firewalld, hope this helps.

Code: Select all

firewall-cmd --add-port=80/tcp --permanent

Post Reply