Tuesday, January 25, 2011

Cyberoam IPSec VPN client on linux

My struggle of connecting my Ubuntu-9.04 (Karmic Koala) to Cyberoam's ipsec VPN is worth a mention. Cyberoam provides a road-warrior client for establishing VPN connections from Windows, but nothing for Linux based systems.

So here you go. On Cyberoam:
  • Logon to Cyberoam GUI
  • Click on the following menu on left panel: OBJECTS --> Hosts
  • Click the ADD button
  • Add the local network (behind Cyberoam) that you wish to access over VPN and give it a name. See the snapshot below. The local network behind my Cyberoam is 192.168.0.0/20, I named it as 192series. Press OK.

  • Click on the following menu on left panel: VPN --> IPSec
  • Press the ADD button. Follow the steps as per below snapshots.
  • If everything went well, you should see the following screen.
  • The Red button should turn green after pressing it.
  • Now you need to allow the VPN connection in firewall. On the left panel, click on Firewall --> Rule. Click ADD to add a rule to allow traffic from VPN to LAN. Do the same for allowing traffic from LAN to VPN. Here's a snapshot:

Here, you are done with the Cyberoam part. Now turn to your laptop or desktop:
--------------------------------------------------------------
 
On your laptop or PC:

  1. Install the openswan package from the default repositories. For debian based systems:
    apt-get install openswan
    For redhat based systems:
    yum install openswan
     
  2. Add the following configuration to your /etc/ipsec.conf. Change the network parameters as per your network scenario.
    conn roadwarrior
            rightsubnet=192.168.0.0/255.255.240.0
            auto=add
            type=tunnel
            right=<your_cyberoam_public_ipaddress>
            left=your-laptop-ipaddress
            leftnexthop=%defaultroute
            authby=secret
            keyingtries=3
            compress=yes
            failureshunt=drop
            dpddelay=30
            dpdtimeout=120
            dpdaction=clear
            pfs=yes
            ike="aes128-md5-modp1024,aes128-sha1-modp1024,3des-md5-modp1024"
            esp="aes128-md5,aes128-sha1,3des-md5"
     
  3. Add the following line in /etc/ipsec.secrets
    %any <your_cyberoam_public_ipaddress>: PSK "<pre-shared-key which you defined on cyberoam>"

  4. Load the connection in ipsec by using the following command on command line.
    sudo ipsec auto --add roadwarrior
  5. Start the connection and test if you are able to reach the local network behind Cyberoam.
    sudo ipsec auto --up roadwarrior
    ping 192.168.13.102

    That should get your VPN up and running. In case of problems, you may contact Cyberoam Support at:
    http://www.cyberoam.com/contactsupport.html

Wednesday, January 19, 2011

openwrt-x86-ext2.image in qemu on linux

I just downloaded the openwrt firmware and wanted to mount it in my ubuntu laptop. Here's the trick:


Get the starting offset of first partition in the image:
startsector=`fdisk -lu openwrt-x86-ext2.image 2>/dev/null | grep openwrt-x86-ext2.image2 | awk '{print $2}'`
Set-up a loop device to access the file offset as a block device, assuming 512 bytes sector size: 
losetup -o `expr $startsector \* 512` /dev/loop0 openwrt-x86-ext2.image
Now, mount the device to a directory:
mount /dev/loop0 /mnt/
To unmount the device:
umount /dev/loop0
To delete the loop device:
losetup -d /dev/loop0

To run the image under qemu with 128 MB ram and single network card:
sudo qemu -m 128 -hda openwrt-x86-ext2.image -net nic,model=ne2k_pci -net tap,ifname=tap1,script=~/qemu/qemu-ifup.sh

Sunday, October 3, 2010

Micromax MMX200g USB MODEM on Ubuntu

This modem really made me work hard, and so thought of writing it out. I have an Airtel GPRS sim card plugged in Micromax MMX200g USB Modem and wanted to get it working on my Ubuntu 9.10 (Karmic koala). The worst part was switching it from storage to modem mode. I did a lot of googling and binging but nothing got me to its usb_modswitch settings. But then, what worked surprised me. The only thing i did was 'Eject' it. Just unmount and eject the device using the GUI file explorer, and it will get detected as modem, /dev/ttyACM0, in my case.

YES, JUST EJECT THE DEVICE USING GUI FILE EXPLORER.

Then paste the following settings in /etc/wvdial.conf
--------------------------------
[Dialer Defaults]
Init1 = AT+CGDCONT=1,"IP","airtelgprs.com","",0,0
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
stupid mode = 1
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyACM0 # Your modem device may be different
ISDN = 0
Phone = *99#
Password = a
Username = a
--------------------------------
After that run the wvdial command:
# sudo wvdial
and there you should get connected.

