<<
Bluetooth Dial Up Networking
use
hcitool scan and
sdptool browse to find your phone and DUN channel. Edit
/etc/bluetooth/rfcomm.conf and create an entry:
rfcomm0 {
bind no;
device 00:11:22:33:44:55;
channel 4;
comment "Pixel's Phone";
}
create an
/etc/wvdial.conf. This one is for Three UK:
[Dialer Defaults]
Init1=ATZ
Init2=ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3=AT+CGDCONT=1,"IP","three.co.uk","",0,0
modem=/dev/rfcomm0
Baud=460800
Modem Type=Analog Modem
ISDN=0
Phone = *99#
Username = user
Password = passwd
New PPPD = yes
Auto DNS = 1
Check Def Route = 1
The script below runs this, sets the default gateway, and sets nameservers. It guesses the nameservers and adds OpenDNS nameservers.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
#! /bin/sh
WVDIAL_PID=""
touch /etc/resolv.conf
touch /etc/resolv.conf.wv
LOG=/tmp/wvdial.log
trap "
#kill $WVDIAL_PID
killall wvdial
rm /etc/resolv.conf
mv /etc/resolv.conf.wv /etc/resolv.conf
while ! grep 'Disconnecting at' /tmp/wvdial.log ; do sleep 2 ; done
echo Disconnected
exit 0
" SIGINT
#SIGTERM
rfcomm bind 0
echo "connecting to ppp"
touch $LOG
wvdial > $LOG 2>&1 &
WVDIAL_PID=$!
while ! grep "econdary DNS" $LOG ; do sleep 2 ; done
sleep 2
#read line
echo "wvdial pid = $WVDIAL_PID"
echo "setting gateway and dns"
mv /etc/resolv.conf /etc/resolv.conf.wv
DNS1=`grep "primary.*DNS.*" $LOG | grep -o "address .*" | cut -d' ' -f2`
DNS2=`grep "secondary.*DNS.*" $LOG | grep -o "address .*" | cut -d' ' -f2`
> /etc/resolv.conf
if [ "$DNS1" != "" ] ; then echo "nameserver $DNS1" >> /etc/resolv.conf ; fi
if [ "$DNS2" != "" ] ; then echo "nameserver $DNS2" >> /etc/resolv.conf ; fi
echo "# add opendns entries
nameserver 208.67.222.222
nameserver 208.67.220.220" >> /etc/resolv.conf
route del default
route add default gw `ifconfig | grep -o "P-t-P.* " | cut -f2 -d':'`
echo "configured - Ctrl-C to disconnect"
while : ; do sleep 60 ; done
Don't forget to run this as root