* ppp question
@ 2009-10-05 16:38 Davy Leon
2009-10-05 17:33 ` Bill Unruh
2009-10-05 17:38 ` James Carlson
0 siblings, 2 replies; 3+ messages in thread
From: Davy Leon @ 2009-10-05 16:38 UTC (permalink / raw)
To: linux-ppp
Hi folks
I have a question. Every time I dialup to the internet pppd executes an
script called ip-up. My question is, everytime someone dials in it's
executed too? If the answer is yes, how can I handle the script to execute
one part when dianing out and another part when dialing in. I meant
something like
if dialing in then
...
...
if dialing out then
...
....
Thanks in advance
David
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ppp question
2009-10-05 16:38 ppp question Davy Leon
@ 2009-10-05 17:33 ` Bill Unruh
2009-10-05 17:38 ` James Carlson
1 sibling, 0 replies; 3+ messages in thread
From: Bill Unruh @ 2009-10-05 17:33 UTC (permalink / raw)
To: linux-ppp
On Mon, 5 Oct 2009, Davy Leon wrote:
> Hi folks
>
> I have a question. Every time I dialup to the internet pppd executes an
> script called ip-up. My question is, everytime someone dials in it's executed
> too? If the answer is yes, how can I handle the script to execute one part
> when dianing out and another part when dialing in. I meant something like
One of the arguments given to ip-up is the IP addresses assigned to the remote
and local systems. Since when someone calls in the IP address is assigned by
you and is almost certainly different from the IP address assigned to you when
you dial out. You can base the response on the IP address range
man pppd
>
> if dialing in then
>
> ...
> ...
>
> if dialing out then
>
> ...
> ....
>
>
>
> Thanks in advance
>
> David
> --
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ppp question
2009-10-05 16:38 ppp question Davy Leon
2009-10-05 17:33 ` Bill Unruh
@ 2009-10-05 17:38 ` James Carlson
1 sibling, 0 replies; 3+ messages in thread
From: James Carlson @ 2009-10-05 17:38 UTC (permalink / raw)
To: linux-ppp
Davy Leon wrote:
> I have a question. Every time I dialup to the internet pppd executes an
> script called ip-up. My question is, everytime someone dials in it's
> executed too?
Yes. It's executed every time an IP interface is brought up by PPP.
Note that PPP itself knows nothing about dialing in or out; those are
attributes of the lower layer -- the chat script and modems or other
communications gear involved. PPP is symmetric and peer-to-peer.
There's no "client" or "server."
> If the answer is yes, how can I handle the script to
> execute one part when dianing out and another part when dialing in. I
> meant something like
The man page has a number of environment variables documented that you
could use for this task. $PEERNAME is fairly useful -- it will be set
only if you have an authenticated peer name.
If you have different devices for dialing in and out (it's often a good
idea to do this, but not always done), then $DEVICE might tell you what
you want to know.
If you want to get fancier, you can use $LINKNAME with the "linkname"
option.
The simple answer would be:
if [[ -n ${PEERNAME:+I_am_server} ]]; then
# the peer probably called me
else
# I'm probably dialing out
fi
But note that this is making a big assumption about authentication
configuration: that you always authenticate people calling you, and you
never authenticate people you call. That's how PPP is commonly used,
but there's nothing in the standards that _requires_ it to be used that way.
--
James Carlson 42.703N 71.076W <carlsonj@workingcode.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-05 17:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-05 16:38 ppp question Davy Leon
2009-10-05 17:33 ` Bill Unruh
2009-10-05 17:38 ` James Carlson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).