Skip to main content
Tweeted twitter.com/StackRaspi/status/1433852290637651971
Updated the wording.
Source Link
mniess
  • 243
  • 2
  • 7

Scenario

  • wlan0 is configured to connect to an internet-connected router and getgets an IP via DHCP
  • eth0 is set to a static IP (via /etc/dhcpcd.conf, different net than wlan0) and connected to a net with no router, gateway or DHCP server.

Goal

I want to talk to devices connected to eth0 while maintaining internet connectivity through wlan0.

Problem

As soon as a cable is connected, the internet connection goes away. The default route is always set to the non-existent gateway of eth0. Manually setting the default route to the gateway of wlan0 works, but I don't want to hardcode this, as wlan0 is connected to different networks with different IPs.

Scenario

  • wlan0 is configured to connect to an internet-connected router and get an IP via DHCP
  • eth0 is set to a static IP (via /etc/dhcpcd.conf, different net than wlan0) and connected to a net with no router, gateway or DHCP server.

Goal

I want to talk to devices connected to eth0 while maintaining internet connectivity through wlan0.

Problem

As soon as a cable is connected, the internet connection goes away. The default route is always set to the non-existent gateway of eth0. Manually setting the default route to the gateway of wlan0 works, but I don't want to hardcode this, as wlan0 is connected to different networks with different IPs.

Scenario

  • wlan0 is configured to connect to an internet-connected router and gets an IP via DHCP
  • eth0 is set to a static IP (via /etc/dhcpcd.conf, different net than wlan0) and connected to a net with no router, gateway or DHCP server.

Goal

I want to talk to devices connected to eth0 while maintaining internet connectivity through wlan0.

Problem

As soon as a cable is connected, the internet connection goes away. The default route is always set to the non-existent gateway of eth0. Manually setting the default route to the gateway of wlan0 works, but I don't want to hardcode this, as wlan0 is connected to different networks with different IPs.

Source Link
mniess
  • 243
  • 2
  • 7

How to prioritize Wifi over Ethernet

Scenario

  • wlan0 is configured to connect to an internet-connected router and get an IP via DHCP
  • eth0 is set to a static IP (via /etc/dhcpcd.conf, different net than wlan0) and connected to a net with no router, gateway or DHCP server.

Goal

I want to talk to devices connected to eth0 while maintaining internet connectivity through wlan0.

Problem

As soon as a cable is connected, the internet connection goes away. The default route is always set to the non-existent gateway of eth0. Manually setting the default route to the gateway of wlan0 works, but I don't want to hardcode this, as wlan0 is connected to different networks with different IPs.