This how-to explains how to configure a Seagate Dockstar running Debian to establish a 3G connection using a USB data card like the Huawei E122 / UMG181 etc and configure it to act as a gateway so that the internet can be shared with the other devices connected to the network.
You need to have a Dockstar running Debian, if not check Jeff's site on how to install Debian on your Seagate Dockstar.
Configuring the USB Modem and PPP Dialler
First install the following packages using apt-get
apt-get install usb-modeswitch usb-modeswitch-data ppp
After that connect your 3G USB modem, and wait for few seconds. After that give the command 'dmesg' and check if you can see something like this
option 1-1.4:1.0: GSM modem (1-port) converter detected
usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB0
option 1-1.4:1.1: GSM modem (1-port) converter detected
usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB1
option 1-1.4:1.2: GSM modem (1-port) converter detected
usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB2
option 1-1.4:1.5: GSM modem (1-port) converter detected
usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB3
If you see similar lines saying 'modem attached to ttyUSBx', then the USB modem is detected fine.
Now edit the file '/etc/ppp/peers/provider' and replace its contents with the following
connect "/usr/sbin/chat -v -f /etc/chatscripts/BSNL3G"
After that edit the file '/etc/chatscripts/BSNL3G' and replace its contents with the following
ABORT 'NO CARRIER'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
#'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2'
Now if everything works as expected you should be able to connect by giving the command 'pon'. Try pinging Google.com to verify if the internet is working. You can disconnect by giving the command 'poff'
To make the dock connect to the internet automatically on start-up, append the following to the '/etc/network/interfaces' file
iface ppp0 inet ppp
Reboot the Dockstar to verify if everything is working fine.
Configuring the Dockstar to act as a Gateway
If you do not have iptables installed, install it with the following command
apt-get install iptables
Now edit '/etc/sysctl.conf' and change the line that says 'net.ipv4.ipforward = 0' to 'net.ipv4.ipforward = 1' and also make sure that the line is uncommented.
After that execute the following commands
/sbin/iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
/sbin/iptables -A FORWARD -i ppp0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT
Now we need to get these rules loaded at boot time, for that follow the steps below
iptables-save > /etc/firewall.conf
Edit the file '/etc/network/if-up.d/iptables' and add the following
iptables-restore < /etc/firewall.conf
Next step is to make the file executable
chmod +x /etc/network/if-up.d/iptables
That's it, now your Seagate Dockstar will act as a gateway and you can share your 3G internet connection with the other devices on your network. Make sure you manually set the Gateway IP address to that of the Dockstar in each device.
If there is any problem leave a comment.