Listing 4. /etc/ppp/diald-up Script

#!/bin/sh

# remove default route so diald can have it
route del default

# start diald
/usr/sbin/diald /dev/cua0 -m ppp modem \
local 10.10.10.1 remote 192.168.1.2 dynamic \
defaultroute fifo /etc/diald.fifo \
redial-timeout 5 \
connect \
 '/usr/sbin/chat -f /etc/ppp/chat-ppp0 </dev/cua0 >/dev/cua0'

#
# set up firewall stuff
#

# flush the forwarding list
/sbin/ipfwadm -F -f

# default to denying service
/sbin/ipfwadm -F -p deny

# forward and masquerade packets from my network to the internet
/sbin/ipfwadm -F -a m -S 10.10.10.0/24 -D 0.0.0.0/0