Ubuntu block an ip with iptables

Sometimes as a developer or server administrator you need to block certain IP addresses from accessing your server.

In the example IP address that we will be using is going to be 0.0.0.0. The syntax that we will use to block an IP address is

sudo iptables -A INPUT -s [the ip] -j DROP

The A tells iptables to add the rule. So in our example to block 0.0.0.0 from our server the command would look like

sudo iptables -A INPUT -s 0.0.0.0 -j DROP

See also: Linux: 20 Iptables Examples For New SysAdmins