> pppd complains: ppp not replacing existing default route...
> (Isn't is possible to have multiple default routes with different metric
> values? Why not with pppd? How can I make pppd add another default route or
> replacing the current one?)
>
> So the solution is by hand:
> route -n # to see the $oldgw
> route del default
> route add -host $vpnserver gw $oldgw
>
> Or with the /etc/conf.d/net:
> dhcpcd_wlan0=("-G")
> routes_wlan0=("$vpnserver via $guessedgw")
>
> Since I get IP addresses from different ranges, I get different gateways
> assigned and I'd need to guess them. And if I pass the -G option to dhcpcd,
> I have to guess the gateway. Are there "dynamic" values possible in the
> conf.d/net file?
Wow, got it solved with iproute2. Have these two statements in
the /etc/conf.d/net now:
modules=( "iproute2" )
metric_wlan0=200
config_wlan0=("dhcp")
routes_wlan0=("$VPNSERVER dev wlan0 metric 1")
# This adds the route to $VPNSERVER using the default route of
# device wlan0, which is set up by dhcpcd.
config_ppp0=("null")
routes_ppp0=("default dev ppp0 metric 100")
# When the ppp0 device comes up by pppd, the init script is called,
# adding a default route over ppp0 with metric 100. The metric is lower then
# the metric of the other default route, so this one is preferred.
# pppd does not need the defaultroute option, since it cannot create the
# default route anyway
After firing up wlan, dhcp and pppd, I have this automatically set up:
# ip route show
$REMOTEIP dev ppp0 proto kernel scope link src $LOCALIP
$VPNSERVER dev wlan0 scope link metric 200
$VPNNET/24 dev wlan0 scope link metric 200
127.0.0.0/8 dev lo scope link
default dev ppp0 scope link metric 100
default via $LOCALGATEWAY dev wlan0 metric 200
And I'm happy. :-)
Sascha
pgplPIT4nvCWM.pgp
Description: PGP signature

