Commit 6ea36677 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Networking when using hostapd - set proper metrics that default adaptor gets...

Networking when using hostapd - set proper metrics that default adaptor gets highest routing priority. This fixes problem when having more connected adaptors and random metrics.
parent 8c79473d
...@@ -544,7 +544,7 @@ function get_wlan_interface () ...@@ -544,7 +544,7 @@ function get_wlan_interface ()
# #
# select interface if there is more than one # select interface if there is more than one and adjust metric
# #
function select_default_interface () function select_default_interface ()
{ {
...@@ -577,6 +577,31 @@ function select_default_interface () ...@@ -577,6 +577,31 @@ function select_default_interface ()
exec 3>&- exec 3>&-
fi fi
fi fi
# set highest metric to default adaptor
HIGHEST_METRIC=$(nmcli -t -f UUID,TYPE,DEVICE connection show --active | grep $DEFAULT_ADAPTER | sed 's/:.*$//')
METRIC=100
# set metric to 100
nmcli connection modify $HIGHEST_METRIC ipv4.route-metric $METRIC
# set others wired
REMAINING=( `nmcli -t -f UUID,TYPE,DEVICE connection show --active | grep ethernet | grep -v $DEFAULT_ADAPTER | sed 's/:.*$//'` )
for i in "${REMAINING[@]}"
do
METRIC=$(( $METRIC + 1 ))
nmcli connection modify ${i} ipv4.route-metric $METRIC
done
# set other wireless
METRIC=1000
REMAINING=( `nmcli -t -f UUID,TYPE,DEVICE connection show --active | grep wireless | grep -v $DEFAULT_ADAPTER | sed 's/:.*$//'` )
for i in "${REMAINING[@]}"
do
METRIC=$(( $METRIC + 1 ))
nmcli connection modify ${i} ipv4.route-metric $METRIC
done
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment