Dial on demand on BSD

October 27, 2006

This is an old post .. from my first blog about Dial On Demand (DoD) on BSD systems. I think it might be useful for some people so I’m reposting it. Bare in mind that this post is a bit old , and some things my not be so accurate, but the logic behind it is still valid.

For a lot of reasons, I had to reboot my old pc at home to use it. (Actually even the newer stuff that i have at home are quite old, except my SUN blade 150) This PC has not been rebooted for almost 2 years, so when i booted it I found some of the stuff that i was doing back then. One of the things I did was to setup Dial On Demand. I usually have my desktop on so i just ping someplace, or use the browser and it automatically dials, get the data, and after some time just hand up (if i don’t use the net).

In FreeBSD (that I have tested it, but this should also work on OpenBSD) there are two ways for using dial up: ppp and pppd. Both of them offer more or less the same functionality regarding DoD, but I do preffer ppp and for me it worked better on many occasion that pppd. So i post the configuration files that enable Dial-On-Demand:

  • PPP:
  • default:
    set log Phase Chat LCP IPCP CCP tun command
    ident user-ppp VERSION (built COMPILATIONDATE)
    # Ensure that \"device\" references the correct serial port
    # for your
    modem. (cuaa0 = COM1, cuaa1 = COM2)
    #
    set device /dev/cuaa1
    set server /tmp/ppp nicePassword 0177
    set speed 115200
    set dial \"ABORT BUSY ABORT NOsCARRIER TIMEOUT 5 \"\" AT OK-AT-OK ATE1Q0 OK dATDTT TIMEOUT 40 CONNECT\"
    enable dns # request DNS info (for resolv.conf)
    isp:
    # edit the next three lines and replace the items in caps with
    # the values which have been assigned
    by your ISP.
    #
    set phone 66666666666
    set authname bofh
    set authkey key

    set timeout 30
    set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
    add default HISADDR # Add a (sticky) default route

    set filter dial 0 permit tcp dst eq 22
    set filter dial 1 permit 0/0 ping.host icmp
    set filter dial 2 deny 0/0 0/0

    set filter alive 0 permit tcp dst eq 22
    set filter alive 1 permit tcp estab
    set filter alive 2 permit 0/0 ping.host icmp
    set filter alive 3 deny 0/0 0/0

    the server directive is used so that we can connect to the ppp that runs and change things from the console if we wish. (I have found it handy in cases that the first dial attempt failed (because i have forgotten to plug in the modem) and i want a fast redial).
    the dial filter is used to describe the traffic that will cause an outband dialing the active filter is used to describe the traffic that will keep the connection alive the timeout is the number of seconds that ppp is waiting to see any of the traffic that falls into the alive filter. Otherwise it hangs up the modem.
    the execution command is quite simple : (as root)
    #ppp -auto isp
    and voila. Dial on demand

  • PPPD:
  • eveyrything is as a normal pppd setup with the only difference in file /etc/ppp/options the lines :

    demand
    holdoff 10
    active-filter \'dst port 22\'
    idle 60
    call isp

    The active-filter directive is used to specify the packets that are considered link activity and they keep alive the connection or they initiate a dial on demand procedure.
    The execution command is also quite simple : (as root)
    #pppd
    and voila. Dial on demand

Actually PPP is more flexible that PPPD since you can specify different rules for bringing up the link that the ones who keep the link up, but PPPD is more standard that PPP since you can also have PPPD setup to linux machines.

Advertisements

One Response to “Dial on demand on BSD”


  1. […] Now this is a howto that I wish I had written.  When I find some time, I will try and verify it under DragonFlyBSD. […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: