Linux – CentOS/Linux Block External Port

blockcentoslinuxport

Suppose I have an internal service running on port 7676, how would I (On CentOS) block port 7676 from external sources, so that it can only be accessed locally – AKA 127.0.0.1, not using, for example, 64.222.33.44 – the external IP.

Best Answer

You could use iptables for this. What you have go do is insert a DROP rule into the INPUT chain for packets with a destination address of your external IP 64.222.33.44 and a destination port of 7676.