Saturday, September 15, 2012

Micromax MMX 353G modem in linux

I am using BSNL broadband for 5-6 years now. Now and then disruption in their service made me wish for a good backup Internet connection for long. Unfortunately in my locality, like most of the places in Bengal, there is no broadband vendor other than BSNL. I tried tata usb modem and reliance netconnect modem earlier. It was plain waste of money.

After the arrival of 3g network, I got to know about this generic 3g modem which one can use with any prepaid/postpaid 3G SIM. I went to a local computer store and randomly purchased Micromax MMX3G. I also got a Vodafone 3G SIM meanwhile.

As it happens generally, the modem didn't work in my CentOS 6.2 desktop. It was mounting the modem as USB Mass Storage device. I was not able to mount it as an USB Modem. After around a weeks of effort in Internet, I found this tool called usb_modeswitch. I installed that and followed some other configuration steps specified in some forums (don't remember the link). NetworkManager was recognizing this device and I was able to create network using this device. But unfortunately I was not getting connectivity. I called Vodafone customer care to find out if they can help. They straight away said that neither do they support this device nor do they support Linux. I still wanted to talk to the technical support team. Fortunately I was connected to a support engineer. He refused to help saying it won't work in Linux. After I insisted for an answer he said I might try with APN (Access Point Name) as www. If it works, well and good. Otherwise, tough luck.

While rechecking my configuration, I found I configured APN as internet earlier. I modified that and tried it again. And, bingo! Network became active, I got connected to the Internet. My billion thanks to that support engineer who provided me this tricky help.

For reference below is the list of steps, I use to start the network using this device. Once these steps are done, NetworkManager detects the device after 2-3 seconds. 0x1c9e and 0x9605 are the vendor and product ids for this device.

service network stop

service NetworkManager start

usb_modeswitch -W -I -c /etc/usb_modeswitch.d/1c9e\:f000 -v 1c9e -p f000

modprobe usbserial vendor=0x1c9e product=0x9605

modprobe option
Good luck :)

Friday, May 11, 2012

Upgrading to CentOS 6.2

Life have been pretty stable with CentOS 5.2 for last couple of years. But experiment to modify some lvm logical volumes ended up corrupting my file system under /usr/local. Since many binary and lib files are stored under this, I thought to fix this fresh OS installation would be the easiest option. I'm not sure if there was any other way around to restore /usr/local.

Thinking of fresh installation, I thought it's also good time I upgrade to a newer version. Since my /home is mounted as a different file system, I thought it'll be fairly easy to install CentOS 6.2. It was actually. Many quirky things which I had to do for 5.2 seemed to work out of the box. But as it happens, fresh installation always comes with its own issues. Few things I noticed:

  • My eclipse started crashing soon after I started using CentOS 6.2. Some looking around in the web pointed me to the potential incompatibility between eclipse and Xulrunner 2 which came with CentOS 6.2. Removing Xulrunner 2 did the trick.
  • I could install FF 12, Google Chrome, Opera without any fuss. 
  • I was pleasantly surprised to find Network Manager automatically creating the DSL connection provided by BSNL. But then the difficulty started. Internet was working. But I found many websites mostly those which uses a CDN service were not loading in browsers. I tried FF, Chrome and Opera. All were having similar behavior. Digging deep in the Internet didn't help much. Finally I thought let me try removing Network Manager and creating the connection using traditional network service. I installed rp-pppoe to create the pppoe connection manually. That happened to be the eureka moment. Now all websites seem to be loading smoothly in all the browsers.

Wednesday, July 08, 2009

Zip file download problem with IE

There is a zip file download button in our application for sometime. Recently to make the browsers identify the file, we set the content type as "application/zip". Which is correct according to the standard[1]. But we found that the file downloaded with IE seem to be corrupted. While trying to investigate the issue, we were absolutely clueless on how to go about this problem. FF and some download managers with IE also seem to be downloading the file properly! After quite some frustrating hours of debugging we replaced the content type with generic: "application/octet-stream". And IE seem to understand this finally.

1. http://www.iana.org/assignments/media-types/application/zip

Tuesday, March 03, 2009

Configuring LAN with BSNL Datone in Linux machine

This is how I configured my home LAN with one desktop and one laptop. Before listing the exact steps let me brief the background. The desktop runs on CentOS and acts as the gateway for the LAN machines. Main difficulty was implementing the NAT so that I could access Internet from my Laptop. Looking at the tldp documentation, I thought it would be fairly easy to implement ip masquerading using iptables. Actually it was but only after I found the correct fix when Internet is provided through PPPoE protocol. The point to remember with PPPoE is the outgoing port in these situation will be ppp* not eth*.


+-------------+ +-------------+ +-------------+
----| | | | 10.0.0.* | |
BSNL| Modem | 192.168.1.* | Gateway |---------------| Internal M/C|
Cable| |---------------| (CentOS) |eth1 | (Ubuntu) |
| | (ppp) eth0| | | |
+-------------+ +-------------+ +-------------+




Step 1:
[root ]# echo 1 >  /proc/sys/net/ipv4/ip_forward

Step 2:
[root ]# echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf

Step 3:
[root ]# echo 1 >  /proc/sys/net/ipv4/ip_dynaddr

Step 4:
[root ]# /sbin/iptables -A FORWARD -i eth1 -o ppp0 -m state --state RELATED,ESTABLISHED -j ACCEPT

Step 5:

[root ]# /sbin/iptables -A FORWARD -i ppp0 -o eth1 -j ACCEPT

Step 6:
[root ]# /sbin/iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

Step 7:
[root ]# service iptables save

Step 8:
[root ]# service iptables restart

Step 9:
If you have some firewalls (like Redhat Firewall) enabled in your system, you must make the LAN interface trusted in the gateway machine.

And there you go. Step 4-9 can also be done using UI: /usr/bin/system-config-securitylevel-tui like this:



P.S.: Chennai LUG helped me for this.

Tuesday, February 10, 2009

One CVS trick with eclipse

Recently I had a need to commit some local uncommitted change of a branch into another branch. I was little skeptical that I might loose all the local changes and redo them, manually, again in the other branch. Some soul searching in eclipse help document, revealed that I can do such things using "Team -> Switch to another branch or version". It uses sticky tags to move the uncommitted changes into the new version/branch instead of replacing. Once you have "switched" to this new branch, you can commit them gladly. And, it works! But there is one problem. Suppose there is some conflicting file, i.e., you have modified a file "A" locally and someone else also has made some conflicting changes in "A" in this other branch. In this particular situation, eclipse/cvs screws your code gracefully. i.e., without any warning/error. It looses all local changes you made! So my personal opinion is before "switching" to another branch, do a "compare with" that branch. Find out if there is any conflict. In case you find any conflict, back them up somewhere. After "switching" to the other branch manually check which state these files are. You might need them to fix manually.