| Pimping Sprint Mobile Broadband With Linux |
| Written by Mr-Oss | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Saturday, 09 February 2008 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The hardware we will be using for this include the Novatel U727 USB adapter, a linksys wrt54g, and a laptop computer with kubuntu 7.10 loaded on it. Step 1... Making The Connection Our connection to the internet is provided by sprint mobile broadband services. For 59.95 a month you can get unlimited data transfer that works almost everywhere http://www.nextel.com/en/solutions/mobile_broadband/index.shtml . Sprint offers many styles of data cards that work with linux. This tutorial uses the Novatel U727 USB adapter. The only way linux can take use of the sprint card is by treating it as a dialup modem. Although kppp can be used this tutorial will be focusing on the use of the wvdial program. The wvdial program seems to be installed by default on kubuntu 7.10. If you don't currently have wvdial you can get it using the following command while connected to the internet. sudo apt-get install wvdial Now that we have wvdial installed we will need to setup the appropriate configuration file. Please note that this tutorial assumes you are using a USB style adapter which determines our device in the config file. If you have an alternate sprint card you will need to modify the dev settings for your system. The file we will be setting up for wvdial is the /etc/wvdial.conf file. This file can be created or edited with the following command. sudo vi /etc/wvdial.conf The /etc/wvdial.conf file should contain the following lines. [Dialer Defaults] Now that everything has been setup for the wvdial program we will need to load up the appropriate kernel modules to power our device. The first thing we will need to do is remove the usb serial module from our running system and reload the usbserial module with our vendor and product specific flags. To remove the currently running usbserial module we use the following command. sudo modprobe -r usbserial We have removed the usbserial kernel module and now we will reload it with the correct flags specific to the Novatel U727 USB adapter. To accomplish this we use the following command. sudo modprobe usbserial vendor=0x1410 product=0x4100 That command will load up the usbserial kernel module with the correct parameters. If your card is different than the Novatel U727 then please refer to the following chart for your specific vendor and product modprobe parameters.
The chart shown above was taken from the sprint linux installation guide. The sprint linux installation guide can be found at http://sprint.com/downloads Now that we have run the two modprobe commands we need to verify that they actually did something useful. To make sure that our system has loaded the modules for communications purposes we use the following command. dmesg | grep ttyUSB we should see output that contains the following [ 307.718870] usb 1-1: generic converter now attached to ttyUSB0 GREAT! now we are up and attached lets kick off the dialer and see if we can finish up step 1 of connecting to the internet. To start up the dialer that we setup earlier we issue the following command. sudo wvdial After issuing the wvdial command you should see something similar to the following output. WvDial<*1>: WvDial: Internet dialer version 1.56 Excellent!, we are now connected to sprint using linux! One thing to note is that you will want to write down the primary and secondary DNS addresses for use later when we setup our wireless router. Now you should be able to open up a browser and connect to the internet. I've noticed that the connection doesn't seem to run as fast in linux but we will have the abililty to split this connection off and send it to more than one computer. Now step 1 is complete we need to proceed to the next step. Step 2 .... |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
USBMODEM | <- USB -> | LAPTOP RUNNIN KUBUNTU 7.10 | <-CATEGORY 5 ETHERNET-> | LINKSYS WRT 54 G | <-WIRELESS NETWORK-> | WIRELESS CLIENT EEE PC 2G |
(public ip) ppp0 | ppp connection | IPTables
Firewall | eth0 on laptop 192.168.0.1 | WAN static ip 192.168.0.2 dns server set to values of wvdial dns | Private IP 192.168.1.1 | Private IP 192.168.1.x (Dynamically Assigned) |
As you can see from the above diagram the next step in our network is to create the ethernet interface and build the firewall. First we will be setting the internel ethernet adapter eth0 to the ip address of 192.168.0.1. This can be achived by the following command
sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255
Now we have our internal ip address for eth0 statically assigned to 192.168.0.1 which will be the default route for our wireless router that is introduced in the next step. We have configured the ethernet interface and will now need to setup a firewall to bridge ppp0 ( sprint ) across to our internal interface eth0. To setup the firewall I used a super handy online firewall generator. http://easyfwgen.morizot.net/gen/
The internet interface was set to ppp0 and the gateway/firewall option was used. On the next page we set the internal network adapter to eth0, set the internal ethernet address to 192.168.0.1, we set the internal network to 192.168.0.0/24, and the internal network broadcast to 192.168.0.255 then hit generate. We are then given the generated code we will need to route traffic on our network. Copy this text off to your favorite editor and name it firewall.sh. Here is our firewall that was generated
http://mr-oss.com/images/stories/sprint_mobile_broadband/firewall.txt
Save the firewall to your home directory and name it firewall.sh. Once you have the firewall saved we will need to change the permission settings and make sure the firewall is executable. To do this change directories to where your firewall is located and issue the following command.
sudo chmod 755 firewall.sh
Now that the firewall is executable we need to load it. To load the firewall we need to use the following command
sudo ./firewall.sh
If the command completes successfully you should see the following output on your terminal.
Loading kernel modules ...
net.ipv4.ip_forward = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.secure_redirects = 1
net.ipv4.conf.all.log_martians = 1
Flushing Tables ...
Create and populate custom rule chains ...
Process INPUT chain ...
Process FORWARD chain ...
Process OUTPUT chain ...
Load rules for nat table ...
Load rules for mangle table ...
Now we have our kubuntu linux laptop router setup to run a ppp0 internet connection and share it with the eth0 interface. This will allow us to plugin the linksys wrt54g's WAN interface into the internal network adapter eth0 on the laptop. That will bring us to the third step setting up the wireless router
Now that we have our sprint adapter connected to the internet, our ethernet interface statically configured to 192.168.0.1, and our firewall loaded to act as a gateway between interface ppp0 and eth0 we will need to finish our mobile hot spot by configuring the linksys wrt54g.
Connecting to the private side of your router for configuration purposes can take place over ethernet (ports 1-x) but not on the WAN interface. You could also connect to the router using the wireless interface. We will be connecting to the router's client side on a seperate computer over the wireless interface. Although we are using a WRT54G you can use any wireless router you choose. You will need to login to the administration setup page on your wireless router. Once you login to the wireless router's administration setup page we will need to configure the following settings.

