Skip to content

Instantly share code, notes, and snippets.

Avatar

turtletramp

View GitHub Profile
@Apsu
Apsu / failover.sh
Last active Jun 10, 2021
An example failover script for dual WAN, using a ping healthcheck and managing default routes appropriately
View failover.sh
#!/bin/bash
# Set defaults if not provided by environment
CHECK_DELAY=${CHECK_DELAY:-5}
CHECK_IP=${CHECK_IP:-8.8.8.8}
PRIMARY_IF=${PRIMARY_IF:-eth0}
PRIMARY_GW=${PRIMARY_GW:-1.2.3.4}
BACKUP_IF=${BACKUP_IF:-eth1}
BACKUP_GW=${BACKUP_GW:-2.3.4.5}