public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* Re: [gentoo-user] Setting up complex routes for pppd with /etc/conf.d/net [SOLVED]
       [not found] <200704121121.14577.saschahlusiak@arcor.de>
@ 2007-04-12 16:29 ` Sascha Hlusiak
  2007-04-13  4:07   ` Walter Dnes
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hlusiak @ 2007-04-12 16:29 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1837 bytes --]

> 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

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] Setting up complex routes for pppd with /etc/conf.d/net [SOLVED]
  2007-04-12 16:29 ` [gentoo-user] Setting up complex routes for pppd with /etc/conf.d/net [SOLVED] Sascha Hlusiak
@ 2007-04-13  4:07   ` Walter Dnes
  2007-04-13  4:37     ` Sascha Hlusiak
  0 siblings, 1 reply; 3+ messages in thread
From: Walter Dnes @ 2007-04-13  4:07 UTC (permalink / raw
  To: gentoo-user

On Thu, Apr 12, 2007 at 12:29:03PM -0400, Sascha Hlusiak wrote

> Wow, got it solved with iproute2. Have these two statements in 
> the /etc/conf.d/net now:

  I've have to do something similar when I use my backup dialup account
instead of eth0 to the router to ADSL.  Here are my ~/bin/dialup and
~/bin/dialdown scripts.  Before dialup, I have to take down eth0 and set
up ssmtp to use my dialup ISP's MTA...
  
#!/bin/bash
/usr/bin/sudo /sbin/ifconfig eth0 down
/usr/bin/sudo /usr/bin/cp -f /etc/ssmtp/295.ssmtp.conf /etc/ssmtp/ssmtp.conf
/usr/bin/sudo /usr/sbin/pon 295caext

  After hanging up after a dialup session, I have to reset ssmtp to use
my ADSL provider's MTA server, and restart eth0...

#!/bin/bash
/usr/bin/sudo /usr/sbin/poff
/usr/bin/sudo /usr/bin/cp -f /etc/ssmtp/istop.ssmtp.conf /etc/ssmtp/ssmtp.conf
/usr/bin/sudo /etc/init.d/net.eth0 restart

  Is it possible to set things up so that...

- when only eth0 is active, everything routes via 192.168.123.254

- when both eth0 and ppp0 are active, my little LAN on 192.168.123.248/29
  (aka netmask 255.255.255.248) routes via 192.168.123.254 and everything
  else routes through ppp0?

  My current /etc/conf.d/net looks like so...

config_eth0="192.168.123.252 broadcast 192.168.123.255 netmask 255.255.255.248 mtu 1452"
routes_eth0=("default via 192.168.123.254")


-- 
Walter Dnes <waltdnes@waltdnes.org> In linux /sbin/init is Job #1
Q. Mr. Ghandi, what do you think of Microsoft security?
A. I think it would be a good idea.
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] Setting up complex routes for pppd with /etc/conf.d/net [SOLVED]
  2007-04-13  4:07   ` Walter Dnes
@ 2007-04-13  4:37     ` Sascha Hlusiak
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hlusiak @ 2007-04-13  4:37 UTC (permalink / raw
  To: gentoo-user; +Cc: Walter Dnes

[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]

>   Is it possible to set things up so that...
>
> - when only eth0 is active, everything routes via 192.168.123.254
>
> - when both eth0 and ppp0 are active, my little LAN on 192.168.123.248/29
>   (aka netmask 255.255.255.248) routes via 192.168.123.254 and everything
>   else routes through ppp0?
What do you want to route through 192.168.123.254? What is behind the router? 
>
>   My current /etc/conf.d/net looks like so...
>
> config_eth0="192.168.123.252 broadcast 192.168.123.255 netmask
> 255.255.255.248 mtu 1452" routes_eth0=("default via 192.168.123.254")
Why did you need to take down eth0? Deleting the default route before dialing 
up should be enough to have both, the LAN reachable and the Internet through 
ppp0.

But I just learned, that you can have more default routes and prioritize them 
using the metric. If your pppd is complaining, "not replacing existing 
default route", set the metric of route_eth0 to 10 and add the two lines to 
conf.d/net:
config_ppp0=("null")
routes_ppp0=("default dev ppp0 metric 9")

And ln -s /etc/init.d/net.lo /etc/init.d/net.ppp0

This should add the favoured default route over ppp0.


- Sascha

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-04-13  4:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200704121121.14577.saschahlusiak@arcor.de>
2007-04-12 16:29 ` [gentoo-user] Setting up complex routes for pppd with /etc/conf.d/net [SOLVED] Sascha Hlusiak
2007-04-13  4:07   ` Walter Dnes
2007-04-13  4:37     ` Sascha Hlusiak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox