#!/bin/sh

# When changing default IPv4/6 settings, this does not apply to
# existing interfaces. This syncs the default settings to all known
# interfaces at boot, such that physical interfaces will start from
# the same point as virtual ones.
tmp=$(mktemp)

sysctl net.ipv4.conf.default  >$tmp
sysctl net.ipv6.conf.default >>$tmp

for iface in $(ip -j link show | jq -r .[].ifname); do
    sed -e "s/.default./.${iface}./g" $tmp | sysctl -p -
done

rm $tmp

