3G Portable Internet Access

General Information

First of all, almost all of 3G modem in the market have a “Zero-CD” mode that will automaticaly install a driver when plug in to windows based os, so by default when we plug it in to our freebsd system, it will go to “Zero-CD” mode. We need to change this mode to a “Modem” mode in order to use it in our freebsd system.

There are two ways to do this, either using camcontrol+devd or usb_modeswitch. I use camcontrol+devd method as by default it already in the system.

So, while listening to your 8 GB china brand mp3 player or your Apple iphone or ipod, or some of you that have a super duper high output amp stereo hifi with a very big speaker that can blow out your entire neighborhood house, let’s get started!

Requirements

  1. Server/PC/Laptop with FreeBSD 7.2 with u3g module loaded.
  2. 3G HSDPA/UMTS usb/card or 3G capable phone that supported by FreeBSD/u3g.
  3. Apple iPod/iPhone (trademark to Apple Inc) or a China brand (or no-brand) mp3 player. – This is optional.
  4. Working 3G internet access.
  5. This Guide (duhhh…).

Configuration

Freebsd 7.2 has include u3g driver in it, so we are going to use that driver, load up the driver in /boot/loader.conf or compile it into the kernel, so ask your wife or your house cleaning maid for a choice :). My modem detected as umass0, some of the modem detected as ugen0 so load which that are detected.

u3g_load="YES"
umass_load="YES"

Then reboot if you want or load it up using kldstat.

Plugin you modem to your system and use usbdevs command to see your modem details, you will need to search which one of the lines are your modem belongs.

# usbdevs -v

mine was :

port 1 addr 3: full speed, power 100 mA, config 1, USB MMC Storage(0x1000), Qualcomm, Incorporated(0x05c6), rev 0.00

In this line, we need to get the id for vendor and product, so mine was vendor = 0x05c6 and product = 0×1000. Next use camcontrol devlist command.

# camcontrol devlist

So my modem detected as Option ICON 2.31, in the last part of the line was (da1,pass1), we need to use the “Option” and “pass1″ value. Create a folder in /etc namd devd, /etc/devd, in this folder create any file name, I’m using option.conf same with my modem, vodafone option globesuffer icon.

In the option.conf file, put this:

attach 100 {
match "device-name" "umass[0-9]+";
match "vendor" "0x05c6";
match "product" "0x1000";
match "devclass" "0x00";
action "sleep 3; /sbin/camcontrol cmd `/sbin/camcontrol devlist | /usr/bin/grep Option | /usr/bin/awk '{match($10, /pass[0-9]+/); print substr($10, RSTART, RLENGTH) }'` -c '01 00 00 00 00 00' -i 1 i1 > /dev/null";
};

Next, be warn, some of you might be needing master yoda training to help you on this :) just kidding.. move on..
Replace vendor and product with the id or your modem. In the action line, you will need to edit a few things:

/usr/bin/grep Option <- replace with the output of your camcontrol devlist before, mine was Option.

$10 <- $10 is the value of the 10th result from the camconrol devlist line, mine has pass1 value remember?

example:

Save the option.conf file. Plug out your modem and run /etc/rd.d/devd restart to reload new conf for devd.

/etc/rc.d/devd restart
Stopping devd.
Starting devd.

Now, plug back your modem and if everything fine, they will be a message like this:

[/output]umass1: detached

ucom0:

ucom0: configured 3 serial ports (U0.%d)[/output]

This was still buggy I think, some of you might not have any message at all, try to plug in and out a few times. You can also do manual switch without using devd:

# camcontrol devlist

So if everything working, ucom0 already up, then /dev/cuaU0.0 will be created by u3g, if you are using ubsa, then /dev/cuaU0 will be created. We are going to use /dev/cuaU0.0 in ppp.conf.

This is the sample of ppp.conf for Malaysia Celcom 3G ISP, you can use it as a birthday present for your wife, I don't mind :)

# MaUi^ (Jun, 21, 2009)
# 3G (HSDPA/UTMS) /etc/ppp/ppp.conf (FreeBSD)
# This file should be in put in /etc/ppp/
# IMPORTANT! every line IN A LABEL (label:) should start with a space!!
# word "#" infront of line tell ppp not to read the line
# to start dialing. run --> ppp -ddial label (or any label you add)
default:
# add default gateway when connected
add default HISADDR
# ------------------------------
# to enable NAT for sharing internet with other pc
  nat enable yes
# ------------------------------
# enable dcc send from client behind the gateway
  nat same_ports yes
  nat use_sockets yes
# ------------------------------
# to see connection error/link/speed : tail -f /var/log/ppp.log
  set log phase tun connect
# ------------------------------
# auto update with the isp nameserver in /etc/resolv.conf
enable dns
# or used other dns server
# set dns 127.0.0.1
# ------------------------------
# 3G Celcom.
# if using ubsa, ucom0 = cuaU0
# if using u3g, ucom0 = cuaU0.0
3g:
set device /dev/cuaU0.0
set dial "ABORT BUSY ABORT NO\sCARRIER TIMEOUT 5 \"\" ATZ OK-ATZ-OK AT+CGDCONT=1,\\"IP\\",\\"celcom3g\\" OK \dATD\T TIMEOUT 40 CONNECT"
# dial number are *99# or *99***1
set phone "*99***1#"
set authname ""
set authkey ""
set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
enable lqr
disable ipv6cp

That's all, enjoy taking over the world.. erkk I mean surfing the world wide web. :)

Speak Your Mind

*