Wednesday, September 22, 2010

swim,swam,swum,swimming

Finally, after struggling for 2 months, I could awake the swimmer in me. It gives me a sense of achievement and satisfaction. I am excited and eagerly awaiting every morning to take a dip in deep chlorinated water. I measured the swimming pool using the Google maps and found that every day I cover a distance of 300 metres by swimming. It's a great exercise. Every day I try different strokes, starting from upward floating to under-water and breaststroke.

Swimming is one of the most popular forms of aerobic exercise, and it is an excellent activity for anyone who wishes to get fit and stay active. Swimming exercise uses more of the overall muscle mass of the body than almost any other form of exercise, and people get an upper-body workout and a lower-body workout, unlike running or biking or other activities like tennis, where you get a good workout in just the legs. In addition, as with most aerobic exercise it is believed to reduce the harmful effects of stress.

Overall, swimming is an excellent form of exercise. Because the density of the human body is approximately similar to that of water, the body is supported by the water and less stress is therefore placed on joints and bones. Since then the buoyancy of the water protects the joints, water exercise is a particularly good choice for people who are overweight or who are prevented from taking part in other activities because of injuries or other physical limitations. Therefore, swimming is frequently used as an exercise in rehabilitation after injuries or for the disabled.

Saturday, July 3, 2010

My first swim (floating)

Living in an area with limited swimming opportunities, Ahmedabad, i have always been yearning to swim. Being an ardent fan of water sports, I had always wanted to learn swim in-order to actually participate in them. So the first day starts with the coach asking us to float on water. Rest was there for realisation. If you have not yet learned how to float you are unnecessarily denying yourself the opportunity to safely participate in many activities that take place in, on or near the water. Learning to float allows you to
rest comfortably in deep water when swimming out over your head or when swimming long distances. If you have learned to float, then diving or jumping off a spring board or dock can easily be followed by a few minutes floating while you catch your breath and decide what you want to do next. If you are in any type of water craft that inadvertently capsizes, you'll be very glad you learned to float because you possess a survival skill that will keep you alive and calm until help can arrive. Learning to float requires some concentration and a little practice, but once you have learned the skill of floating, it is yours for a lifetime.
Having know this for a while now, I set my step ahead and left myself sleeping on water, head facing downwards. Apart from few initial hiccups, I managed to get myself on water. Though there was a trouble keeping myself from getting rotated on one side, soon a little practice helped me align my head in-order to prevent the rotation. Today will be the second day. Will keep posting what happens next.

Friday, June 11, 2010

राँझा राँझा ( रावन मूवी )

This song mesmerised me, but it was only after hearing it 10 times that i could understand the lyrics. Here i am posting the lyrics of this great song from Ravan. It's Punjabi, Heer-Ranjha are characters of a folk love story.
'Ranjha Ranjha Kardi Ve Main Aape Ranjha Hoyi
Ranjha Ranjha Saddo Ni Mainu Heer Na Aakho Koyi'
is a verse from sufi poet Waris Shah's poem on Heer-Ranjha.

Singer(S): Rekha Bhardwaj, Javed Ali, Anuradha Sriram
Music Director: A R Rahman
Lyricist: Gulzar

Ranjha Ranjha Kardi Ve Main Aape Ranjha Hoyi
Ranjha Ranjha Saddo Ni Mainu Heer Na Aakho Koyi
Oo Ranjha Ranjha Na Kar Heere Jag Badnami Hoye
Patti Patti Jhar Jaave Par Khushboo Chup Na Hoye

Begunah Pakda Gaya (Yaaro)
Ishq Mein Jakda Gaya (Yaaro)
Aankh Ke Dosh Mein Dil (Yaaro)
Bewajah Pakda Gaya (Yaaro)

Aankh Se Hatt Ti Nahin, Arrey Hatt Ti Nahin, Arrey Hatt Ti Nahin
Sotey Sotey Bolta Hoon, Kabhi Bolte Bolte Sota Hoon
Kya Jaane Kya Hota Hai, Kabhi Jalti Aag Dadolta Hoon
Ek Baar To Aake Dekhe Woh Bhi

Ranjha Ranjha Kardi Ve Main Aape Ranjha Hoyi
Ranjha Ranjha Saddo Ni Mainu Heer Na Aakho Koyi
Oo Ranjha Ranjha Na Kar Heere Jag Badnami Hoye
Patti Patti Jhar Jaave Par Khushboo Chup Na Hoye

