PPP demand dial with modem bank in linux

I have a linux box with a bank of modems and need to create demand-dial (outbound) PPP connections to a very large set of remote machines. Since I have far more remotes than local modems, I'd like to launch one or more instances of pppd in demand mode, but not allocate a particular modem until a connection is requested. When the connection becomes idle, I'd like pppd to release the modem so it can be used for a connection to a different remote.

I've been through the pppd man pages and understand the concepts of the call and connect options, as well as the options.DEVICE files and the /etc/ppp/peers directory. Lock files will tell me which modems are in use or available. And I'm able to connect to multiple remote peers as long as I hard-code the modem assignments. But I haven't found a way to assign them dynamically, say by calling a get_available_modem script when pppd needs to dial. Google doesn't seem to know, either.

A work-around might be to detect the need to demand-dial with an external mechanism, and then launch pppd to service it, but it seems cleaner to leverage the facility within pppd itself.

Any pointers or ideas are appreciated. Thanks for your thoughts!


This is the solution I'm going with:

  • Enumerate the modems as /dev/modem0, /dev/modem1, ...
  • Start an instance of pppd in demand-dial mode for each peer, but instead of a "real" modem, attach it to /dev/modem.peer, which the "ppp-on-dialer" script soft-links to the first available modem dynamically.
  • When the connection times out and the modem goes offline, soft link /dev/modem.peer to /dev/null so the modem can be re-used for a connection to a different peer.

Thanks for your comments!

Need Your Help

Chrome Extensions : Get all images on page

javascript image google-chrome-extension

After hours of reading in the Google-Documentations and Stackoverflow I decided to post this question. There already are some similar ones but I haven't found a answer that really helped me.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.