Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.system > #63094 > unrolled thread

/etc/ppp/ip-up: how to distinguish service?

Started byMathias Kőrber <mathias@koerber.org>
First post2014-08-08 11:32 +0800
Last post2014-08-18 20:44 +0800
Articles 5 — 2 participants

Back to article view | Back to comp.sys.mac.system


Contents

  /etc/ppp/ip-up: how to distinguish service? Mathias Kőrber <mathias@koerber.org> - 2014-08-08 11:32 +0800
    Re: /etc/ppp/ip-up: how to distinguish service? David Sankey <David.Sankey@stfc.ac.uk> - 2014-08-12 13:35 +0100
      Re: /etc/ppp/ip-up: how to distinguish service? Mathias Kőrber <mathias@koerber.org> - 2014-08-13 18:23 +0800
        Re: /etc/ppp/ip-up: how to distinguish service? David Sankey <David.Sankey@stfc.ac.uk> - 2014-08-18 09:05 +0100
          Re: /etc/ppp/ip-up: how to distinguish service? Mathias Kőrber <mathias@koerber.org> - 2014-08-18 20:44 +0800

#63094 — /etc/ppp/ip-up: how to distinguish service?

FromMathias Kőrber <mathias@koerber.org>
Date2014-08-08 11:32 +0800
Subject/etc/ppp/ip-up: how to distinguish service?
Message-ID<c4iumrFnfv8U1@mid.individual.net>
Moin,

I am still running Mountain Lion.

I defined two L2TP VPNs in System Prefs/Networking

For the first, i used /etc/ppp/ip-up to tune the routing
for when the VPN is up. This works fine.

However, I need different routing setup for the second VPN,
but there does not seem to be a way to distinguish in /etc/ppp/ip-up
which VPN service was called, nor is there apparently a way to select
a different ip-up script.

Does anyone have a hint how to accomplish this?

thanks
M

[toc] | [next] | [standalone]


#63181

FromDavid Sankey <David.Sankey@stfc.ac.uk>
Date2014-08-12 13:35 +0100
Message-ID<lsd1m8$vgi$1@dont-email.me>
In reply to#63094
On 08/08/2014 04:32, Mathias Kőrber wrote:
> Moin,
>
> I am still running Mountain Lion.
>
> I defined two L2TP VPNs in System Prefs/Networking
>
> For the first, i used /etc/ppp/ip-up to tune the routing
> for when the VPN is up. This works fine.
>
> However, I need different routing setup for the second VPN,
> but there does not seem to be a way to distinguish in /etc/ppp/ip-up
> which VPN service was called, nor is there apparently a way to select
> a different ip-up script.
>
> Does anyone have a hint how to accomplish this?

man pppd is your friend, look for the section SCRIPTS.

This lists the environment variables that are defined when ip-up is run.

At a guess look at $IPREMOTE/$5

Leastways, that's how I diffentiate between VPN's in my ip-up!

Dave

[toc] | [prev] | [next] | [standalone]


#63199

FromMathias Kőrber <mathias@koerber.org>
Date2014-08-13 18:23 +0800
Message-ID<c50skhFkk7oU1@mid.individual.net>
In reply to#63181
On 12/8/14 20:35, David Sankey wrote:
> On 08/08/2014 04:32, Mathias Kőrber wrote:
>> Moin,
>>
>> I am still running Mountain Lion.
>>
>> I defined two L2TP VPNs in System Prefs/Networking
>>
>> For the first, i used /etc/ppp/ip-up to tune the routing
>> for when the VPN is up. This works fine.
>>
>> However, I need different routing setup for the second VPN,
>> but there does not seem to be a way to distinguish in /etc/ppp/ip-up
>> which VPN service was called, nor is there apparently a way to select
>> a different ip-up script.
>>
>> Does anyone have a hint how to accomplish this?
> 
> man pppd is your friend, look for the section SCRIPTS.
> 
> This lists the environment variables that are defined when ip-up is run.

Hmm. I executed 'env' in my ip-up script itself and found no
distinguishing info
> 
> At a guess look at $IPREMOTE/$5

> Leastways, that's how I diffentiate between VPN's in my ip-up!

That might work if you have VPNs going to different endpoints.

I want to have two different setups going to the same service.
One redirects *ALL* my traffic there, while the other only a certain
subsets of routes (which is done in the ip-up script).

However, I cannot in the ip-up script distinguish which of the two
services were called..

[toc] | [prev] | [next] | [standalone]


#63350

FromDavid Sankey <David.Sankey@stfc.ac.uk>
Date2014-08-18 09:05 +0100
Message-ID<lssc4v$eag$1@dont-email.me>
In reply to#63199
On 13/08/2014 11:23, Mathias Kőrber wrote:
> On 12/8/14 20:35, David Sankey wrote:
>> On 08/08/2014 04:32, Mathias Kőrber wrote:
>>> Moin,
>>>
>>> I am still running Mountain Lion.
>>>
>>> I defined two L2TP VPNs in System Prefs/Networking
>>>
>>> For the first, i used /etc/ppp/ip-up to tune the routing
>>> for when the VPN is up. This works fine.
>>>
>>> However, I need different routing setup for the second VPN,
>>> but there does not seem to be a way to distinguish in /etc/ppp/ip-up
>>> which VPN service was called, nor is there apparently a way to select
>>> a different ip-up script.
>>>
>>> Does anyone have a hint how to accomplish this?
>>
>> man pppd is your friend, look for the section SCRIPTS.
>>
>> This lists the environment variables that are defined when ip-up is run.
>
> Hmm. I executed 'env' in my ip-up script itself and found no
> distinguishing info
>>
>> At a guess look at $IPREMOTE/$5
>
>> Leastways, that's how I diffentiate between VPN's in my ip-up!
>
> That might work if you have VPNs going to different endpoints.
>
> I want to have two different setups going to the same service.
> One redirects *ALL* my traffic there, while the other only a certain
> subsets of routes (which is done in the ip-up script).
>
> However, I cannot in the ip-up script distinguish which of the two
> services were called..

The way I acheive that is based on Location.

I have one Location where I want to route everything over the VPN, 
another where I don't.  I check which Location is active in ip-up:

         location=`/usr/sbin/scselect 2>&1 | /usr/bin/grep '^ \* ' |\
                 /usr/bin/sed -e 's/^.*(//' -e 's/).*$//'`

Dave

[toc] | [prev] | [next] | [standalone]


#63352

FromMathias Kőrber <mathias@koerber.org>
Date2014-08-18 20:44 +0800
Message-ID<c5eaohFem7aU1@mid.individual.net>
In reply to#63350
> I have one Location where I want to route everything over the VPN, 
> another where I don't.  I check which Location is active in ip-up:
> 
>          location=`/usr/sbin/scselect 2>&1 | /usr/bin/grep '^ \* ' |\
>                  /usr/bin/sed -e 's/^.*(//' -e 's/).*$//'`

Thanks. That might work but requires me to change the location, which
I have other things tied to..

I just found that one do what I want in AppleScript:

#!/usr/bin/osascript
tell application "System Events"
    tell current location of network preferences
        get name of every service whose (kind is equal 12) and connected
of current configuration is true
    end tell
end tell

which can then be called from /etc/ppp/ip-up

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.mac.system


csiph-web