
Security News
Socket Integrates With Bun 1.3’s Security Scanner API
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
network-fallback-service
Advanced tools
This is a simple script to automatically switch between network interfaces on a Linux system when a remote host is unreachable, as tested with ping or curl.
When the primary interface is not working, a secondary interface will be used. When the primary interface is working again, the system will automatically swap back to it. If none of the interfaces are working, the script will reboot the system after a given amount of retries.
Use ./install.sh
to install. It:
Runs pip3 install network-fallback-service
to install the two executables in your path: network-fallback-launch
and network-fallback-config
Runs the interactive config utility network-fallback-config
to create a new config for your device. Also creates the systemd
service file in /etc/systemd/system/network-fallback.service
and reloads the systemd daemon
Use systemctl to start/stop the service:
systemctl enable --now network-fallback.service
systemctl disable --now network-fallback.service
To ensure an interface is compatible with this service, it should be set up in ifupdown or NetworkManager, two of the common Linux network interface managers. Your config should be detailed enough that NetworkManager can enable the interface simply running nmcli dev connect <interface>
. Refer to the NetworkManager documentation for more information.
eth0
should work with no extra config (considering the IP settings are correct for your install site. Static IP / DHCP setting can be adjusted in ai-config
)
wlan0
will work given you have created a wireless network connection before. See nmcli
documentation for adding to a wifi network. It will likely be like this:
nmcli radio wifi on
to make sure its on
nmcli dev wifi list
to see list of SSIDs
sudo nmcli dev wifi connect <SSID> password "<Passowrd>"
All NetworkManager interfaces must be configured so that NetworkManager knows how to adjust the routing table properly when running nmcli dev connect <interface>
. Check the NetworkManager documentation for more information on setting up your specific use case.
The config files are located in /etc/network-fallback.d
, with the following format:
[iface.NAME]
primary = true
type = ifupdown
persistent = true
[iface.NAME]
type = NetworkManager
gateway = 192.168.0.1
persistent = true
[check.ping]
type = ping
host = 8.8.8.8
makeRoute = true
[checks]
interval = 30
retryLimit = 6
[system]
debugLogs = true/false
[iface.NAME]
Supply the interface name in the section header
primary
, for if this is the primary interface
gateway
, for if this interface accesses the internet via a gateway (ie a router)
persistent
, controls if the device should be disabled if it keeps failing (more than 5 times in a row)
[checks.NAME]
Name of the check can be anything unique
type
, may be ping or curl, this is how to test connection to the host
host
, is the ip address to test connection to
makeRoute
, is if a temporary route to this host should be added to perform this connection check (useful for when the gateway must be defined to reach host on a given interface, ie an ethernet network with a router)
[checks]
interval
, time in seconds between checks.
retryLimit
, how many failed checks in a row can be tolerated before rebooting.
[system]
debugLogs
enables verbose output to stdout. Note stdout/stderr is captured by the systemd journal if running as a service.All logs can be viewed with journalctl -u network-fallback
, and the service status with systemctl status network-fallback.service
.
FAQs
Fallback to working network interfaces
We found that network-fallback-service demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Security News
Python 3.14 adds template strings, deferred annotations, and subinterpreters, plus free-threaded mode, an experimental JIT, and Sigstore verification.
Security News
Former RubyGems maintainers have launched The Gem Cooperative, a new community-run project aimed at rebuilding open governance in the Ruby ecosystem.