I have written a python script to listen on port 2626 and executed the script.
proof that localhost is listening
tcp 0 0 127.0.0.1:2626 0.0.0.0:* LISTEN
I can connect via telnet to this port over localhost with the following command:
:~$ telnet localhost 2626
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
However when I try to connect from a remote machine the connection gets refused.
:~$ telnet 128.251.xxx.xxx 2626
Trying 128.251.xxx.xxx...
telnet: Unable to connect to remote host: Connection refused
I even issued the following command to accept traffic on port 2626:
sudo iptables -A INPUT -p tcp -i eth0 --dport 2626 -j ACCEPT
What could be the reason telnet on port 2626 is refusing connections from remote machines and how can I fix it?