0

My router has a working dhcp server which currently works ok for a number of wifi and wired devices. All the local addresses assigned by the router look like 192.168.1.x. except on my Raspberry Pi's (which runs an updated Raspbian) on Ethernet.

Until recently it worked like the rest. Now, after a power cut which also made me have to reconfigure the router, the Pi is getting the wrong gateway and IP address range when connecting via wire - the ip address is 10.29.x.y and the router doesn't see it. I can connect to the router from the Pi via wireless and the address when connecting via wireless is 192.168.1.x. The rest of the devices I have also work fine.

I am no network expert. I have connected my Pi to the router simultaneously via wire and wifi and done some tests:

$ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:ec:0f:0b
          inet addr:10.29.14.89  Bcast:10.29.31.255  Mask:255.255.224.0
          inet6 addr: fe80::2e57:dc7c:117f:19ec/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:38 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1115 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2079 (2.0 KiB)  TX bytes:202859 (198.1 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:483 errors:0 dropped:0 overruns:0 frame:0
          TX packets:483 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:34604 (33.7 KiB)  TX bytes:34604 (33.7 KiB)

wlan0     Link encap:Ethernet  HWaddr 7c:dd:90:43:2f:f7
          inet addr:192.168.1.158  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::3692:50c5:5adb:8fc5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:104627 errors:0 dropped:18111 overruns:0 frame:0
          TX packets:49441 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:18243040 (17.3 MiB)  TX bytes:9881655 (9.4 MiB)

As you can see the Mask is wrong for eth0, and so is the assigned address etc.

When I physically disconnect the ethernet cable which plugs the Pi directly to the router, with no intermediares, the eth0 information disappears.

Some more tests:

$ ip route list
default via 10.29.0.1 dev eth0  metric 202
default via 192.168.1.1 dev wlan0  metric 303
10.29.0.0/19 dev eth0  proto kernel  scope link  src 10.29.14.89  metric 202
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.158  metric 303

$ sudo route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.29.0.1       0.0.0.0         UG    202    0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    303    0        0 wlan0
10.29.0.0       0.0.0.0         255.255.224.0   U     202    0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     303    0        0 wlan0

If I disconnect the ethernet cable, all the lines relative to eth0/10.29.0.x disappear from those lists.

$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

$ sudo ls /etc/network/interfaces.d
(empty)

EDIT: I installed dhcpdump (sudo apt-get dhcpdump) and was able to get this dump when I disconnected eth0 from another console (with sudo ifconfig eth0 down and then up) and got this:

$ sudo dhcpdump -i eth0
  TIME: 2017-04-11 10:23:28.572
    IP: 0.0.0.0 (b8:27:eb:ec:f:b) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
    OP: 1 (BOOTPREQUEST)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 0
   XID: d795566c
  SECS: 5
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: b8:27:eb:ec:0f:0b:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         3 (DHCPREQUEST)
OPTION:  61 (  7) Client-identifier         01:b8:27:eb:ec:0f:0b
OPTION:  50 (  4) Request IP address        10.29.14.89
OPTION:  57 (  2) Maximum DHCP message size 1500
OPTION:  60 ( 44) Vendor class identifier   dhcpcd-6.7.1:Linux-4.4.50-v7+:armv7l:BCM2709
OPTION:  12 ( 10) Host name                 whiteberry
OPTION: 145 (  1) ???                       01               .
OPTION:  55 ( 14) Parameter Request List      1 (Subnet mask)
                        121 (Classless Static Route)
                         33 (Static route)
                          3 (Routers)
                          6 (DNS server)
                         12 (Host name)
                         15 (Domainname)
                         28 (Broadcast address)
                         42 (NTP servers)
                         51 (IP address leasetime)
                         54 (Server identifier)
                         58 (T1)
                         59 (T2)
                        119 (Domain Search)

---------------------------------------------------------------------------

  TIME: 2017-04-11 10:23:28.573
    IP: 10.29.0.1 (70:7b:e8:23:1a:0) > 10.29.14.89 (b8:27:eb:ec:f:b)
    OP: 2 (BOOTPREPLY)
 HTYPE: 1 (Ethernet)
  HLEN: 6
  HOPS: 1
   XID: d795566c
  SECS: 5
 FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 10.29.14.89
SIADDR: 192.168.116.134
GIADDR: 10.31.93.131
CHADDR: b8:27:eb:ec:0f:0b:00:00:00:00:00:00:00:00:00:00
 SNAME: .
 FNAME: .
OPTION:  53 (  1) DHCP message type         5 (DHCPACK)
OPTION:  54 (  4) Server identifier         192.168.116.134
OPTION:  51 (  4) IP address leasetime      43200 (12h)
OPTION:   1 (  4) Subnet mask               255.255.224.0
OPTION:   3 (  4) Routers                   10.29.0.1
OPTION:  15 ( 14) Domainname                telefonica.net
OPTION:  42 (  4) NTP servers               10.29.0.1
OPTION:  58 (  4) T1                        21600 (6h)
OPTION:  59 (  4) T2                        37800 (10h30m)
OPTION: 100 ( 38) Printer Name              4345542d31434553 CET-1CES
                        542d322c4d332e35 T-2,M3.5
                        2e302f30323a3030 .0/02:00
                        2c4d31302e352e30 ,M10.5.0
                        2f30333a3030     /03:00
OPTION: 120 (  5) SIP Servers DHCP Option   010a1fff86       .....
---------------------------------------------------------------------------

I don't know how to interpret it though.

1

Just change your /etc/network/interfaces to read:

iface eth0 inet dhcp

And I don't think that is related to your router configuration.

  • I am afraid that didn't help. I edited the file, rebooted, and I still get the same result in ifconfig, ip route list and route -n – kikito Apr 11 '17 at 8:17
  • add allow-hotplug eth0 – fcm Apr 11 '17 at 9:20
  • I have tried that, and rebooted. Same result, I'm afraid. – kikito Apr 11 '17 at 20:25
0

Found the problem: the ethernet cable was faulty. When I tried a different device with the same cable it presented the same issue. Replacing the cable with a new one fixed the issue.

I have a toddler who has recently started moving and he probably saw the cable and pulled it out, breaking it (I have since rearranged the living room so that cables are not reachable from the toddler-level :) )

Closing this issue for now. Thanks @fcm for trying to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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