2

I have trouble getting my gateway address to reach internet on my Raspberry Pi.

I tried on 2 distinct company networks.

On first network there is no problem, every device can get his network configuration through DHCP.

On second network, Raspberries can not get their gateway address. However they get their IP addresses. On other devices (a Windows 10 or a Linux Ubuntu laptop for example) their is no trouble and everything works perfectly. I tried on my main Raspbian install but also on a fresh install of a newer version. I also tried on 2 distinct Raspberries and the result are the same.

Is there any mean to force DHCP or have you any other solution ?

(When I add my gateway address manually it works perfectly, but I can't handle this solution because I won't have any information about networks where my product is deployed)

Edit :

  1. I use a Raspberry Pi 3b+
  2. The problem happens also on a fresh new install of Raspbian Buster.
  3. Here is my routing table at boot : enter image description here

I have the feeling the first line in this routing table is bad. When I use this command:

route add default gw 192.168.60.200 eth0

It adds the corresponding line to routing table and internet starts working.

6
  • 1
    You have provided absolutely no details of 1 your Pi 2 how you have configured networking, or 3 evidence of problem.
    – Milliways
    Commented Oct 22, 2020 at 8:30
  • 1
    if the RPi works correctly on one subnet, but not on the other subnet, then the problem is probably with the DHCP server configuration ... the misconfigured one could be either one ... the one that causes failure may actually be the correctly operating one
    – jsotola
    Commented Oct 22, 2020 at 8:42
  • 2
    Please don't post pictures of text. Instead paste the text direct into the question.
    – Ingo
    Commented Oct 22, 2020 at 9:08
  • The default gateway is delivered from the DHCP server, so if you experience different behaviour on different network, then its a DHCP server issue. Commented Oct 22, 2020 at 9:13
  • I am agree with you @MatsKarlsson, but why would it be working on Ubuntu or Windows 10 on the same network ? Commented Oct 22, 2020 at 9:20

1 Answer 1

0

If the routing table is on a fresh flashed unmodified Raspberry Pi OS based on Debian Buster then you do not get a default gateway address from the remote DHCP server. The first line in the routing table is not a problem. It is a valid route to network 172.16.0.0/16 behind gateway 192.168.60.254, so you can connect to devices on this network.

Because Ubuntu and MS Window$ get the default gateway 192.168.60.200 on network 192.186.60.0/24 it may be possible that default dhcpcd on the RasPi has a setting that the DHCP server does not understand. To check this you can try to use another networking system. If you like you can use systemd-networkd for testing. How to do it, look at Use systemd-networkd for general networking and follow section ♦ Create interface file for a wired connection.

4
  • The routing table is indeed on a fresh flashed Raspberry Pi OS based on Debian Buster. I don't understand because the default gateway is properly provided on other OS. Commented Oct 22, 2020 at 9:24
  • @BastienMatthai I have updated the answer with a suggestion to try systemd-networkd.
    – Ingo
    Commented Oct 22, 2020 at 11:11
  • Your solution (using systemd-networkd) is working, ty !!! I don't know if I could use it but it highlighted the problem. Is there any mean to know what was wrong with dhcpcd, wireshark or tcpdump would tell me this ? Commented Oct 23, 2020 at 7:38
  • @BastienMatthai I use only systemd-networkd for all networking issues. I'm convinced it is the better system. dhcpcd is good to have things available out the box for beginners.
    – Ingo
    Commented Oct 23, 2020 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.