Dog-One
24th November 2004, 05:09 AM
For starters, I used Phil Karn's (http://www.ka9q.net/5220.html) example, but it just wasn't enough to suit me. I needed something that behaved more like a solid DSL or cable connection.
For my setup, I dedicated an older Micron Transport ZX laptop to be my firewall/gateway to the Internet. I have another server on my LAN that handles DNS, DHCP and email so I won't go into that here. Another option that I'm still considering is to use an old P2 233 machine with a CardBus controller to handle the 5220 pcmcia card. I like the laptop solution for now because of the built-in battery backup, built-in display and the fact that it takes very little space.
The basic problem with the Verizon Wireless Broadband in my area is that it's not a rock-solid connection. When I first got it going using Phil's method, I noticed it only took a few days for the connection to get hosed up to the point that I had to reboot the machine. And if you're away and using a mail server to collect email and the system hangs, you're screwed. With no connection you can't ssh in or do anything until you again get physical access to the box. This just wasn't going to fly, so I made several improvements to how things work.
First off, I bypassed the normal method of treating pppd like a typical network connection. ppp-watch just isn't consistant--things get out of sync and stay that way too easily. My approach was to put everything necessary for the connection in the /etc/ppp/options file, then make pppd load like a regular getty daemon by adding an entry to /etc/inittab#/etc/ppp/options
debug
logfile /var/log/ppp/pppd
show-password
linkname ppp0
nodetach
# Connection setup options
lock
local
ttyUSB0
115200
asyncmap 00000000
connect "/usr/sbin/chat -v -t 30 -f /etc/ppp/chat"
# Authentication options
name firewall
user "<your phone #>@vzw3g.com"
remotename ppp0
# And the rest
silent
nomultilink
nobsdcomp
nodeflate
novjccomp
#noaccomp
#nopcomp
#noccp
#novj
defaultroute#/etc/inittab entry
# Connect with Verizon Wireless in mode 3
pppd:3:respawn:/usr/sbin/pppdI also found wvdial to get a little flakey so I went back to tried-n-true chat. Here's the script stored in /etc/ppp/chat'' ATZ
OK ATE0
OK AT+CAD?
1 AT+CSS?
139 AT+CSQ?
OK AT+CQD=0
OK AT+CTA=0
OK ATD#777
CONNECTThe 139 is for my area, so you'll either need to remove that entry or find out what code you need. This script could certainly be simplified, but I have left mine this way to debug since the dialog ends up in the syslog for later review should something not be working properly.
The next step was to write a script that monitors what's going on an keep the link up should anything go astray. I named it linkcheck and stuck the script in /usr/local/sbin.#!/bin/bash
#
#/usr/local/sbin/linkcheck
#
# Do not run multiple copies of this script
[ -f /var/run/linkcheck.pid ] && exit 3
pgrep linkcheck > /var/run/linkcheck.pid
LOG=/var/log/linkcheck
DATE=`date +%F:%T`
echo -e "\n$DATE\tLinkcheck Started" >> $LOG
aplay -q /usr/local/sounds/start.wav
#IP definitions for myvzw.com DNS nameservers in my area
NS1=66.174.3.7
NS2=66.174.6.7
ORX=0
while [ -f /etc/ppp/options ]; do
# Lets wait three minutes before we check things.
sleep 180
# See if our dial-up interface (ppp0) is even there
GW=`ip route | grep default | awk '{print $3}'`
if [ -z "$GW" ]; then
DATE=`date +%F:%T`
echo -e "\n$DATE\tLink Down" >> $LOG
aplay -q /usr/local/sounds/down.wav
sleep 60
GW=`ip route | grep default | awk '{print $3}'`
if [ -z "$GW" ]; then
DATE=`date +%F:%T`
echo -e "\n$DATE\tLink Still Down" >> $LOG
aplay -q /usr/local/sounds/still.wav
# We need to access the modem directly and see if
# we can talk to it before we actually reboot the
# system.
telinit 2
sleep 30
chat -v -t 5 '' 'AT&F' 'OK' < /dev/ttyUSB0 > /dev/ttyUSB0
if [ $? -ne 0 ]; then
DATE=`date +%F:%T`
echo -e "\n$DATE\tModem not Responding -- Rebooting..." >> $LOG
aplay -q /usr/local/sounds/reboot.wav
sleep 15
telinit 6
exit 2
else
DATE=`date +%F:%T`
echo -e "\n$DATE\tModem Works, Updating PRL and Rebooting" >> $LOG
aplay -q /usr/local/sounds/update.wav
chat -v -t 45 '' 'AT+CDV=*22899' < /dev/ttyUSB0 > /dev/ttyUSB0
telinit 6
fi
continue
fi
fi
# First we should see if we are receiving any data
RX="`ifconfig ppp0 | grep 'RX packets' | awk '{print $2}' | sed -e 's/.*://'`"
if [ $RX != $ORX ]; then
echo -n "+" >> $LOG
ORX=$RX
continue
fi
# Log a marker to show that no data received
echo -n "-" >> $LOG
aplay -q /usr/local/sounds/ping.wav
# If no packets received then test link by pinging gateway and nameservers
NMAP=`nmap --min_rtt_timeout 8500 -sP -PE $GW $NS1 $NS2 | grep "appears to be up."`
if [ -n "$NMAP" ]; then
continue;
fi
MYIP=`ip route | grep "ppp0 proto" | awk '{print $9}'`
DATE=`date +%F:%T`
echo -e "\n$DATE\tNo Response from ($GW), ($NS1) or ($NS2) via ($MYIP)" >> $LOG
aplay -q /usr/local/sounds/noping.wav
# If the pings fail then kill pppd and let INIT restart it.
if [ -f /var/run/ppp0.pid ]; then
PPPD=`cat /var/run/ppp0.pid`
DATE=`date +%F:%T`
echo -e "\n$DATE\tKilling pppd Process ID $PPPD" >> $LOG
aplay -q /usr/local/sounds/kill.wav
kill -15 $PPPD
fi
done
exit 1This script has some level of complexity to it; here's the basic idea:
First we see if any data is coming in on the ppp0 interface, if it is, the link must be okay. If it isn't things may be idle so lets ping some short hop nodes and see if we get any replies. If that fails, then something is really wrong so we kill the current pppd process and reconnect.
Now you may notice the aplay commands, these are audio prompts that I used while developing this script. You can create some wav files and use them as I do or delete those commands entirely since everything is logged to /var/log/linkcheck anyway.
Another thing to notice is the telinit 2 command. This command puts Linux in run mode 2, from the normal run mode 3 that I use. My initscripts are setup in such a way that run mode 2 is identical to run mode 3, except for one small detail. In run mode 2, inittab disables the pppd daemon. This is required to stop pppd from accessing the hardware, so that a simple chat script can talk to the 5220 modem.
So you may be wondering, how does linkcheck get started. Well I wrote a simple initscript for it and saved it as /etc/rc.d/init.d/linkcheck#!/bin/bash
#
# linkcheck: Starts the linkcheck pppd monitor
#
# description: The linkcheck monitor is a shell script that watches
# the Internet link created by pppd and ensures that
# the connection is sound.
#
# processname: /usr/local/sbin/linkcheck
#
# Sanity checks.
[ -f /usr/local/sbin/linkcheck ] || exit 0
[ -x /usr/local/sbin/linkcheck ] || exit 0
# Source function library.
. /etc/init.d/functions
RETVAL=0
prog=linkcheck
start () {
action $"Starting $prog: " /bin/true
/usr/local/sbin/linkcheck &
touch /var/lock/subsys/linkcheck
return 0
}
stop () {
echo -n
killproc /usr/local/sbin/linkcheck
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
action $"Stopping $prog: " /bin/true
rm -f /var/lock/subsys/linkcheck
rm -f /var/run/linkcheck.pid
else
action $"Stopping $prog: " /bin/false
fi
return $RETVAL
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
status)
status linkcheck
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
condrestart)
[ -e /var/lock/subsys/linkcheck ] && restart
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
RETVAL=1
;;
esac
exit $RETVALA funny thing with FC3 is this new concept of udev. Getting the AudioVox 5220 card to even be accessible is a bit of a choir. First you need some entries in /etc/modprobe.confalias char-major-188-0 usbserial
options usbserial vendor=0x0f3d product=0x0112This much will automatically load usbserial when /dev/ttyUSB0 is accessed. But when you boot FC3, by default there is no /dev/ttyUSB0, so you have to create it, not once, but every time you boot. My quick-n-dirty solution was to addmknod /dev/ttyUSB0 c 188 0 to my /etc/rc.d/rc.local file. Once I fully understand udev and how to customize it, I may do this differently.
I don't know if there are any users out there that have or would like to get Verizon Wireless Broadband and use it with Fedora Linux, but if there is, I hope you find this info useful. I plan to stay on top of things since this is the only way I can get Internet at my current location unless someone would like to order and pay for a fractional T1 that I can use. :)
For my setup, I dedicated an older Micron Transport ZX laptop to be my firewall/gateway to the Internet. I have another server on my LAN that handles DNS, DHCP and email so I won't go into that here. Another option that I'm still considering is to use an old P2 233 machine with a CardBus controller to handle the 5220 pcmcia card. I like the laptop solution for now because of the built-in battery backup, built-in display and the fact that it takes very little space.
The basic problem with the Verizon Wireless Broadband in my area is that it's not a rock-solid connection. When I first got it going using Phil's method, I noticed it only took a few days for the connection to get hosed up to the point that I had to reboot the machine. And if you're away and using a mail server to collect email and the system hangs, you're screwed. With no connection you can't ssh in or do anything until you again get physical access to the box. This just wasn't going to fly, so I made several improvements to how things work.
First off, I bypassed the normal method of treating pppd like a typical network connection. ppp-watch just isn't consistant--things get out of sync and stay that way too easily. My approach was to put everything necessary for the connection in the /etc/ppp/options file, then make pppd load like a regular getty daemon by adding an entry to /etc/inittab#/etc/ppp/options
debug
logfile /var/log/ppp/pppd
show-password
linkname ppp0
nodetach
# Connection setup options
lock
local
ttyUSB0
115200
asyncmap 00000000
connect "/usr/sbin/chat -v -t 30 -f /etc/ppp/chat"
# Authentication options
name firewall
user "<your phone #>@vzw3g.com"
remotename ppp0
# And the rest
silent
nomultilink
nobsdcomp
nodeflate
novjccomp
#noaccomp
#nopcomp
#noccp
#novj
defaultroute#/etc/inittab entry
# Connect with Verizon Wireless in mode 3
pppd:3:respawn:/usr/sbin/pppdI also found wvdial to get a little flakey so I went back to tried-n-true chat. Here's the script stored in /etc/ppp/chat'' ATZ
OK ATE0
OK AT+CAD?
1 AT+CSS?
139 AT+CSQ?
OK AT+CQD=0
OK AT+CTA=0
OK ATD#777
CONNECTThe 139 is for my area, so you'll either need to remove that entry or find out what code you need. This script could certainly be simplified, but I have left mine this way to debug since the dialog ends up in the syslog for later review should something not be working properly.
The next step was to write a script that monitors what's going on an keep the link up should anything go astray. I named it linkcheck and stuck the script in /usr/local/sbin.#!/bin/bash
#
#/usr/local/sbin/linkcheck
#
# Do not run multiple copies of this script
[ -f /var/run/linkcheck.pid ] && exit 3
pgrep linkcheck > /var/run/linkcheck.pid
LOG=/var/log/linkcheck
DATE=`date +%F:%T`
echo -e "\n$DATE\tLinkcheck Started" >> $LOG
aplay -q /usr/local/sounds/start.wav
#IP definitions for myvzw.com DNS nameservers in my area
NS1=66.174.3.7
NS2=66.174.6.7
ORX=0
while [ -f /etc/ppp/options ]; do
# Lets wait three minutes before we check things.
sleep 180
# See if our dial-up interface (ppp0) is even there
GW=`ip route | grep default | awk '{print $3}'`
if [ -z "$GW" ]; then
DATE=`date +%F:%T`
echo -e "\n$DATE\tLink Down" >> $LOG
aplay -q /usr/local/sounds/down.wav
sleep 60
GW=`ip route | grep default | awk '{print $3}'`
if [ -z "$GW" ]; then
DATE=`date +%F:%T`
echo -e "\n$DATE\tLink Still Down" >> $LOG
aplay -q /usr/local/sounds/still.wav
# We need to access the modem directly and see if
# we can talk to it before we actually reboot the
# system.
telinit 2
sleep 30
chat -v -t 5 '' 'AT&F' 'OK' < /dev/ttyUSB0 > /dev/ttyUSB0
if [ $? -ne 0 ]; then
DATE=`date +%F:%T`
echo -e "\n$DATE\tModem not Responding -- Rebooting..." >> $LOG
aplay -q /usr/local/sounds/reboot.wav
sleep 15
telinit 6
exit 2
else
DATE=`date +%F:%T`
echo -e "\n$DATE\tModem Works, Updating PRL and Rebooting" >> $LOG
aplay -q /usr/local/sounds/update.wav
chat -v -t 45 '' 'AT+CDV=*22899' < /dev/ttyUSB0 > /dev/ttyUSB0
telinit 6
fi
continue
fi
fi
# First we should see if we are receiving any data
RX="`ifconfig ppp0 | grep 'RX packets' | awk '{print $2}' | sed -e 's/.*://'`"
if [ $RX != $ORX ]; then
echo -n "+" >> $LOG
ORX=$RX
continue
fi
# Log a marker to show that no data received
echo -n "-" >> $LOG
aplay -q /usr/local/sounds/ping.wav
# If no packets received then test link by pinging gateway and nameservers
NMAP=`nmap --min_rtt_timeout 8500 -sP -PE $GW $NS1 $NS2 | grep "appears to be up."`
if [ -n "$NMAP" ]; then
continue;
fi
MYIP=`ip route | grep "ppp0 proto" | awk '{print $9}'`
DATE=`date +%F:%T`
echo -e "\n$DATE\tNo Response from ($GW), ($NS1) or ($NS2) via ($MYIP)" >> $LOG
aplay -q /usr/local/sounds/noping.wav
# If the pings fail then kill pppd and let INIT restart it.
if [ -f /var/run/ppp0.pid ]; then
PPPD=`cat /var/run/ppp0.pid`
DATE=`date +%F:%T`
echo -e "\n$DATE\tKilling pppd Process ID $PPPD" >> $LOG
aplay -q /usr/local/sounds/kill.wav
kill -15 $PPPD
fi
done
exit 1This script has some level of complexity to it; here's the basic idea:
First we see if any data is coming in on the ppp0 interface, if it is, the link must be okay. If it isn't things may be idle so lets ping some short hop nodes and see if we get any replies. If that fails, then something is really wrong so we kill the current pppd process and reconnect.
Now you may notice the aplay commands, these are audio prompts that I used while developing this script. You can create some wav files and use them as I do or delete those commands entirely since everything is logged to /var/log/linkcheck anyway.
Another thing to notice is the telinit 2 command. This command puts Linux in run mode 2, from the normal run mode 3 that I use. My initscripts are setup in such a way that run mode 2 is identical to run mode 3, except for one small detail. In run mode 2, inittab disables the pppd daemon. This is required to stop pppd from accessing the hardware, so that a simple chat script can talk to the 5220 modem.
So you may be wondering, how does linkcheck get started. Well I wrote a simple initscript for it and saved it as /etc/rc.d/init.d/linkcheck#!/bin/bash
#
# linkcheck: Starts the linkcheck pppd monitor
#
# description: The linkcheck monitor is a shell script that watches
# the Internet link created by pppd and ensures that
# the connection is sound.
#
# processname: /usr/local/sbin/linkcheck
#
# Sanity checks.
[ -f /usr/local/sbin/linkcheck ] || exit 0
[ -x /usr/local/sbin/linkcheck ] || exit 0
# Source function library.
. /etc/init.d/functions
RETVAL=0
prog=linkcheck
start () {
action $"Starting $prog: " /bin/true
/usr/local/sbin/linkcheck &
touch /var/lock/subsys/linkcheck
return 0
}
stop () {
echo -n
killproc /usr/local/sbin/linkcheck
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
action $"Stopping $prog: " /bin/true
rm -f /var/lock/subsys/linkcheck
rm -f /var/run/linkcheck.pid
else
action $"Stopping $prog: " /bin/false
fi
return $RETVAL
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
status)
status linkcheck
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
condrestart)
[ -e /var/lock/subsys/linkcheck ] && restart
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
RETVAL=1
;;
esac
exit $RETVALA funny thing with FC3 is this new concept of udev. Getting the AudioVox 5220 card to even be accessible is a bit of a choir. First you need some entries in /etc/modprobe.confalias char-major-188-0 usbserial
options usbserial vendor=0x0f3d product=0x0112This much will automatically load usbserial when /dev/ttyUSB0 is accessed. But when you boot FC3, by default there is no /dev/ttyUSB0, so you have to create it, not once, but every time you boot. My quick-n-dirty solution was to addmknod /dev/ttyUSB0 c 188 0 to my /etc/rc.d/rc.local file. Once I fully understand udev and how to customize it, I may do this differently.
I don't know if there are any users out there that have or would like to get Verizon Wireless Broadband and use it with Fedora Linux, but if there is, I hope you find this info useful. I plan to stay on top of things since this is the only way I can get Internet at my current location unless someone would like to order and pay for a fractional T1 that I can use. :)