0

We are using Screenly and a Raspberry Pi 3 Model B for digital signage. I see from the documentation that this is running on Raspberry Light version of Linux. Due to the web interface for Screenly, we have decided to use a static IP address's/ I have a background with other Unix products my experience with Linux is limited. We will mount the Pi behind a display. The display is on the first floor, the network closet is on the second floor some distance from where the display is hung. We will set up the Pi to use the wireless interface for now while we wait for the cable to be run. Once the cable is installed the Pi will be wired to the Church network. The Pi and the display will be moved from time to time to be used for various events, etc. In those times it should use the wireless LAN again.

My goal is to configure the Pi to use the WLAN interface if there is no ethernet cable connected. When an ethernet cable is connected the Pi should disable(?) the wlan interface and use the eth interface. I am referring to wlan0 and eth0. I have found instructions on configuring both with static IP addresses and have those address. I understand that it will be best to have a different address for each interface. I am not sure if it is possible to disable the wlan0 interface based on the status of the eth0 interface. Thanks for your help on this.

  • As far as I see matches my answer all your needs. Does it help you? Can you accept my answer? – Ingo Sep 12 '18 at 11:26

2 Answers2

2

You do not need to disable, enable or switch interfaces. The solution of your problem is a failover configuration of the interfaces with bonding. It will use just the interface that is available, either eth0 or wlan0. If both are available you can define what interface should be used first. And the nice thing is that it works on the fly and you only have one ip address because the virtual interface bond0 covers it slaves eth0 and wlan0. Pull out the ethernet cable and the RasPi will use the wifi if available without interruption. For details how to setup it you can look at Howto migrate from networking to systemd-networkd with dynamic failover.

Ingo
  • 42,107
  • 20
  • 85
  • 197
  • I will give this a try the next time I get to Church. I expect it will work, but don't want to select this answer until I have a chance to verify it. – Patrick O'Hara Sep 12 '18 at 19:39
-1

Sounds like an XY problem http://xyproblem.info/ - you have decided that disabling WLAN is the answer to your problem, and are asking us how.

I routinely use several Pi (running Raspbian) and they work on either LAN or WiFi - frankly I don't care which, as I just address them using raspberrypi.local (or using my own hostname). This works on any normal LAN - the only thing I need to do is configure /etc/wpa_supplicant/wpa_supplicant.conf on a new LAN.

You mention "static IP address" - while it is easy to do this (provided you use different addresses for each interface) it is NOT a good idea. If you use dhcp it will work on any network using any of the common private network ranges 10.… 192.… 172.… and you avoid the possibility of conflict with existing users.

There should be no need need to disable WiFi - dhcpcd will assign addresses to both. Ethernet interfaces will be assigned a metric in the 200 range, WiFi Ethernet interfaces will be assigned a metric in the 300 range. Whichever interface has the lowest metric will be used for routing. You can see the values with the route command.

See How to set up networking/WiFi for information on Pi routing options.

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • The primary user of this device will be our Worship Leader. Although he is comfortable with technology he is not "good" at it. The device will be wired in when it is behind the display in our common are and on WiFi when it is out for configuration changes, firmware updates, etc. It has a Web Interface. He would like to have a bookmark to reach it. My thought was to use a static IP address (obviously outside the DHCP range). To use the same address for each interface (wired and WiFi). This will allow him to have a single bookmark to get to the Web interface. – Patrick O'Hara Sep 12 '18 at 19:34