Discussion:
Dial a different phone num for each IP
(too old to reply)
Aleksander K
2007-01-21 06:13:03 UTC
Permalink
Hello,
Is it possible to dial a different phone number depending upon
the IP of the packet that caused pppd to try to connect? I can't see
anything indicating so in the documentation, or in days of searching
and posting and hacking.

One way is for the connect script to be called with arguments or env
vars set that indicate the destination IP, but the documentation (man 8
pppd) indicates that this does not happen.

Network: 40+ remote hosts that are dialed on demand from the office
(just the opposite of the usual scenario). It's a data collection and
process control system.

I'm using pppd+wvdial on debian but will do whatever is necessary.

Sincerely,
Aleksander
Unruh
2007-01-21 18:51:20 UTC
Permalink
Post by Aleksander K
Hello,
Is it possible to dial a different phone number depending upon
the IP of the packet that caused pppd to try to connect? I can't see
anything indicating so in the documentation, or in days of searching
and posting and hacking.
Not that I know, but is it necessary? Each of those machines being called
is disconnected from the net? Ie, you cannot call one and then connect to
the others through that one?

It does not look to me like there is any ability in pppd to do what you
want. But you might be able to hack the code to do it (although it looks
not trivial, since all the code does is check to see if there is an
appropriate packet and sets up the link-- it does not read the packet and
extract things like IP address from the packet.-- it assumes that the
routing has properly handed thepacket to ppp to send.

Ie I think it may be up to the program which is sending the packet to
notify pppd of which number it wants to call-- eg set up a file into which
the program dumps the IP address it wants to call and the connect script
can then read that file.

Surely the requests do not come randomly since you have only one telephone
line and when it is in use, the request could not get through anyway.
Ie you would need some sort of locking mechanism anyway to make sure that
the phone was free when the program wanted to get the info. Use that
locking mechanism to also record the phone number or IP youwant it to use.
Post by Aleksander K
One way is for the connect script to be called with arguments or env
vars set that indicate the destination IP, but the documentation (man 8
pppd) indicates that this does not happen.
Network: 40+ remote hosts that are dialed on demand from the office
(just the opposite of the usual scenario). It's a data collection and
process control system.
I'm using pppd+wvdial on debian but will do whatever is necessary.
Sincerely,
Aleksander
Aleksander K
2007-01-22 06:46:49 UTC
Permalink
Bingo! You've nailed it perfectly Unruh: all you said is exactly the
situation (yes, each of the remote machines is disconnected from _any_
net), and since my code elsewhere is responsible for bringing up the
line, I can darn well add a lock file with IP address in it. Brilliant!
Thinking outside the box, that's just what I needed! Many thanks.
Sincerely,
Aleksander
(I'm a fellow Canuk, BTW, adrift in Dubai where there's sand and
concrete in all directions, and there you are at UBC essentially in a
forest: I'm envious)
Pascal Hambourg
2007-01-22 15:43:33 UTC
Permalink
Hello,
Post by Aleksander K
Is it possible to dial a different phone number depending upon
the IP of the packet that caused pppd to try to connect?
Do you use the 'demand' option with pppd ?
If yes, it can be done by setting up routes via different PPP
interfaces, although it may not solve your problem.

Loading...