On Wed, 8 Jun 2022, BERTRAND Joël wrote:
For example, how can I ping a server on WAN side through 192.168.15.19 gateway and with 192.168.15.20 default route ?
Don't need to do that: just ping the host and if ping fails, switch routes round-robin; something like this: ``` #!/bin/sh PRI=192.168.15.19 SEC=192.168.15.20 R=$PRI H=8.8.8.8 T=10 while : do if ! ping -nc1 $H >/dev/null 2>&1 then case $R in $PRI) R=$SEC ;; $SEC) R=$PRI ;; esac route add default gw $R echo switched to $R S=1 else S=$T fi sleep $S done ``` -RVP