DHCP gets IP, DNS, but can't browse Internet

My ISP gives me a LAN cable, which is connected to a 4 port switch.
From that switch, one cable is connected to Rpi4 (Debian 12 and Docker) and another cable connected to Windows PC.

My goal is to make Rpi4 work as router.
So devices such as Windows PC will get IP from Pihole, and connect to Internet.

In order to connect to Internet, my ISP have requirement to set the exact static ip.

So /etc/network/interfaces looks like this:

iface eth0 inet static
  address 10.102.132.52/24
  gateway 10.102.132.1
  dns-nameservers 10.102.132.1

Upon setting this, my internet works on Rpi4.


Now i installed, docker-pihole and compose.yaml looks like this:

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    network_mode: "host"
    environment:
      TZ: 'America/Chicago'
      WEBPASSWORD: 'changeme'
    volumes:
      - './etc-pihole:/etc/pihole'
      - './etc-dnsmasq.d:/etc/dnsmasq.d'
    cap_add:
      - NET_ADMIN
    restart: unless-stopped

From the Pihole dashboard, I enabled DHCP server, and set range 192.168.10.100 to 192.168.10.150 and gateway to 192.168.10.1

Upon saving, I tested if Windows machine, can get IP, it did not.
I tried to ping 192.168.10.1 from Rpi, but did not work which is obvious, because 192.168.10.1 was not assigned to any host.

So, I updated my, interfaces file to this:

iface eth0 inet static
  address 10.102.132.52/24
  gateway 10.102.132.1
  dns-nameservers 10.102.132.1

iface eth0:1 inet static
  address 192.168.10.1/24

Now, I can ping 192.168.10.1 from host (pi4) itself, and DHCP also works.
My Windows machine, gets ip successfully, such as 192.168.10.145; where gateway and dns gets set to 192.168.10.1

Ping to 8.8.8.8 from windows machine works. But when I try to open page such as example.com, the page do not open.

I instantly thought, pihole dns was not working, but upon checking query log, I could see Windows machine requested example.com and it was resolved, but still I can not browse internet from Windows machine.

net.ipv4.ip_forward=1 is set on /etc/sysctl.conf

I do not have any firewall installed. What am I doing wrong?
Do I need other traffic forwarding techniques?

My best guess is, dns replies not reaching back to Windows machine.

(On a side note: If this is somehow related to an earlier topic of yours, I'd recommend to answer my questions in that topic to help us helping you. Depending on those answers, there may be other ways to solve your issue without having to turn your RPi into a router. :wink: )

Turning an SBC like an RPi into a router is completely unrelated to Pi-hole.

While it is definitive possible via more than one approach (e.g. by installing software like RaspAP or a full router OS), it would require you to decide on one such approach and then consult the respective documentation and support channels for that choice of yours.

I did not mean wireless router.

I meant, actual internet connection will be Pi, other devices will use internet via Pi (connected via LAN)

But that thanks for software recommendation.

A post was merged into an existing topic: Help me to understand why DHCP does not work

I've checked RaspAP but seemed mostly focused on wireless routing. :confused: