wireguard interface configuration
If you have some wireguard interface to configure with a huge number of AllowedIPs, the route lines in the coresponding interface configuration can be gererated using a small script in order to avoid typing it by hand:
WGIFACE=wgtest;
WGGATEWAY=192.168.100.1;
for n in $(sed '/AllowedIPs/!d;s/.*= *//g;s/, */ /g'  /etc/wireguard/${WGIFACE}.conf); do
    echo -e "\tpost-up ip route add $n via $WGGATEWAY dev \$IFACE\n\tpre-down ip route del $n via $WGGATEWAY dev \$IFACE";
done
The lines gererated should be added to the interface configuration:
iface wgtest inet static
    address 192.168.100.200
    netmask 255.255.255.0
    pre-up ip link add $IFACE type wireguard
    pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf
    # insert routing lines here
    post-down ip link del $IFACE
BTW: the metric defined in wireguard route metric will apply to all routing lines. If you do not define a metric per interface, you can set a metric per routing line by appending a metric definition to the routing line:
post-up ip route add ... metric 900
        linux
- wireguard route metric - notes about wireguard route metric
 - lvm on top of multipath - optimize access to multipathed storage devices for lvm
 - apt - find orphaned packages - find packages not distributed by the current distro
 
vpn
- wireguard route metric - notes about wireguard route metric
 - wireguard vpn on android with fritzbox - notes about wireguard vpn android client to fritz box and voip calls ...
 - wireguard from fritzbox to a external server - configuring wireguard on fritzbox to connect to a external server
 
wireguard
- wireguard route metric - notes about wireguard route metric
 - wireguard vpn on android with fritzbox - notes about wireguard vpn android client to fritz box and voip calls ...
 - wireguard from fritzbox to a external server - configuring wireguard on fritzbox to connect to a external server
 
interface
routing
- wireguard route metric - notes about wireguard route metric