I am running a CentOS 7 machine and when I try to telnet localhost 8080 I get the following message
Trying ::1...
Telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Telnet: conenct to address 127.0.0.1: Connection refused
I have added 8080/tcp to the IP table and have opened the port. Any idea what is stopping it?
That's simple: port 8080 is not opened, just like @Esse told you.
You can check the connection with echo also:
echo OK > /dev/tcp/localhost/8080
echo $?
You can list opened ports using netstat:
netstat -tulpn | grep 8080
You can test that the port is not opened by trying to open the port yourself:
# open port 8080 using netcat
nc -l 8080 &
# check connection
netstat -tulpn | grep 8080
telnet localhost 8080
echo OK > /dev/tcp/$(hostname -f)/8080
nc 127.0.0.1 8080