Allow incoming connections from IP 123.0.113.51
iptables -A INPUT -s 123.0.113.51 -j ACCEPT
Allow outgoing connections to IP 123.0.113.51
iptables -A OUTPUT -d 123.0.113.51 -j ACCEPT
Block all connections from IP 123.0.113.51
iptables -A INPUT -s 123.0.113.51 -j DROP
Accept all traffic first to avoid ssh lockdown via iptablesiptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
Flush all blocks:
iptables -F