How-To Configure Seagate FreeAgent Dockstar as a 3G Gateway
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
- usb-modeswitch
- usb-modeswitch-data
- ppp
apt-get install usb-modeswitch usb-modeswitch-data pppAfter 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 ttyUSB3If 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
/dev/ttyUSB0
modem
crtscts
noauth
defaultroute
noipdefault
nopcomp
noaccomp
novj
nobsdcomp
holdoff 10
usepeerdns
persist
lcp-echo-failure 2
lcp-echo-interval 5
nodeflate
maxfail 0
debug
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 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
REPORT CONNECT
TIMEOUT 10
'' 'ATZ'
'OK-AT-OK' 'ATZ'
TIMEOUT 10
#'OK' 'ATZ'
#'OK' 'ATQ0 V1 E1 S0=0 &C1 &D2'
OK AT\^SYSCFG=14,2,2780380,0,1
'OK' 'AT+CGDCONT=1,"IP","bsnlnet"'
'OK' 'ATDT*99#'
TIMEOUT 30
CONNECT ''
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
auto ppp0
iface ppp0 inet ppp
provider provider
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 iptablesNow edit '/etc/sysctl.conf' and change the line that says 'net.ipv4.ip_forward = 0' to 'net.ipv4.ip_forward = 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.confEdit the file '/etc/network/if-up.d/iptables' and add the following
#!/bin/sh
iptables-restore < /etc/firewall.conf
Next step is to make the file executable
chmod +x /etc/network/if-up.d/iptablesreboot
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.