CONNECTION TYPE | SET TO THESE VALUES |
| INTERNET (PUBLIC / WAN) IP ADDRESS | 192.168.0.2 ( the wan port on our router STATIC IP ) |
| SUBNET MASK | 255.255.255.0 |
| DEFAULT GATEWAY | 192.168.0.1 ( our linux laptop router ) |
| STATIC DNS 1 | 69.58.10.91 ( from wvdial output earlier ) |
| STATIC DNS 2 | 69.23.72.191 ( from wvdial output earlier ) |
| ROUTER PRIVATE IP ADDRESS | 192.168.1.1 ( wireless / wired client side ) |
| ROUTER PRIVATE SUBNET | 255.255.255.0 |
| ROUTER DHCP SERVER | ENABLED |
Once you have successfully configured your wireless router to the settings defined in the above chart, we are ready to jump online. On the client computer, in our case the EEE PC 2G surf, we browse for the wireless network's ssid. After locating the wireless ssid we connect to the wireless network and receive and ip address of 192.168.1.137 from dhcp. Now that we have connected to the wireless router we will need to plug in the WAN interface to feed the router through the sprint connection thanks to our firewall. With a normal category 5 ethernet cable, plug one end into the WAN port on the wireless router. Next, plug the other end into the ethernet port on the linux laptop (eth0 on kubuntu). Once the cable is in place, jump back on the client computer ( our EEE PC ). Open your favorite web browser, in our case firefox, and attempt to get online. If everything was successful you now have a working "hot spot" using your linux laptop, sprint mobile broadband, and your wireless router.
Check out the next page for a picture of our network and some tips on "gotchas" that we encountered during this hack.


One problem we seemed to run into was with wvdial not seeing the device /dev/ttyUSB0. To resolve this problem we re-created the device /dev/ttyUSB0 after removing it. We used the following command to accomplish this.
sudo rm -rf /dev/ttyUSB0
After removing the device we recreated the device with the following commands.
sudo mknod /dev/ttyUSB0 c 188 0
sudo chown root:dialout /dev/ttyUSB0
sudo chmod 660 /dev/ttyUSB0
*PLEASE NOTE* the number 188 corresponds to a device "group". One suggestion for obtaining this number on your system is to perform the command
sudo ls -al /dev/ttyUSB0
Take note of the number on your system and use it in-place of 188 in the mknod command listed above. Once you re-create the device then you will have to perform the module unload and load commands again. Use the following command to unload the usbserial module on your system.
sudo modprobe -r usbserial
Then once you have unloaded the usbserial module we will need to reload it with our device specific parameters.
sudo modprobe usbserial vendor=0x1410 product=0x4100
Upon successfully reloading the kernel module you will need to start the dialer again.
sudo wvdial
If it works, that's great! If it is still complaining about the device being missing give it a few minutes and try the dialer again. This was the most frustrating part of this hack. Check back for updates on how to correct this problem. We will also be posting our monster script that just does it all for you very soon. Stay Tuned
Hopefully you enjoyed this hack as much as we did.
If this was helpful, do us a favor and click our ads.
Sincerely,
The Mr-Oss Team
UPDATE! We have posted the master script that goes along with this tutorial. You can find it HERE
Enjoy!
Mr-Oss