Last active
January 2, 2019 08:16
-
-
Save jda/4331b338eddd80d3f6483376529632a8 to your computer and use it in GitHub Desktop.
Move bridges to ix0 if up, and fall back to igb0 if ix0 goes down.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@tachikoma:/etc/devd # cat netfail.conf | |
notify 20 { | |
match "system" "IFNET"; | |
match "subsystem" "ix0"; | |
match "type" "(LINK_DOWN|LINK_UP)"; | |
action "/root/net/netfail.sh $type"; | |
}; | |
root@tachikoma:/etc/devd # rm netfail.conf | |
root@tachikoma:/etc/devd # cat /etc/ | |
root@tachikoma:/etc/devd # cat /root/net/netfail.sh | |
#!/bin/sh | |
activate_ix() { | |
ifconfig bridge10 deletem igb0.10 | |
ifconfig bridge30 deletem igb0.30 | |
ifconfig bridge10 addm ix0.10 | |
ifconfig bridge30 addm ix0.30 | |
} | |
activate_igb() { | |
ifconfig bridge10 deletem ix0.10 | |
ifconfig bridge30 deletem ix0.30 | |
ifconfig bridge10 addm igb0.10 | |
ifconfig bridge30 addm igb0.30 | |
} | |
if [ $1 = "LINK_DOWN" ]; then | |
logger ix0 down, switching to igb0 | |
activate_igb | |
else | |
logger ix0 up, waiting 60 seconds | |
sleep 60 | |
activate_ix | |
fi |
Author
jda
commented
Jan 2, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment