0

I have two PI 2 connected to each other directly and they do communicate with each other no problem. However, whenever the network cable is disconnected physically from their Ethernet port, Wired Network connection for that PI doesn't re-establish when the cable is plugged back in. At that point, you have to open the network GUI and click on connect button. I am trying to mimic a network connection loss and implement automatic reconnect feature in my program whenever network cable is plugged back in.

So, how do you tell Raspbian to keep the network connection alive or reconnect as soon as the cable is plugged back in?

UPDATE:

eth0  Link encap:Ethernet  HWaddr b8:27:eb:f4:1b:60  
      inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:25570 errors:0 dropped:0 overruns:0 frame:0
      TX packets:28065 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:2495577 (2.3 MiB)  TX bytes:3368055 (3.2 MiB)

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:711 errors:0 dropped:0 overruns:0 frame:0
      TX packets:711 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1 
      RX bytes:57528 (56.1 KiB)  TX bytes:57528 (56.1 KiB)
  • You need to include the output of ifconfig and any config files you have changed. If they were standard it would work. – Milliways Nov 14 '16 at 22:23
1

i have same issue with RPi. I do not have working solution for it right now, but my idea is to use watchdog with ping option and set repair-binary as callback

something like watchdog.conf:

ping = 8.8.8.8
repair-binary = ifconfig eth0 up

Hope this idea will help you.

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.