Finally manged to get a USB 3G connection running. As new to linux it took ages to work out all the commands and what each line meant on the 3G web setup page.
First I tried a Three.co.uk ZTE Model MF112 HSUPA USB Stick thinking this was a more basic 3G dongle and might work better, but no matter what settings I tried I could not get it to work.
As a FYI I found running the 3G connect script via SSH easy and then looking at the log file via the web interface works nicely.
SSH into 172.16.42.1 then run the 3G connect script from /www/pineapple/3g/3g.sh
I then attempted to get it to work with the more advanced Huawei Mobile Broadband E367 HSPA+ USB Rotator model and this is now working 100%. In case it helps anybody my settings are as follows;
Note APN settings for three.co.uk (username and password are left blank but use '' in config file) You can also "unlock" your dongle then use your own Mobile (cell) providers Sim.
#!/bin/sh
echo "
logfile /dev/null
noaccomp
nopcomp
nocrtscts
lock
maxfail 0" > /etc/ppp/options
echo "Searching for attached 3G Modems"
logger "3G: Connection Script here, searching for modems"
MODEM=$(lsusb | awk '{ print $6 }')
echo $MODEM
case "$MODEM" in
*12d1:1506*) echo "Huawei detected. Attempting mode switch"
uci delete network.wan2
uci set network.wan2=interface
uci set network.wan2.ifname=ppp0
uci set network.wan2.proto=3g
uci set network.wan2.service=umts
uci set network.wan2.device=/dev/ttyUSB0
uci set network.wan2.apn=3internet
uci set network.wan2.username=''
uci set network.wan2.password=''
uci set network.wan2.defaultroute=1
uci commit network
usb_modeswitch -v 12d1 -p 1506
sleep 10; rmmod usbserial
sleep 3; insmod usbserial vendor=0x12d1 product=0x1506
sleep 5; /etc/init.d/firewall
disable; /etc/init.d/firewall stop
logger "3G: firewall stopped"
iptables -t nat -A POSTROUTING -s 172.16.42.0/24 -o 3g-wan2 -j MASQUERADE
iptables -A FORWARD -s 172.16.42.0/24 -o 3g-wan2 -j ACCEPT
iptables -A FORWARD -d 172.16.42.0/24 -m state --state ESTABLISHED,RELATED -i 3g-wan2 -j ACCEPT
;;
esac