Sometimes you need to open a port on your server, you want it to be recheable only from specific IP address, you can use Iptables for this.Show iptables rules.

iptables -L -v

Rules for open port 22 to one IP

iptables -I INPUT -p tcp -s 0.0.0.0/0 –dport 22 -j DROP

iptables -I INPUT -p tcp -s 45.56.77.20 –dport 22 -j ACCEPT

Save iptables rules

apt-get install iptables-persistent

iptables-save > /etc/iptables/rules.v4

systemctl start netfilter-persistent.service

Delete rules

iptables -D INPUT -p tcp -s 0.0.0.0/0 –dport 22 -j DROP

iptables -D INPUT -p tcp -s 45.56.77.20 –dport 22 -j ACCEPT