Iptables Rules

Apr 15, 2019 14:35 · 71 words · 1 minute read Linux

Allow SSH connections while using VPN

ip rule add from x.x.x.x table 128
ip route add table 128 to y.y.y.y/y dev ethX
ip route add table 128 default via z.z.z.z

Where x.x.x.x is your public IP, y.y.y.y/y should be the subnet of your public IP address, ethX should be your public Ethernet interface, and z.z.z.z should be the default gateway.

Block and IP Address

iptables -A INPUT -s 123.123.123.123 -j DROP