Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # install required packages
- apt-get install -y eject wvdial
- # add wvdial config
- cat << EOF > /etc/wvdial.conf
- [Dialer Defaults]
- Init1 = ATZ
- Init2 = AT+CFUN=1
- Init3 = AT+CGDCONT=1,"IP","soracom.io"
- Dial Attempts = 3
- Modem Type = Analog Modem
- Dial Command = ATD
- Stupid Mode = yes
- Baud = 460800
- New PPPD = yes
- Modem = /dev/ttyUSB0
- ISDN = 0
- APN = soracom.io
- Phone = *99***1#
- Username = sora
- Password = sora
- Carrier Check = no
- Auto DNS = 1
- Check Def Route = 1
- EOF
- # add replacedefaultroute option to ppp config
- cat << EOF > /etc/ppp/peers/wvdial
- noauth
- name wvdial
- usepeerdns
- replacedefaultroute
- EOF
- # add config to auto connect on start
- cat <<EOF > /etc/rc.local
- #!/bin/sh -e
- #
- # rc.local
- #
- # This script is executed at the end of each multiuser runlevel.
- # Make sure that the script will "exit 0" on success or any other
- # value on error.
- #
- # In order to enable or disable this script just change the execution
- # bits.
- #
- # By default this script does nothing.
- # Print the IP address
- _IP=$(hostname -I) || true
- if [ "$_IP" ]; then
- printf "My IP address is %s\n" "$_IP"
- fi
- eject sr0
- modprobe usbserial vendor=0x15eb product=0x7d0e
- echo waiting for modem device
- for i in {1..30}
- do
- [ -e /dev/ttyUSB0 ] && break
- echo -n .
- sleep 1
- done
- [ $i = 30 ] && ( echo modem not found ; exit 1 )
- wvdial &
- exit 0
- EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement