iptables allow port 22 example
Of course change --dport and -s to suit your needs
#allow certain IP to access port 22
iptables -A INPUT -p tcp -m tcp --dport 22 -s 192.168.1.0/24 -j ACCEPT
# block others
iptables -A INPUT -p tcp --dport 22 -j DROP