Just can't work out what the command is; hopefully simple for someone who knows.
Debian 12 with two uplinks:
wlan0
is the main connection but is quite unreliable and hp
is 4G failover.
I want one host (which doesn't use much data) to always use hp
.
# Create a new route table.
$ sudo echo "2 solar" >>/etc/iproute2/rt_tables
# Set the default route on the new table.
$ sudo ip route add default dev hp table solar
# Route traffic from a specific host to the new table.
$ sudo ip rule add from 192.168.0.60 table solar
$ ip route show table solar
default dev hp scope link
That route show
seems wrong -- the default is there but not the rule for the host.
After a while -- I guess it takes some time to become effective -- the host loses its Internet connection.
To undo it all:
sudo ip route flush table solar
sudo sed -i '/solar/s/^/#/' /etc/iproute2/rt_tables
I guess that ip rule add from...
is wrong but I can't see what to do instead.
Asked by Richard Barraclough
(550 rep)
Feb 25, 2025, 11:29 AM