mob-i-l
Posts: 361
Joined: Sat Dec 29, 2012 2:45 am
Location: Lund, Skåne/Scania, Sweden
Contact: Website Facebook Twitter YouTube

Is it possible to simulate removal & insertion of an ethernet plug?

Wed May 05, 2021 1:22 pm

I have wired network (ethernet) from the Raspberry Pi 4 B 8 GB via powerline to the router and don't use WiFi, but sometimes it stops working, and the only thing that helps is to remove the plug in the Raspberry Pi end and to insert it again, and then the network always starts to work again. Is it possible to issue some command that simulates the removal and insertion of the ethernet plug (RJ45)? The next step would be to automatically issue this command when the network goes down. I would like this to work automatically because I run background tasks that upload data to Internet when I don't use the computer, e.g. BOINC.

I suppose the powerline adapter (TP-Link AV500) is reset when I remove and insert the plug and maybe the local powerline adapter sends a reset signal to the remote powerline adapter. Maybe it is possible to send a reset signal from the Raspberry Pi to the local powerline adapter. It could also be that the problem is in the Raspberry Pi end, but I never had this problem when I used a direct cable between the Raspberry Pi and the router.

The two powerline adapters are updated with the latest firmware. I use the most full-upgraded Raspberry Pi OS Buster.
Have Pi0&1A&1B&1B+&2B&3B&4B w/ rasPiOS. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

MiscBits
Posts: 249
Joined: Wed Jan 27, 2021 12:48 pm

Re: Is it possible to simulate removal & insertion of an ethernet plug?

Wed May 05, 2021 10:03 pm

Sounds like the AV500 have gone to sleep.

Are there any power save settings buried in the config?
I remember having to reset to factory default and then configure via the software rather than auto-config to get them all connected.

I had faster versions of the powerline boxes for a while but fell back to Apple AirPort Extreme boxes from eBay - these proved rock solid with the inbuilt WiFi back haul due to the random pauses (not drops) I had on the mains adapters.

You could try sending a ping at random intervals to the router from the Pi to see if that helps.

Not sure if this works on Buster but helped at a friends home who had an iffy BT adapter.

I cannot remember if they get IP addresses - maybe worth checking if they do and if so set them to static addresses on your DHCP / router box - if the drop ties into lease time this could be an issue. Even if they are assigned an IP address it could be worth trying to set them on the router from the published MAC address to stop any IP address clashes.
Is a computer language with goto's totally Wirth-less?

jimbox51
Posts: 41
Joined: Thu Apr 12, 2012 6:57 pm
Location: Wakefield UK

Re: Is it possible to simulate removal & insertion of an ethernet plug?

Thu May 06, 2021 8:43 pm

mob-i-l wrote:
Wed May 05, 2021 1:22 pm
I have wired network (ethernet) from the Raspberry Pi 4 B 8 GB via powerline to the router and don't use WiFi, but sometimes it stops working, and the only thing that helps is to remove the plug in the Raspberry Pi end and to insert it again, and then the network always starts to work again. Is it possible to issue some command that simulates the removal and insertion of the ethernet plug (RJ45)? The next step would be to automatically issue this command when the network goes down. I would like this to work automatically because I run background tasks that upload data to Internet when I don't use the computer, e.g. BOINC.
The mii-tool command might be of some help? I think it's part of the net-tools package.
It has an '-r' option which makes it restart negotiation - which might wakeup the other end.

mob-i-l
Posts: 361
Joined: Sat Dec 29, 2012 2:45 am
Location: Lund, Skåne/Scania, Sweden
Contact: Website Facebook Twitter YouTube

Re: Is it possible to simulate removal & insertion of an ethernet plug?

Wed May 12, 2021 10:29 am

Thanks! That works well. I now use this when the network via powerline goes down:
sudo mii-tool -r eth0
and then ping the router to see when the network is up again:
ping 192.168.1.1
Have Pi0&1A&1B&1B+&2B&3B&4B w/ rasPiOS. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

jimbox51
Posts: 41
Joined: Thu Apr 12, 2012 6:57 pm
Location: Wakefield UK

Re: Is it possible to simulate removal & insertion of an ethernet plug?

Wed May 12, 2021 2:11 pm

mob-i-l wrote:
Wed May 12, 2021 10:29 am
Thanks! That works well. I now use this when the network via powerline goes down:
sudo mii-tool -r eth0
and then ping the router to see when the network is up again:
ping 192.168.1.1
Det är Bra - glad it sorted your problem.

pidd
Posts: 2075
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: Is it possible to simulate removal & insertion of an ethernet plug?

Thu May 13, 2021 12:31 pm

TP-Link has a windows program to adjust the settings on the powerline adapters, one of those settings is to stop them going to sleep.

I have all my powerline adapters switched to always on.

Return to “Networking and servers”