/etc/network/if-up.d/wg
#!/bin/sh
if [ "$IFACE" = wg0 ] ; then
ip route replace 172.217.0.0/16 dev wg0
ip route replace 192.168.100.0/24 dev wg0
fi
exit 0
chmod a+x /etc/network/if-up.d/wg
/etc/init.d/networking restart
这样就可以在ifup wg0的时候,自动更新路由
Written with StackEdit.
Comments