First there is an explaination of the theory behind redirecting the default gateway,
then example scripts will follow.
+[[!toc levels=2]]
+
### Theory
Normally, there are two entries in the routing table.
The examples given above will work with both router and switch mode.
However, in router mode, there is actually no such thing as a gateway route.
-For example, the following three lines in the tinc-up script:
+In that mode, the following four lines in the tinc-up script:
+ VPN_GATEWAY=...
+
ip route add $VPN_GATEWAY dev $INTERFACE
ip route add 0.0.0.0/1 via $VPN_GATEWAY dev $INTERFACE
ip route add 128.0.0.0/1 via $VPN_GATEWAY dev $INTERFACE
ip route add 0.0.0.0/1 dev $INTERFACE
ip route add 128.0.0.0/1 dev $INTERFACE
-
-In fact, one does not have to set the VPN_GATEWAY variable at all.
-In switch mode, the gateway routes are necessary.
-However, since Subnet statements are ignored in switch mode,
-you do not have to add `Subnet = 0.0.0.0/0` to `/etc/tinc/myvpn/hosts/server` in that case.