Aim: To have a Wireless hotspot in the truck with 3G internet and vehicle tracking
Kit:
- Raspberry Pi running Raspbian
- Powered USB Hub
- Huawei E170 3G Dongle
- TP-Link TL-WN722N
Wireless Setup
apt-get install hostapd dhcpdnano /etc/hostapd/hostapd.conf
nano /etc/dhcp3/dhcpd.conf
interface=wlan0
driver=nl80211
ssid=3GPi
hw_mode=g
channel=11
wpa=2
wpa_passphrase=xxxxxx
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP
auth_algs=3
wmm_enabled=1
nano /etc/network/interfaces
subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.25 10.10.0.50;
option domain-name-servers 202.37.101.1, 202.37.101.2;
option routers 10.10.0.1;}
Permanently enable IP forwarding in /etc/sysctl.conf:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
post-up iptables-restore </etc/network/iptables
allow-hotplug wlan0
iface wlan0 inet static
address 10.10.0.1
netmask 255.255.255.0
post-up /etc/init.d/hostapd start ; /etc/init.d/isc-dhcp-server start
down /etc/init.d/hostapd stop ; /etc/init.d/isc-dhcp-server stop
nano /etc/network/iptablesnet.ipv4.ip_forward=1
*nat
:PREROUTING ACCEPT [2:208]
:INPUT DROP [2:208]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -j ACCEPT
-A INPUT -i wlan0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 4 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 12 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -s [MY IP AT HOME] -j ACCEPT:OUTPUT ACCEPT [1:108]
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o ppp0 -j ACCEPT
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o ppp0 -j MASQUERADECOMMIT
Setting up 3G
wget "http://www.sakis3g.org/versions/latest/$ARCH/sakis3g.gz" # where $ARCH is either i386 or amd64
gunzip sakis3g.gz
chmod +x sakis3g
./sakis3g --interactive
I have had to make alot of changes to this since I added the GPS as the GPS module moves all the serial ports around. Here is the working config:
USBINTERFACE="0"
USBDRIVER="option"
USBMODEM="12d1:140c"
OTHER="USBMODEM"
MODEM="OTHER"
# Bus 001 Device 006: ID 12d1:140c Huawei Technologies Co., Ltd.
APN=CUSTOM_APN
#2degrees
CUSTOM_APN="direct"
APN_USER="vodafone"
APN_PASS="vodafone"
1 comment:
can this auto connect 3G after reboot
Post a Comment