Jal Ja, Jal Ja Ishq Mein Jal Ja, Jale Se Kundan Ho
Jalti Raakh Laga Le Maathe Lagey To Chandan Hoye
Ranjha Ranjha Kardi Ve Main
Ranjha Ranjha Kardi Ve Main Aape Ranjha Hoyi
Ranjha Ranjha Saddo Ni Mainu Heer Na Aakho Koyi

Waqt Katt Ta Bhi Nahin, Waqt Rukta Bhi Nahin
Dil Hai Sajde Mein Magar, Ishq Jhukta Bhi Nahin
Bina Tere Raatein, Arrey Raatein Kyun Lambhi Lagti Hain
Kabhi Tera Gussa, Kabhi Teri Baatein Kyun Achchi Lagti Hain
Yeh Jalte Koyle, Arrey Koyle Ab Rakhna Mushkil Hai

Ranjha Ranjha Kardi Ve Main Aape Ranjha Hoyi
Ranjha Ranjha Saddo Ni Mainu Heer Na Aakho Koyi
Oo Ranjha Ranjha Na Kar Heere Jag Badnami Hoye
Patti Patti Jhar Jaave Par Khushboo Chup Na Hoye
Jal Ja, Jal Ja Ishq Mein Jal Ja, Jale Se Kundan Ho
Jalti Raakh Laga Le Maathe Lagey To Chandan Hoye

Chal, Chal Junoon Chalte Rahein, Tu Kahin Theher Nahin
Dil Agar Aa Bhi Gaya, Woh Tera Shehar Nahin
Bina Tere Saansein, Arrey Saansein Kahin Khatam Na Ho Jaayein
Sabi Teri Yaadein, Sabi Yaadein Kahin Basam Na Ho Jaayein
Sulagte Koyle, Arrey Koyle Ab Bujhna Mushkil Hai

Ranjha Ranjha Kardi Ve Main
Ranjha Ranjha Kardi Ve Main Aape Ranjha Hoyi
Ranjha Ranjha Saddo Ni Mainu Heer Na Aakho Koyi
Ranjha Ranjha Kardi Ve Main Aape Ranjha Hoyi
Ranjha Ranjha Kardi Ve Main Aape Ranjha Hoyi
Oo
Ranjha Ranjha Na Kar Heere Jag Badnami Hoye
Patti Patti Jhar Jaave Par Khushboo Chup Na Hoye
Ranjha Ranjha Kardi Ve Main Aape Ranjha Hoyi ........ 4

Saturday, June 5, 2010

Setup my own IVR

Voice has always been an interesting field for me. One of my friends asked me to set up an IVR (Interactive Voice Response) for his small company. I, wearing a technology mask, would never like to displease a friend, who has an image of me being a technology champ. Not only that, there was something else at the back of my mind, that supported my decision to help out this friend. It was nothing else but a small IVR application that I had developed during my graduation days. Those were the days of VB with a TAPI addon. Tried to look around for that antic piece, got it, but couldn't get it working on today's OS. I was in a fix. Googling around for VOIP related technologies, I came across VXML (Voice XML) & voice browser. At first, I related it to be something like XML and Firefox Internet browser. I was excited to have it on my desktop, but my eagerness was trimmed down on further reading. This was where i came across voxeo.

Here are the steps:
1) Register yourself at Voxeo Evolution Site. (Goto Account->Register)
2) Login with your user and password.
3) Copy paste the following text in your favourite editor.


<vxml version = "2.1" >

<form>
<block>
<prompt>
<break strength="large"/>
Hello. Welcome to Nand Tele Services. We are the leaders in Education Call Center.
prompt>
block>
form>
vxml>
4) Save the file on your local machine (say hello.xml)
5) On voxeo evolution site, goto,
ACCOUNT -> (Files, Logs, & Reports)
6) You should see a www directory. Click on www directory.
7) Upload hello.xml using the browse button.
8) Goto ACCOUNT -> Application Manager, Click Add Application.
9) Type in a arbitrary name, and select "Voice Phone Calls"
10) In Voice URL, click on file manager, select hello.xml and Press MAP.
11) Press "Create Application".
12) Click on the application, and it will show you various contact methods.
Your first voice application is ready to rock!!!

On creating your application, voxeo gives you free Skype, Sip, & direct US phone numbers. You can use skype to test your new voice application. If you have a sip softphone, like linphone, put in the sip url and listen the voice of your application. Now you need to connect it to your PSTN line. I did it using Linksys SPA-3102. My boss is calling, need to go, will post the rest in next few days.