Advertisement
Guest User

Untitled

a guest
May 16th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #!/bin/bash
  2. # install required packages
  3. apt-get install -y eject wvdial
  4.  
  5. # add wvdial config
  6. cat << EOF > /etc/wvdial.conf
  7. [Dialer Defaults]
  8. Init1 = ATZ
  9. Init2 = AT+CFUN=1
  10. Init3 = AT+CGDCONT=1,"IP","soracom.io"
  11. Dial Attempts = 3
  12. Modem Type = Analog Modem
  13. Dial Command = ATD
  14. Stupid Mode = yes
  15. Baud = 460800
  16. New PPPD = yes
  17. Modem = /dev/ttyUSB0
  18. ISDN = 0
  19. APN = soracom.io
  20. Phone = *99***1#
  21. Username = sora
  22. Password = sora
  23. Carrier Check = no
  24. Auto DNS = 1
  25. Check Def Route = 1
  26. EOF
  27.  
  28. # add replacedefaultroute option to ppp config
  29. cat << EOF > /etc/ppp/peers/wvdial
  30. noauth
  31. name wvdial
  32. usepeerdns
  33. replacedefaultroute
  34. EOF
  35.  
  36. # add config to auto connect on start
  37. cat <<EOF > /etc/rc.local
  38. #!/bin/sh -e
  39. #
  40. # rc.local
  41. #
  42. # This script is executed at the end of each multiuser runlevel.
  43. # Make sure that the script will "exit 0" on success or any other
  44. # value on error.
  45. #
  46. # In order to enable or disable this script just change the execution
  47. # bits.
  48. #
  49. # By default this script does nothing.
  50.  
  51. # Print the IP address
  52. _IP=$(hostname -I) || true
  53. if [ "$_IP" ]; then
  54. printf "My IP address is %s\n" "$_IP"
  55. fi
  56.  
  57. eject sr0
  58. modprobe usbserial vendor=0x15eb product=0x7d0e
  59.  
  60. echo waiting for modem device
  61. for i in {1..30}
  62. do
  63. [ -e /dev/ttyUSB0 ] && break
  64. echo -n .
  65. sleep 1
  66. done
  67. [ $i = 30 ] && ( echo modem not found ; exit 1 )
  68. wvdial &
  69.  
  70. exit 0
  71. EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement