Setting up MTNL 3G internet connection in FreeBSD

Recently I bought an MTNL 3G internet connection to add some redundancy to my internet connectivity stack. As I use, Following is how I got it running in FreeBSD (8.2-RELEASE) with the help from a similar HOWTO for GNU/Linux.

1. Plugin the device. Following is the dmesg output after plugging in the device (Teracom LW272):

umass0: <6227--Storage> on usbus4
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:0:0:-1: Attached to scbus0
ugen4.2: <D-88n> at usbus4 (disconnected)
umass0: at uhub4, port 1, addr 2 (disconnected)
usb_alloc_device: Found possible auto-install disk (trying next config)
ugen7.2: <HSPADataCard> at usbus7
umass0: <HSPADataCard  > on usbus7
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:0:0:-1: Attached to scbus0
(probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
(probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:0): SCSI status: Check Condition
(probe0:umass-sim0:0:0:0): SCSI sense: UNIT ATTENTION asc:28,0 (Not ready to ready change, medium may have changed)
cd0 at umass-sim0 bus 0 scbus0 target 0 lun 0
cd0: <HSPAData CD-ROM 0000> Removable CD-ROM SCSI-0 device
cd0: 40.000MB/s transfers
cd0: cd present [8982 x 2048 byte records]
(probe0:umass-sim0:0:0:1): TEST UNIT READY. CDB: 0 20 0 0 0 0
(probe0:umass-sim0:0:0:1): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:1): SCSI status: Check Condition
(probe0:umass-sim0:0:0:1): SCSI sense: NOT READY asc:3a,0 (Medium not present)
da0 at umass-sim0 bus 0 scbus0 target 0 lun 1
da0: <HSPAData SD Card 0000> Removable Direct Access SCSI-0 device
da0: 40.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present

2. Load umodem kernel module to recognize the modem in the device, no usb_modeswitch (or its equivalent) required:

chateau.d.if!abbe:~ % sudo kldload umodem
Password:
chateau.d.if!abbe:~ % dmesg|tail -4
umodem0: <HSPADataCard USB Modem1> on usbus7
umodem0: data interface 2, has CM over data, has break
umodem1: <HSPADataCard USB Modem2> on usbus7
umodem1: data interface 4, has CM over data, has break

3. Add following lines ppp.conf for dialing, in my case for prepaid connection (APN: gprsppsdel):

mtnl:
        set device /dev/cuaU0  # USB modem device node created after loading umodem
        set speed 460800
        set phone "*99#"
        set authname mtnl
        set authkey mtnl123
        accept PAP
        accept CHAP
        set dial "ABORT BUSY ABORT NO\\sCARRIER \
         \"\" AT OK-AT-OK \
         ATEQV1 OK \
         AT+CFUN=6 OK \
         AT+CGDCONT=1,\\\"ip\\\",\\\"gprsppsdel\\\" OK \\dATDT\\T CONNECT"
        set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.255 0.0.0.0
        add default HISADDR
        disable dns
        disable ipv6cp
        disable mppe
        enable lqr

4. Start dialer:

chateau.d.if!abbe:~ % sudo ppp -ddial mtnl
Working in ddial mode
Using interface: tun0

(wait for 5-10 seconds)

chateau.d.if!abbe:~ % ifconfig tun0
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        inet 59.179.150.204 --> 10.0.0.2 netmask 0xffffffff
        Opened by PID 12379
chateau.d.if!abbe:~ % curl http://checkip.dyndns.org/
<html><head><title>Current IP Check</title></head><body>Current IP Address: 59.179.150.204</body></html>

I’m planning to use it with mpd5, will post the instructions when I’m done setting it up.

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti-Spam Quiz: