Use the iptables firewall to block ads on your Linux machine.

Posted: March 15, 2017. At: 11:32 AM. This was 9 months ago. Post ID: 10359
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

This site has a nice iptables script that can be used to block ads on the Internet.

https://pgl.yoyo.org/as/iplist.php?ipformat=iptables.

Copy and paste this script into a file named ads in the /etc directory. Then create a script in the network/if-up.d/ directory named iptables and make it executable. Now put this in it.

#!/bin/sh
iptables-restore < /etc/ads

This will load the iptables rules into the iptables firewall on each boot. If the iptables script is placed in the if-pre-up.d/ directory instead, the iptables rules will be loaded before the network is connected, which may be desirable depending on the other firewall rules the system administrator is using.

No comments have been made. Use this form to start the conversation :)

Leave a Reply