This file contains 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
#!/bin/bash -e | |
#this script requires a routing table named $IFACE (ie. bond0) exists in /etc/iproute2/rt_tables | |
#the $IFACE routing table is used to place the default route in for the source routing table | |
#ip route list table $IFACE will list the routing table for this interface | |
set -x | |
set_netinfo() { | |
NETWORK=$(ip route show dev $IFACE | grep -v default | head -n 1 | awk '{print $1}') | |
GATEWAY=$(ip route show dev $IFACE default | head -n 1 | awk '{print $3}') |