How to open a 8080 port for an application, with iptables
I see the above thread. And I run the following commands. But it seems that 8080 is still accessible outside the machine. Does anybody know what is wrong?
$ netstat -tanpu | grep ":8080"
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 165.91.211.165:8080 0.0.0.0:* LISTEN 26098/python3
$ sudo iptables -I INPUT 1 -i eth0 -p tcp --dport 8080 -j ACCEPT
$ sudo iptables -nvL
Chain INPUT (policy ACCEPT 5039 packets, 935K bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 reject-with icmp-port-unreachable
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5900
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5901
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5902
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5903
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5904
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5905
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5906
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5907
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5900 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5901 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5902 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5903 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5904 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5905 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5906 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5907 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:143 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:993 reject-with icmp-port-unreachable