Gentoo Archives: gentoo-user

From: Sascha Hlusiak <saschahlusiak@×××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Setting up complex routes for pppd with /etc/conf.d/net [SOLVED]
Date: Thu, 12 Apr 2007 16:38:05
Message-Id: 200704121229.07952.saschahlusiak@arcor.de
1 > pppd complains: ppp not replacing existing default route...
2 > (Isn't is possible to have multiple default routes with different metric
3 > values? Why not with pppd? How can I make pppd add another default route or
4 > replacing the current one?)
5 >
6 > So the solution is by hand:
7 > route -n # to see the $oldgw
8 > route del default
9 > route add -host $vpnserver gw $oldgw
10 >
11 > Or with the /etc/conf.d/net:
12 > dhcpcd_wlan0=("-G")
13 > routes_wlan0=("$vpnserver via $guessedgw")
14 >
15 > Since I get IP addresses from different ranges, I get different gateways
16 > assigned and I'd need to guess them. And if I pass the -G option to dhcpcd,
17 > I have to guess the gateway. Are there "dynamic" values possible in the
18 > conf.d/net file?
19
20 Wow, got it solved with iproute2. Have these two statements in
21 the /etc/conf.d/net now:
22
23 modules=( "iproute2" )
24
25 metric_wlan0=200
26 config_wlan0=("dhcp")
27 routes_wlan0=("$VPNSERVER dev wlan0 metric 1")
28 # This adds the route to $VPNSERVER using the default route of
29 # device wlan0, which is set up by dhcpcd.
30
31 config_ppp0=("null")
32 routes_ppp0=("default dev ppp0 metric 100")
33 # When the ppp0 device comes up by pppd, the init script is called,
34 # adding a default route over ppp0 with metric 100. The metric is lower then
35 # the metric of the other default route, so this one is preferred.
36 # pppd does not need the defaultroute option, since it cannot create the
37 # default route anyway
38
39
40 After firing up wlan, dhcp and pppd, I have this automatically set up:
41
42 # ip route show
43 $REMOTEIP dev ppp0 proto kernel scope link src $LOCALIP
44 $VPNSERVER dev wlan0 scope link metric 200
45 $VPNNET/24 dev wlan0 scope link metric 200
46 127.0.0.0/8 dev lo scope link
47 default dev ppp0 scope link metric 100
48 default via $LOCALGATEWAY dev wlan0 metric 200
49
50 And I'm happy. :-)
51
52
53 Sascha

Replies

Subject Author
Re: [gentoo-user] Setting up complex routes for pppd with /etc/conf.d/net [SOLVED] Walter Dnes <waltdnes@××××××××.org>