How it works...

To block a spoofed IP address or any other IP address, we again use Iptables as it is the default firewall, unless we don't want to use any other tool available for Linux.

We again create rules to allow localhost access in the system and also to keep the outbound active connections alive. Then, we create a table in Iptables that we use to maintain a list of the spoofed IP addresses that we want to block. After, we add this table to the input chain of Iptables. Now, we can add any IP address to the table whenever required and it will automatically get blocked.

We can also use the /etc/host.conf file to protect the system from IP spoofing.