#!/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.

sysctl net.ipv4.conf.default  >/tmp/sysctl-ip-default
sysctl net.ipv6.conf.default >>/tmp/sysctl-ip-default

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