UMTS on PI

From Coolscript
Revision as of 17:05, 20 September 2014 by Matthias (talk | contribs) (Created page with "==UMTS Setup== This is a short description of how you could run a UMTS router on Raspberry *Requirements **Raspberry PI Modell B **5V/1A Power Unit **Mobile Connect USB-Stick...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

UMTS Setup

This is a short description of how you could run a UMTS router on Raspberry

  • Requirements
    • Raspberry PI Modell B
    • 5V/1A Power Unit
    • Mobile Connect USB-Stick UMTS Broadband Huawei K3765-HV mit integr. GSM-Gateway
    • Debian Wheezy

Kernel Info:

root@raspberrypi:~# uname -a Linux raspberrypi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 armv6l GNU/Linux

Required packages:

apt-get install usbutils
apt-get install wvdial
apt-get install usb-modeswitch

Huawei related setup for Raspberry

This is required because the Huawei Model comes with a included storage device
which is casuing trouble at startup.

USB Modeswitch Hack

Required to get detect the Modem during boot

  • Edit /lib/udev/rules.d/40-usb_modeswitch.rules

Search for K3765:

# Huawei K3765
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1520", RUN+="usb_modeswitch '%b/%k'"

WVDial Setup

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
Baud = 960000
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
[Dialer umts-pin]
Init3 = AT+CPIN="MY PIN"
[Dialer umts]
Dial Command = ATD
Carrier Check = no
Phone = *99***1#
Password = vodafone
Username = vodafone
Stupid Mode = 1
Init4 = AT+CGDCONT=1,"IP","web.vodafone.de"
Dial Attempts = 2
auto dns = 0

Starting

~# wvdial umts-pin
~# wvdial umts


  • Possible ifconfig output:
root@raspberrypi:~# ifconfig
eth0     Link encap:Ethernet  HWaddr b8:27:eb:c5:09:fa
         inet addr:192.168.2.26  Bcast:192.168.2.255  Mask:255.255.255.0
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:963 errors:0 dropped:0 overruns:0 frame:0
         TX packets:686 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:73697 (71.9 KiB)  TX bytes:101659 (99.2 KiB)
lo       Link encap:Local Loopback
         inet addr:127.0.0.1  Mask:255.0.0.0
         UP LOOPBACK RUNNING  MTU:16436  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
ppp0     Link encap:Point-to-Point Protocol
         inet addr:109.85.xxx.xxx  P-t-P:10.64.64.64  Mask:255.255.255.255
         UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
         RX packets:8 errors:0 dropped:0 overruns:0 frame:0
         TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:3
         RX bytes:158 (158.0 B)  TX bytes:221 (221.0 B)
wwan0    Link encap:Ethernet  HWaddr 02:50:f3:00:00:00
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)



Iptables

#!/bin/bash
#VERY BASIC
#consider to run /etc/init.d/wvdial start
#
############
#INIT NAMES
############
IPTABLES=/sbin/iptables
INITWHITENAME=init-generic-white
INITGENSRC=init-generic-service
#Set the ip address of your host
INITIP=192.168.xxx.xxx
###########################
#INIT DEFAULT POLICY - DROP
###########################
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP
#
###########################
#Flush Config
###########################
$IPTABLES -F
$IPTABLES -X
#Switch on routing
echo "1" > /proc/sys/net/ipv4/ip_forward
#Set log level
echo "1 4 1 7" > /proc/sys/kernel/printk
#Set Masquerade
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
route add default gw 10.64.64.64
iptables -A OUTPUT -j ACCEPT
iptables -A INPUT -j ACCEPT
iptables -A FORWARD -i eth0 -j ACCEPT
iptables -A FORWARD -i ppp0 -j ACCEPT

SMS Config

# Configuration file for Gammu SMS Daemon
# Gammu library configuration, see gammurc(5)
[gammu]
# Please configure this!
port = /dev/ttyUSB0
connection = at
# Debugging
#logformat = textall
# SMSD configuration, see gammu-smsdrc(5)
[smsd]
pin = xxxx
service = files
logfile = /var/log/gammu-smsd
# Increase for debugging information
debuglevel = 4
ReceiveFrequency = 300
# Paths where messages are stored
inboxpath = /var/spool/gammu/inbox/
outboxpath = /var/spool/gammu/outbox/
sentsmspath = /var/spool/gammu/sent/
errorsmspath = /var/spool/gammu/error/

Testing: echo "Test" | sudo gammu-smsd-inject TEXT "+49171xxxx


Credits: http://www.datenreise.de/raspberry-pi-sms-per-kommandozeile-versenden/


Wireless Config

allow-hotplug wlan0 iface wlan0 inet static

 address   192.168.2.10
 broadcast 192.168.2.255
 netmask   255.255.255.0
 #gateway  ....
 # default route to access subnet
 #up route add -net ... netmask 255.255.255.0 gw .... eth0
 wpa-ap-scan 1
 wpa-scan-ssid 1
 wpa-ssid "BOFH"
 wpa-psk "xxx"


Credits