Changeset 84d8293 in lab.git for iproute/setroute.sh
- Timestamp:
- Jul 6, 2009 2:49:54 PM (15 years ago)
- Branches:
- master, trunk
- Children:
- c8daa69
- Parents:
- 71b798c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
iproute/setroute.sh
rc109418 r84d8293 16 16 GATEWAY=$1 17 17 18 TID=`/sbin/ip addr show dev ${IFACE} | grep -w ${IFACE}: | cut -d : -f 1`18 TID=`/sbin/ip addr show dev ${IFACE} | grep -w ${IFACE}: | tr -s ' ' | cut -d : -f 1` 19 19 20 20 if [ "${PHASE}" = "post-down" ]; then … … 31 31 32 32 # get IP address, network mask, default gateway info 33 IPADDR=`/sbin/ip addr show dev ${IFACE} | grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2| cut -d / -f 1`33 IPADDR=`/sbin/ip addr show dev ${IFACE} | grep -w inet | tr -s ' ' | cut -d ' ' -f 3 | cut -d / -f 1` 34 34 if [ -z "${IPADDR}" ]; then 35 35 # fail to bind IP address to device … … 37 37 exit 38 38 fi 39 NETWORK=`/sbin/ip route show dev ${IFACE} | grep -w ${IPADDR} | cut -d ' ' -f 1`39 NETWORK=`/sbin/ip route show dev ${IFACE} | grep -w ${IPADDR} | tr -s ' ' | cut -d ' ' -f 1` 40 40 41 41 if [ -z "${GATEWAY}" ]; then 42 GATEWAY=`/sbin/ip route show dev ${IFACE} | grep -w default | cut -d ' ' -f 3`42 GATEWAY=`/sbin/ip route show dev ${IFACE} | grep -w default | tr -s ' ' | cut -d ' ' -f 3` 43 43 fi 44 44 if [ -z "${GATEWAY}" ]; then 45 GATEWAY=`/sbin/ip route | grep -w default | cut -d ' ' -f 3`45 GATEWAY=`/sbin/ip route | grep -w default | tr -s ' ' | cut -d ' ' -f 3` 46 46 # this may add wrong default route especially on RHEL 47 47 fi
Note: See TracChangeset
for help on using the changeset viewer.