Mobile Broadband for Home Networks

As the internet is getting more and more pervasive in our way of living, connectivity is now almost regarded as necessity. However in many areas specially remote ones, internet connectivity is still a hurdle, physically and financially.

But necessity is a powerful motivator to get things done, and with internet connectivity getting diverse and affordable these days, this article chronicles the author’s challenges in adapting mobile internet connectivity for their home network.

The story begins when…

we used to have a Smart Bro Internet at our humble abode in the province. The only remarkable thing I have about it is a scuffle with their technical support regarding the DNS servers a couple of years way back. But besides that, I was one happy fellow with it specially considering that our house is situated in a relatively remote area where telephone lines are out of reach and with not so much cellular signal.

However, a few months ago I masterminded to have the service discontinued. I felt that it was becoming more of a financial drain on the family mostly because it only sat idling on work days. I thought it was high time to take a look at alternatives.

Shelling out some hard-earned cash, I bought a prepaid Globe Tattoo kit. I got it to work on my KahelOS-powered laptop by installing usb_modeswitch, wvdial and gnome-ppp.

USB_ModeSwitch takes care of putting the USB device properly into modem mode. WvDial is an intelligent dial-up program for Linux, and Gnome-PPP is simply a front-end for it.

[agi@laptop]$ sudo pacman -S usb_modeswitch wvdial gnome-ppp

Aside from pointing Gnome-PPP to the modem (/dev/ttyUSB0), the phone number to dial and the modem initialization strings are also details important to setup.

Sadly, the initiative was shot down when I found out that the kit can’t really work in our area from weak signals.

The most important thing is…

necessity. Reminiscent of a dialogue from Three Kings, here now is the part where my folks come in. They arrived just last week for vacation and also to meet their first grandchild for the first time. Of course, yours truly also took his 3-day vacation leave. Priceless moments such as this are not to be missed.

Eventually though, my dad needed the ‘net to hear back from my siblings abroad and to check for work-related emails. We are again on the point of looking to have the old service reconnected since it’s the only one we knew worked. But necessity dictates for a more immediate solution, and before I knew it, I was retesting the modem kit up in the attic and out the window. Fortunately (to my surprise) after several tries and repositioning, it finally worked!

It would be lame to climb up the attic every time we needed to get online. After addressing accessibility, it would also be nice to have the connection shared to other bedroom desktops. Seems necessity is now pushing me to also build that home server I’d been planning for quite some time.

However, it’s important to stress that the connection can’t stay up all the time (because it’s prepaid) and it’s impractical for desktops to get terminal access just to check and dial up. Auto-connect, if possible, sounds like the sweetest answer for that.

The server build…

began after I cleaned an old Duron-based computer I have lying around. I proceeded to install Arch Linux on it. Arch Linux is a lightweight distribution and perfect for minimal server installations. I particularly had it in mind since I needed the box to simply perform dial-up and act as a router.

The tricky part is getting WvDial installed. WvDial is not included on the core base package group, and couldn’t be downloaded just yet because I’m still trying to get the box connected.

Package managers on Linux are so wonderful that they cache packages you install or upgrade. Since I got the modem running on the laptop and KahelOS is Arch-based, I should be able to use those cached packages with careful considerations about their dependencies.

[root@server]# /etc/rc.d/sshd start
[agi@laptop]$ scp /var/cache/pacman/pkg/{usb_modeswitch,tcl}-* root@server:~
[agi@laptop]$ scp /var/cache/pacman/pkg/{wvdial,wvstreams,xplc}-* root@server:~
[root@server]# pacman -U ~/*.pkg*

Then, it’s time to plug in the modem and test. For the initial configuration, instead of running wvdialconf I just copied over the working configuration file from the laptop. Cheat whenever you can at Linux.

[agi@laptop]$ scp ~/.wvdial.conf \
  root@server:/etc/wvdial.conf
[root@server]# wvdial

The final touches…

on the auto-connect I was talking about previously concerns the dial on demand feature of pppd. Basically, one would create a configuration file in /etc/ppp/peers using the same options WvDial passes to pppd. I retrieved those options running the following commands while WvDial is connected:

[root@server]$ ps axw | grep pppd

The options should be put on their own lines along with some that pppd uses for organization and configuration such as namenoauth and so on while ignoring -detach and call. Other necessary options are described below.

The connect option is interesting in that it effectively allows other programs to take care of the session initiation. In my case I still want WvDial to handle the dialing. Dial on demand on the other hand, is achieved with the demand option. It means whenever network traffic needs to travel out, pppd calls WvDial to dial-out.

Also recalling that my connection is prepaid, the idle directive is there to automatically disconnect when there’s no activity for a period of time. The time is specified in number of seconds. Lastly, the persist directive will have pppd remain active even when idle disconnects. Thus, when there’s outgoing traffic to be sent again, pppd can then spring the connection back into service.

I named the file provider so the ppp daemon will pick it up and use it during system initialization. At this point, I had already added ppp and sshd to the daemons autostart list in /etc/rc.conf.

# /etc/ppp/peers/provider

name globe-tattoo
connect "/usr/bin/wvdial --chat"
noauth
/dev/ttyUSB0
9600
modem
crtscts
defaultroute
usehostname
user globe
noipdefault
idle 300
persist
demand
logfd 6

Finally, I configured the box to route (via /etc/sysctl.conf) and masquerade (via iptables) traffic going outside which are topics by themselves. But for the sake of completeness, here’s the rest of what I’ve done along with making sure iptables is on the daemon autostart list:

# /etc/sysctl.conf
net.ipv4.ip_forward=1
[root@server]# sysctl -p
[root@server]# iptables -t nat -A POSTROUTING -s subnet_address -j MASQUERADE
[root@server]# /etc/rc.d/iptables save

Now that I got the home network online again and with more affordable internet connection, it’s another bonus that my dad has been really impressed with Linux and FOSS. I’ve also set up a Linux desktop for his usage and he has finally considered making that change.

He even asked for his own copy of the Linux installer. That’s the true win for me…

This entry was posted in Administration, KahelOS, Utilities and Tools and tagged , , , , , , , , , , . Bookmark the permalink.

9 Responses to Mobile Broadband for Home Networks

  1. Postes this to my blog also. Greetings from the Speedy DNS

  2. one can argue that it can go both ways

  3. I thought the article was great. Very concise and I agree with everything written. I’ve done some writing myself but haven’t really gotten published much.

  4. Good job! I agree with all said. I’m a writer too but my blog isn’t very popular. I really thought it was a fascinating read.

  5. abnehmpillen says:

    Hello!, Pretty interest angle, we had been talking about the same thing at do the job and discovered your internet site quite stimulating. So felt compelled to com?ment a little thank you for all of your energy. Please maintain up the good do the job your doing!

  6. levitra says:

    Please, can you Pm me and inform me couple of additional thinks about this, I’m actually fan of your blog… will get solved properly asap.

  7. doofmann says:

    That’s Too good, when it comes in india hope it could make a Rocking place for youngster.. hope that
    come true.

  8. you’ve gotten an incredible blog right here! would you like to make some invite posts on my blog?

Leave a Reply