1

I have a raspberry pi 3 that is connect to my home network using wifi.

But I have another network that is LAN only. What I want:

When I plugin the LAN cable, I want the pi to disconnect from the wifi network and connect to the LAN network. And when I remove the cable, I want it to connect back to the wifi network.

I want this solution to be permanent after reboots and shutdowns.

New contributor
Nick Rick is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • Why? What do you hope to achieve? Have you tried what happens?
    – Milliways
    Jun 21 at 22:07

1 Answer 1

1

You didn't actually ask a question, but I assume you'd like for someone to tell you how to get "what you want". The guidance here is that you're supposed to do your homework, try something, and only then ask a question. Your question reads more like a "wish"... as if you'd found the magic lamp & conjured a genie.

All that aside, your objective seems straightforward. If I were doing this, I think I would start by reading man ip & try to write a script that used the ip command to check eth0 for a carrier. Then I would read man wpa_cli and/or man rfkill to learn how to disable the wifi. I would probably look at trying to do this using dhcpcd since it is the RPi de-facto network manager. It has hooks that can be run to do this sort of thing. Hopefully, that will get you started. Please don't hesitate to ask follow-on detailed questions after you've tried something.

Your Answer

Nick Rick is a new contributor. Be nice, and check out our Code of Conduct.

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.