1

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.

Mats Karlsson
  • 983
  • 5
  • 11
  • 1
    You have provided absolutely no details of 1 your Pi 2 how you have configured networking, or 3 evidence of problem. – Milliways Oct 22 '20 at 08: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 Oct 22 '20 at 08:42
  • 2
    Please don't post pictures of text. Instead paste the text direct into the question. – Ingo Oct 22 '20 at 09: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. – Mats Karlsson Oct 22 '20 at 09:13
  • I am agree with you @MatsKarlsson, but why would it be working on Ubuntu or Windows 10 on the same network ? – Bastien Matthai Oct 22 '20 at 09:20
  • Thats a question that the administrator responsible for the DHCP server can answer to. There is another way and that is to install wireshark or tcpdump on the Raspberry Pi and analyze the DHCP traffic. – Mats Karlsson Oct 22 '20 at 09:30

1 Answers1

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.

Ingo
  • 42,107
  • 20
  • 85
  • 197
  • 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. – Bastien Matthai Oct 22 '20 at 09:24
  • @BastienMatthai I have updated the answer with a suggestion to try systemd-networkd. – Ingo Oct 22 '20 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 ? – Bastien Matthai Oct 23 '20 at 07: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 Oct 23 '20 at 11:19