TRY THIS Raspberry Pi does not come up after network reset

kyle95wm

Phone Genius Owner
Joined
Apr 16, 2016
Messages
520
Reaction score
90
So, to make this a long story short, whenever I reboot my home's internet connection, my Raspberry Pi 2B doesn't seem to re-connect to the LAN. I wrote a script that's SUPPOSED to run every 5 minutes, which will ping an outside address three times. If these pings fail, the network interface is supposed to restart. I did an extended test today, and it was unable to deliver on what I expected. The only way to get the PBX back up and running was to power-cycle the Pi, which in itself is terrible for the SD card. Can anyone shed some light on why this is happening?

So, in short:

Expected behaviour: If the Raspberry Pi network is down, restart the interface
Actual behaviour: When the Raspberry Pi network is down, it never comes back up without a power-cycle.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,227
How are you connecting to the LAN? Hard-wired or WiFi.
What command(s) are you using restart the LAN?
 

kyle95wm

Phone Genius Owner
Joined
Apr 16, 2016
Messages
520
Reaction score
90
How are you connecting to the LAN? Hard-wired or WiFi.
Ethernet. The Pi 2B has no built-in wifi

What command(s) are you using restart the LAN?
I'm so glad you asked! Here's the script that is SUPPOSED to run every 5 minutes:

Code:
#!/bin/bash

# This script will check to see if the host can ping the router.
# If the ping fails, shut down, then bring back up the interface designated as eth0

if ! /bin/ping 192.168.101.100 -c4 ; then
    # We first shut down eth0
    # After eth0 is shut down, we forcefully bring it back up
    /sbin/ifdown eth0 && /sbin/ifup --force eth0
else
    # We do noting if the network is okay
    /bin/echo "PBX is OK"
fi

Even changing the router to an outside address (such as 1.1.1.1) has no effect on fixing the downed network.
 

Members online

Forum statistics

Threads
25,824
Messages
167,825
Members
19,248
Latest member
BKhumalo
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top