Simple IPTables command for reference.

iptables -A INPUT -p tcp --dport 8118 -s 1.2.3.4 -j ACCEPT
iptables -A INPUT -p tcp --dport 8118 -j DROP