1

I have a Raspberry Pi with two network interfaces on raspbian (bullseye). A wifi connected to internet (wlan0) and an ethernet interface connected to some local network (eth0).

When trying to access the internet (for example doing apt update) linux is systematically trying to go through eth0 (192.168.0.10).

Note that I have configured dhcpcd on eth0:

interface eth0
nogateway
static ip_address=192.168.0.10/24
metric 500
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
[... cut ...]
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether a1:36:ea:34:12:fc brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.10/24 brd 192.168.0.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::9129:9d0e:4f4b:34d3/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether de:ad:be:e:ff:42 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.71/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0
       valid_lft 85437sec preferred_lft 74637sec
    inet6 2a02:8428:32a2:3501:b81:667b:1484:2004/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 604557sec preferred_lft 604557sec
    inet6 fe80::84d0:1440:d0f3:a758/64 scope link 
       valid_lft forever preferred_lft forever

Looking at route -n, wlan0 seems better positioned:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 wlan0
192.168.0.0     0.0.0.0         255.255.255.0   U     500    0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 wlan0

Even when I turn the eth0 down:

sudo ip link set eth0 down

It still tries (and fails) to connect to the internet.

Any idea?

1 Answer 1

0

One thing I did not mentioned in my question and which was the reason of failure is the use of dnsmasq.

So dhcpcd would configure a DHCP client for eth0 which would set the address of the interface to a static value. And then dnsmasq would, through that interface, act as a DHCP server for the camera. However, the principal job of dnsmasq is to be a DNS server. So by default, dnsmasq would mess up the DNS resolutions. So, in /etc/dnsmasq.conf, I just added:

port=0

Do disable the DNS server and now request go through wlan0 for internet.

4
  • 1
    So, "When trying to access the internet (for example doing apt update) linux is systematically trying to go through eth0 (192.168.0.10)" is incorrect? Apr 6, 2023 at 12:07
  • I don't think this is incorrect. Apr 30, 2023 at 13:37
  • Your answer seems to be mixing up the two principal services of dnsmasq - DHCP service and DNS service. Either can be switched on or off in dnsmasq independently Apr 30, 2023 at 18:59
  • Yes @roaima, you are right, that was the source of my problem. By disabling the DNS service from dnsmasq my problem was resolved. May 3, 2023 at 9:16

You must log in to answer this question.

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