Last time I did this I use pppd in demand mode. On a Debian system it's
pretty simple:

add "demand" (without quotes) to /etc/ppp/options
mv no_ppp_on_boot ppp_on_boot

Restart pppd
/etc/init.d/ppp restart

Read up on the Dial-on-Demand HOWTO, but I don't think there's much more
to it than that.

Andrew S. Zbikowski | http://www.ringworld.org
"The irony is that Bill Gates claims to be making
a stable operating system and Linus Torvalds claims
to be trying to take over the world."