diff options
Diffstat (limited to 'automated')
-rwxr-xr-x | automated/linux/network-basic/network-basic.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/automated/linux/network-basic/network-basic.sh b/automated/linux/network-basic/network-basic.sh index 0c5dd8c..8160074 100755 --- a/automated/linux/network-basic/network-basic.sh +++ b/automated/linux/network-basic/network-basic.sh @@ -40,9 +40,9 @@ create_out_dir "${OUTPUT}" install # When not specified, test the default interface. -test -z "${INTERFACE}" && INTERFACE=$(route | grep default | awk '{print $NF}') -# Get default Route Gateway IP address of a given interface -GATEWAY=$(ip route list | grep default | awk '{print $3}') +test -z "${INTERFACE}" && INTERFACE=$(route | grep -m 1 "^default" | awk '{print $NF}') +# Get Route Gateway IP address of a given interface. +GATEWAY=$(route | grep -m 1 "^default.*${INTERFACE}$" | awk '{print $2}') run "netstat -an" "print-network-statistics" run "ip addr" "list-all-network-interfaces" |