Question about loopback addresses in blocklist

Hello everyone,

I'd like to add loopback addresses but I don't know if it works with pihole. Can you help me ?

A DNS (Domain Name System) filter is dealing with domains.
Filtering traffic based on IP addresses is a firewall's job.

But I'd wonder why you would want to filter loopback addresses?

No, I want to deny sending a request.

127.0.0.1

Could you provide a bit more context?

I might have understood that the wrong way.
As far as I know the loopback adress just denies sending a request. So what I thought is to just deny any requests of domains listed in my blocklist. Example:

127.0.0.1 Example.com
127.0.0.1 Example.org

Sending a request to any of these domains would be denied.

It doesn't.
IP addresses in blocklists are of no significance.

Pi-hole will block domains on a list, regardless of IP addresses.
If you want to compile your own blocklist, one domain per line will do.

Ah OK. Thank you :blush:

Just to add one more detail:

IP addresses are irrelevant (as Bucking_Horn said) because when an adlist contains IP + domain (like in your example), Pi-hole will store only the domain.
The IPs are thrown away and Pi-hole never knows about its existence.

Just to add more info – the reason you sometimes see an IP at the start of these lists, for example 0.0.0.0 or 127.0.0.1, is that this is one way to "block" domains, more common some years ago. The file is intended to be used as the OS's hosts file, which contains hard-coded domain-to-IP lookups. By having those IPs in there, it forces the OS to try and resolve those domains as all zeroes or localhost, both of which cause it to fail, and in essence can provide a simple way to prevent access to domains, but only for that one machine with the file in place.

Since you're using Pi-hole you don't need to do that. As the devs have said, Pi-hole just looks at the domain names when processing these lists. If a list is one of these hosts formats with IPs, Pi-hole ignores the IPs and only processes the domains, adding them to its Gravity database, which is where it stores everything to be blocked.

If you would like to add your own domains, perhaps a simpler way to do it is in Domains > enter the domain > Add to Blacklist. You can add a note if you want a reminder of why you're blocking it. When you're done, make a backup of your settings in Settings > Teleporter > Backup. Later on, perhaps if you do a fresh install or an install somewhere else, you can restore just the blacklist from the same screen by browsing to the backup file and ticking just Blacklist (exact) > Restore.