I have pretty simple home network with cable modem/router(single device). I also have raspberry Pi on the network with AdGuard DNS server setup, it is running Raspbian GNU/Linux 10 (buster) . Router config is updated to provide raspberry Pi's IP address as DNS server through DHCP. AFAIK some devices (android, chromecast) may ignore DNS server provided though DHCP and fallback to another DNS server (google public DNS for example) and thus defeat AdGuard's ad blocking. So what I'm trying to achieve is to setup raspberry Pi as default gateway as well as DNS server, so I'm able to prohibit certain IP addresses through iptables.

I know I have to setup DHCP server on raspberry Pi and turn off DHCP on the router. I was able to successfully set this up and I can verify devices on the network receive LAN configuration though raspberry Pi's DHCP server. I can see that devices now have raspberry Pi's IP address as default gateway.

But raspberry Pi doesn't seem to act like gateway, traceroute shows that pings do not make it past raspberry Pi. DNS names are resolved, and I can verify that they are resolved through AdGuard.

It looks like raspberry Pi needs setup to act as gateway. How do I do it?


  • 1
    Did you enable IP forwarding in the kernel net.ipv4.ip_forward = 1? Looking at a Linux router guide may help you.
    – Peschke
    Commented Oct 21, 2020 at 7:55
  • This worked. Thanks! Commented Oct 21, 2020 at 8:34

1 Answer 1


As @peschke mentioned I had to set net.ipv4.ip_forward = 1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .