david_1234
Posts: 150
Joined: Mon Jan 01, 2018 2:14 pm

connection doens't return after router reboot

Thu Aug 08, 2019 8:52 am

Hello ,
I have notice this problem on my pi:

the pi is connected to a router and working
when I reboot the pi - everything is ok , the connection return after the boot .
when I reboot the router - I lose connection to the pi and I have to do a hard reset \ local reboot
why is this ?
how can I fix this problem?
using pi 3 b+ raspbian-stretch

Thanks ,

User avatar
topguy
Posts: 5762
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: connection doens't return after router reboot

Thu Aug 08, 2019 9:07 am

Are you talking about WiFi ?

david_1234
Posts: 150
Joined: Mon Jan 01, 2018 2:14 pm

Re: connection doens't return after router reboot

Thu Aug 08, 2019 9:11 am

no
Ehternet connection

User avatar
topguy
Posts: 5762
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: connection doens't return after router reboot

Thu Aug 08, 2019 9:18 am

Using DHCP ? You could try with a static IP address.

You could compare the output of "ip addr" before and after the router reboot. Also can you ping the router from the Pi after reboot ?
I lose connection to the pi
You loose connection from another computer to the Pi ? On the same LAN ?

david_1234
Posts: 150
Joined: Mon Jan 01, 2018 2:14 pm

Re: connection doens't return after router reboot

Thu Aug 08, 2019 9:20 am

Using a static ip for the pi
other computers\devices that also have a static IP that connected to the same router - work with out any problem after router reboot.

I can't ping the router
I get
"Netwrok unreachable"

User avatar
neilgl
Posts: 951
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: connection doens't return after router reboot

Thu Aug 08, 2019 7:15 pm

Are you setting the static ip for the pi in the router or on the pi?

drgeoff
Posts: 9803
Joined: Wed Jan 25, 2012 6:39 pm

Re: connection doens't return after router reboot

Thu Aug 08, 2019 7:24 pm

neilgl wrote:
Thu Aug 08, 2019 7:15 pm
Are you setting the static ip for the pi in the router or on the pi?
Strictly speaking the first of those two is not possible.

What is possible is to configure the router to always give the same address to the RPi when the RPi issues a DHCP request.

The difference between that and setting static IP parameters on the RPi is readily apparent if the RPi is taken to another network.

swampdog
Posts: 238
Joined: Fri Dec 04, 2015 11:22 am

Re: connection doens't return after router reboot

Thu Aug 08, 2019 8:30 pm

Here's a pi configured to pass everything through the machine 192.168.1.1 ..

Code: Select all

admin@pi05:~ $ netstat -anr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.192 U         0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.192 U         0 0          0 eth0

Here's a pi with both wireless and ethernet doing the same thing..

Code: Select all

foo@pi18:~ $ netstat -anr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlan0
192.168.1.0     0.0.0.0         255.255.255.192 U         0 0          0 eth0
192.168.1.0     0.0.0.0         255.255.255.192 U         0 0          0 wlan0

The "G" in "UG" means "gateway" and is where network traffic will go if nothing better has been specified. You should be able to do this..

Code: Select all

admin@pi05:~ $ ping -c 1 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.680 ms

--- 192.168.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.680/0.680/0.680/0.000 ms
..noting "0% packet loss" which is good. "100% is bad".

Code: Select all

admin@pi05:~ $ traceroute 192.168.1.1
traceroute to 192.168.1.1 (192.168.1.1), 30 hops max, 60 byte packets
 1  pi00-if1.swampdog (192.168.1.1)  1.590 ms  1.743 ms  1.912 ms

Also..

Code: Select all

admin@pi05:~ $ arp -an
? (192.168.1.37) at 50:e5:49:d1:b9:bc [ether] on eth0
? (192.168.1.15) at 52:54:00:02:1f:ba [ether] on eth0
? (192.168.1.57) at 0c:08:b4:4f:58:7c [ether] on eth0
? (192.168.1.13) at dc:a6:32:07:64:2a [ether] on eth0
? (192.168.1.20) at 28:92:4a:30:6e:74 [ether] on eth0
? (192.168.1.40) at 0c:08:b4:4f:58:7c [ether] on eth0
? (192.168.1.51) at 52:54:00:90:ad:70 [ether] on eth0
? (192.168.1.58) at 00:1b:38:4f:8f:9b [ether] on eth0
? (192.168.1.18) at c8:3a:35:f4:97:40 [ether] on eth0
? (192.168.1.47) at 0c:08:b4:4f:58:7c [ether] on eth0
? (192.168.1.54) at 0c:08:b4:4f:58:7c [ether] on eth0
? (192.168.1.56) at dc:a6:32:07:64:2b [ether] on eth0
? (192.168.1.14) at bc:5f:f4:dc:63:3e [ether] on eth0
? (192.168.1.34) at 52:54:00:3c:04:cd [ether] on eth0
? (192.168.1.52) at 0c:08:b4:4f:58:7c [ether] on eth0
? (192.168.1.30) at 1c:1b:0d:c4:24:c6 [ether] on eth0
? (192.168.1.61) at 0c:08:b4:4f:58:7c [ether] on eth0
? (192.168.1.39) at 0c:08:b4:4f:58:7c [ether] on eth0
? (192.168.1.1) at 00:60:6e:43:31:ab [ether] on eth0
? (192.168.1.8) at b8:27:eb:17:68:7a [ether] on eth0
..noting that 192.168.1.1 is in that list (my router).

What you need to do is make sure you know the ip address of your router then ensure "arp -an" shows it then "ping" that ip address. If your pi ip address..

Code: Select all

admin@pi05:~ $ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:d8:01:82 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.35/26 brd 192.168.1.63 scope global eth0
       valid_lft forever preferred_lft forever
..192.168.1.35 in my case, is in the same "subnet" as your router then you will be able to ping it unless something fundamental has gone wrong. The possibilities are varied but from what you've said my hunch is your router is misconfigured.

DHCP on your pi means it will ask the network (broadcast for a DHCP server) to request an ip address (and other settings) from the DHCP server. Your router may be running DHCP and DHCP only leases ip addresses. After a time they expire and your pi and the DHCP server will have to renegotiate a new ip address. It's almost always the same but doesn't have to be. Loosely, either side at any time can "release" (expire) the ip address. If a new ip address is not forthcoming (ie: router being rebooted) then the DHCP client on the pi might assign a fallback address which is not on the same subnet.

Static ip address on your pi means you need to tell the DHCP server not to assign that address elsewhere to another machine.

These days static ip addresses are not very useful outside of server rooms. If your router has a DHCP server then tell it the mac address of your pi and have it assign the same ip address to it every time. Alternative is to disable DHCP on the router and assign static everywhere (hint: nightmare).

Typically (and again loosely) "network unreachable" occurs when a known ip address is rebooting.

pfletch101
Posts: 510
Joined: Sat Feb 24, 2018 4:09 am
Location: Illinois, USA

Re: connection doens't return after router reboot

Fri Aug 09, 2019 7:05 pm

david_1234 wrote:
Thu Aug 08, 2019 8:52 am
Hello ,
I have notice this problem on my pi:

the pi is connected to a router and working
when I reboot the pi - everything is ok , the connection return after the boot .
when I reboot the router - I lose connection to the pi and I have to do a hard reset \ local reboot
why is this ?
how can I fix this problem?
using pi 3 b+ raspbian-stretch

Thanks ,
I have seen this problem before with other networked devices. Some routers have (usually switchable by an option setting) the ability to ignore/reject traffic from an IP address that has not been assigned by their internal DHCP servers. This is often combined with security settings that only allow the DHCP server to assign IP addresses to networked devices with specific known MAC IDs, and is intended to prevent the insertion of 'foreign' devices into the network for nefarious purposes. If you reboot such a router, it will not recognize any attached device (even one that it 'knows') until the device issues a new DHCP request. Your symptoms would fit this. It should be relatively easy just to tell the Pi to 'refresh' its IP address assignment, instead of rebooting it, but I have never had to find out how to do this.

david_1234
Posts: 150
Joined: Mon Jan 01, 2018 2:14 pm

Re: connection doens't return after router reboot

Mon Aug 12, 2019 7:21 am

I could tell the pi to use DHCP ,
and in the the router to config it to give the PI saved address
but it' seem very strage - because I don't get this problem with other devices connected to the router (all of them have static ip)..

maybe I write a script like this:

ping to 10.0.01(router IP)
if no repaly
reset pi netweork service?
else
nothing

does it doable?
what is the command to reset the netwrok service and the ethernet?
I have try

Code: Select all

sudo  service networking restart 
didn't help

Thanks ,

Return to “General discussion”