Enabling mouse scrolling in GNU screen when connecting from MAC

GNU Scren is a great tool for system administrators, as it allows to do anything on a remote server and then continue from exactly where you left later by reconnecting to the session.

But one of the most annoying issues with screen is that if you connect to a screen session and if you want to see the scrollback history, then you need to press the screen keyboard shortcut CTRL+A+]. This is annoying as most people are used to scroll up via mouse.

This is a repost from this site and it helps in overcoming the above issue in MAC’s default terminal Application. All the credits goes to the Original poster and I am just reposting that  for my own reference incase if the original site goes down/removes the content.

Typical use case of GNU Screen for me

MAC Book Pro: My Office Laptop which is connected to my corporate lan only when I am in office/VPN
Linux Server: My office server which is 24X7 up and has GNU screen running.
Network Devices: I need to have a always on telnet session to my Nexus 7000 devices, so that I can monitor whats going on with the device.

So what I normally do is from my Macbook pro, I ssh to the “Linux Server” and then start a GNU screen session by “screen -S devices”. Now from that  screen session I create multiple Tabs and connect to my network devices. So whenever I turnoff my laptop, these sessions will still be alive as the Linux server is always up. So when I reach home, I can just connect to my VPN and then again connect back to the screen session by typing “screen -x devices”.

This is exactly like you run a vnc on the Linux server and then open xterms to the network devices from the vnc session. The advantage of screen over vnc is that screen is really fast and is very good in low speed internet connections.

GNU screen takes all its setting from a .screenrc file which is in your home directory of the Linux server. To enable this tip add the below lines to your .screenrc file

defscrollback 5000
termcapinfo xterm* ti@:te@

Once done, save the file and connect to the screen session from Terminal app and now you can use your mouse scroll up gesture to see the scrollback history.

Note: This trick works only if you are using the default “Terminal” App in the Mac. If you use another app like “iTerm2”, then this tip doesnt work. There is an open bug with iterm2 for this and you need to wait for that to get resolved. Click on this link to see the bug.


Categories: MAC

Enabling middle button paste in real vnc for MAC

June 1, 2014 1 comment

If you are used to vnc to a linux machine using the real vnc viewer for MAC, then for sure you have faced this big question, How do I paste the clipboard content to the xterm window over vnc. I have googled a lot and was not able to find a good solution. Finally I got a great solution from my company’s internal mac-wiki and thought of sharing the same so that others can benefit out of it

Best free VNC viewers for MAC

Before we start of with the tip, lets see some of the free vnc viewers for MAC

1. Real VNC  (Free)

2. Chicken VNC (Free)

3. Jolly fast VNC (trial version can be renewed multiple times)

I have tried all the above 3 and I personally like real vnc the most for being the fastest of all the above 3. besides thats its free which makes it the best. Only problem with real vnc is that pasting the clipboard content over vnc may not work for some applications if you are vncing to linux. One such example is xterm. Xterm doesnt give the option of Paste in the right click context menu. Generally mouse middle button is the shortcut to paste in xterm which doesnt work through MAC.

On the other hand chicken VNC allows to modify the keyboard mappings to work around the above issue which is discussed above. But chiken vnc is very slow compared to real vnc. You will feel the difference when your internet connection speed is very less. In Chicken vnc, you can emulate middle button paste via Option+click on trackpad by changing the below setting

“Go to Connection Menu and select the Connection Profiles: –>Emulation” and change to below


Emulating middle button mouse click in Real VNC

As mentioned above, I prefer Real VNC over others and I needed a solution for middle button mouse click. There came the app called middleclick to your rescue.

Run a small app called middleclick (http://clement.beffa.org/labs/projects/middleclick/). This allows you to emulate the middle button mouse click on a Mac book Pro with a three-finger touch. Then in realVnc options, enable the three-button emulation mode. Once you have this set up, you will be able to cmd-c in your mac and three-finger tap in vnc to paste.

Also do the follwoing as well Go to System Preferences -> Trackpad and uncheck “Look up”

Categories: MAC

Configuring ZTE AC2738 3G modem on MAC OS X 10.9.3

May 31, 2014 34 comments

I have recently got  a Mac book Pro and was trying to connect to internet through my Reliance Netconnect Dongle. Since I am new to Mac and since the Reliance software doesnt work on the New Mavericks OS, i had a difficult time trying to configure it up. This post helps in configuring the same.

Note: After I wrote this post, there have been numerous MAC OS updates which came in that can cause the below hack to not work. So please note down the bottom of this page, if you are running the latest MAC OS.

Reliance Netconnect 3g dongle which I am using was a ZTE AC2738 model and this post is mainly for that though it may be applicable for other 3g dongles provided you have the driver for the same.

Issue: Reliance Netconnect provides MAC drivers and dialer software, but the dialer software doesn’t work on OS X Mavericks version, Which is what this post is trying to solve

Solution: Mac supports inbuilt dialer software and this post is basically making use of that to get connected. But this works only if the driver for the 3G modem is successfully installed

Step by Step guide

  1. Connect Reliance connect to the USB port of the MAC
  2. Automatically a virtual CD drive will appear and open the zip file corresponding to mac installer and follow the instructions.
    Note: You can download the MAC driver package directly from my dropbox link as well. Dropbox link
  3. Double click the installer and follow the installation process until complete.
  4. Once installed you will have a “Reliance Netconnect+” icon in your desktop. This is the dialer and its of no use. So you can move it to trash.
  5. Now open “Network Preferences page” from system Preferences->Network
  6. There on the left pane you will be able to see some new entries corresponding to “ZTE”
  7. Select the ZTE Wireless Terminal in that list and put the below info
    Telephone Number: #777
    Account Name: net
    Password: net
  8. Keep the Other values as it is and click on apply and select connect. Once connected you should be able to browse.

ZTE 2738 on MAC








Maverick users for whom the above hack didnt work or the dongle stopped working after getting updates.

Courtesy: The below hack is originally provided by ruchirs in the apple community and I am posting it here. Original thread can be found at Apple community thread for Mavericks


  1. Go to network preferences
  2. Lookup ZTE wireless terminal
  3. enter on right side: telephone no as #777
  4. account name and password as your dongles mobile number.
  5. and click connect!!.

Elcapitan users for whom the Dongle stopped working after upgrade.

Courtesy: The below hack is originally provided by rochishnudutta in the apple community and I am posting it here. Original thread can be found at Apple Community thread for Elcapitan . Also special thanks to Anuj Gupta who mentioned the same in the comments.


  1. Boot into Mac by pressing CMD + R (Recovery Mode)
  2. Go to Terminal under Utilities.
  3. Type in csrutil disable. A comment will be displayed that your csrutil has been disabled.
  4. Reboot
  5.  Install the driver as usual and it will require a reboot again.
  6. Then go to network preference. Fill in all details (account and password) by selecting the driver name (in my case, ZTE Wireless Terminal) on the left panel. Save it and connect.
Categories: Gadgets, MAC

Configuring external DVD drive on Xbian/Raspberry Pi

April 22, 2014 3 comments

As mentioned in my earlier posts, raspberry Pi when combined with Xbian or Raspbmc forms a great and affordable HTPC. I was in the market to look for a cheap DVD player as my panasonic BD player doesnt support Divx formats. Then this idea came to mind that why not buy a external USB dvd drive and hook it up to raspberry Pi. Did some googling and found that lot of people are using it that way. So finalized on a cheap DVD drive and tried configuring it on Xbian. But as it turned out this was not straight forward so thought of sharing the “How to” which I found after googling a lot. Since this time I had two SD cards lying around I tried both Xbian and Raspbmc and turned out that on Raspbmc it was easier to get it working. So I will share the method on both the OS.

Hardware Info

1. Raspbberry Pi

2. Powered USB Hub (Optional)

3. External USB dvd drive (I used Buffalo MediaStation 8x Portable CD/DVD Writer)

Pros of Buffalo Drive

* LED indication to say if it requires more power

* Comes with a Y USB cable (which seperates Power and Data USB cable)

Note: My USB hub was not able to power up the DVD drive, hence I connected the power USB cable to a Nexus 7 Power adapter.

Most of the info below is taken from http://forum.stmlabs.com/showthread.php?tid=7623

Configuration in Raspbmc.

Configuration in raspbmc was simple. Just download the PlayDVD addon zip file from the below link and install the add on through the XBMC menu (System->Addon->Install from Zip file). Once done go to XBMC->System->Addon->Programs->PlayDVD->select install). This takes some time as it has to download some additional packages from net.

Download link: http://forum.stmlabs.com/attachment.php?aid=527

Once installed automatically the PLay CD button will come when you insert the DVD.


Configuration in Xbian

Configuring on Xbian is not straight forward as some how the addon python script was not working on xbian (There are ways to fix it, but I thought the manual process is easier as in Xbian the DVD drive was not getting automounted due to permission issues.
1. Get Required Programs
sudo apt-get update
sudo apt-get install -y bzip2 make mplayer curl lsdvd

2. Compile libdvdcss
wget http://www.videolan.org/pub/libdvdcss/1.2.13/libdvdcss-1.2.13.tar.bz2
tar -xvjf libdvdcss-1.2.13.tar.bz2
cd libdvdcss-1.2.13
sudo make install
cp /usr/local/lib/libdvdcss* /lib
sudo apt-get -y -f install

3. Setup Filesystem
sudo mkdir /media/LARGEFILES
sudo mkfifo /media/LARGEFILES/dvd.mpg
sudo chmod o+w /media/LARGEFILES/dvd.mpg

4. Add xbian user to cdrom group.
sudo usermod -a -G cdrom xbian

5. Add the below entry to the /etc/fstab file (assumption is the dvd drive is detected as /dev/sr0)
/dev/sr0        /media/LARGEFILES               auto                    noauto,ro,user  0 0

6. Once done just reboot or do mount -a. Now the play CD option will be available on XBMC

Categories: Audio/Video

Ipv6 Logo Interoperability Test using Tahi Vel tool

August 23, 2013 11 comments

I found that lot of queries in the tahi forums are regarding setting up of the Ipv6 interoperabilty testbed and thought of sharing my experience which may help others.

This is a continuation of my previous post “IPv6 logo certification using Tahi Self test tool

As mentioned there to get the ipv6 logo certification, two tests are mandatory,

  1. ipv6 logo conformance test using the Selftest tool
  2. IPv6 interoperability test using the Vel tool

Goal of this test

The primary goal for this test is to make sure that, the unit under test’s (UUT) ipv6 implementation is interoperable with other vendor implementation.

Hardware Requirements for the test.

  • VEL tool.
  • 2 x PC’s(Reference Node) running free BSD OS with 3 NICS
  • 1 x PC(Vel Manager Node) running Free BSD OS with 1 NIC
  • 1 x PC (Dumper Node) running Free BSD with 4 NICs
  • 4 X PC’s (Target Nodes) running 4 different OS with 4 NICs each. Recommended Target OS are         – FreeBSD 7.0
            – NetBSD 4.0.1
            – OpenBSD 4.3
            – Fedora9
    – KAME
    – USAGI

*  I have used the bold ones as my target OS

So as we can see we need total 8 PC’s/Servers in total. We can reduce the number of PCS to 5 by running all the 4 Target OS installed in 1 single PC as well. Also please note the number of NICs which are required as well. Because of this requirements its a very difficult to have this topology. but fortunately the new virtualization technologies can help us with solving the issue and this post is about how we can optimize/achieve the same topology using a virtualization enabled server using  Vmware’s Esxi.

Optimized Setup/resources which I used

  1. Server Hardware: Cisco UCS C250M1 Rack mount server running ESXi 5.1 (Instead of this any server/hardware which is supported by ESXi can be used as well)
  2. Number of Physical Nics on the server: 1
  3. Virtualization Software/Hypervisor: ESXI 5.1

Understanding the topology for Interoperability test

First of all lets understand how to read the topology which is mentioned in the Vel tool’s read me file. Following is the topology mentioned in the README file of vel tool

                                      Network 1
              |              |           |      |
              | 1            |           | 1    +-------------+
       TG +-----------+      |        +------+                |
   +------| REF-1 (V) |      |        | LOGO |                |
   |      +-----------+      |        +------+                |
   |          | 2            |                                |
   |          |              |        Network 2               |
   |    ------+------+------------+------+-----+--            |
   |                 |       |    |            |              |
   |               1 |       |    |            +------+       |
   |       TG +----------+   |    |                   |       |
   | +--------| REF-2 (V)|   |    |                   |       |
   | |        +----------+   |    |                   |       |
   | |             2 |       |    |                   |       |
   | |               |       |    |   Network 3       |       |
   | |  ------+------+------------------------+---    |       |
   | |        |              |    |           |       |       |
   | |        | 3            |    |           |       |       |
   | |  TG +----------+ 1    |    |           |       |       |
   | | +---| TAR* (V) |------+    |           |       |       |
   | | |   +----------+           |           |       |       |
   | | |      | 2                 |           |       |       |
   | | |      +-------------------+           |       |       |
   | | |                                      |       |       |
   | | |                                      |       | 2     |
   | | |     Network for TG                   |  +---------+  |
  -+-+-+----+-------+-                        +--| dump (V)|--+
            |       |                          3 +---------+ 1
         TG |       |                                 | TG
      +---------+   +---------------------------------+
      | vel mgr |

the above one doesnt give a clear picture on how the connections are. So lets see how the topology can be interpreted.

  • Each Square/rectangular boxes are devices or PCS
  • LOGO : device under testing or your device.
  • vel mgr : vel manager, device on which velm program runs (Runs Free BSD OS)
  • TAR* : 4 interoperable devices from other vendors devices (Target nodes running target OS) including 2 hosts and 2 routers.
  • REF-1 : reference node running Free BSD OS
  • REF-2 : reference node running Free BSD OS
  • dump : packet monitor running Free BSD OS
  • (V) : device which vela and velo programs run and they are TAR*, REF-1, REF-2 and dump
  • The number around the box/device indicates the Network interfaces
  • The dashed lines (—) are the links/connections from the NIC cards
  • Network1, Network2 and Network3 are Hubs (Remember its a hub not a switch)
  • Network for TG is the management network and can be a switch.
  • “+” sign on the dashed line indicates that those two lines merge there, if there is no “+” sign that means those lines dont merge.

How to setup the same topology in the virtualized Server.

The same setup can be easily set up using Vmware’s ESXi.

  1. VM Creation: Create VMs corresponding to all the 8 devices in the topology in the same ESXi server. While creating VMs, allocate the required number of Virtual NICs as well to the VM.
  2. Vswitch Creation:  Now our job is to simulate three different network hub’s(network1, network2 and Netowrk3). For this in Vsphere Client go to ESXI Host->Configuration->Networking->Add networking–>Virtual machine(as the connection type)->Select no Physical adapters->Give a network label(network1)->Finish. Repeat the same for Network 2 and network 3. For Network TG select the physical NIC corresponding to the NIC which is conencting to the Management NIC.
  3. Mapping Network Labels to Virtual NICs: Now map the virtual NICs of each of the VM to the appropriate Network labels(Right click on the VM–>Edit Settings->Select the NIC adapter->Enter the network Label as Network1/2/3 depending on the topology.
  4. Configuring the Vswitches to behave like a hub: Another requirement is to configure the vswitches created in step 2 to behave like a hub. For this go to ESXI Server->Configuration->Networking->Select the Vswitch Name(Networ1/2/3)->Properties->Security Tab->Enable promiscuous Mode and Change it to Accept and OK.
  5. IP address Assignment:  The Virtual NICS which are mapped to Network TG will be assigned with IP address which is used for management as well as for velmgr to interact with vel clients.

Installing and Running the tool.

This is already covered in the README file of the Vel tool.

Important input file for the vel tool is a file called “config” in the “vel-5.0.1/interop_ph2” directory.

Following are the most important items which needs to be changed.

# LOGO TYPE: type of your device [host or router]
LOGO_TYPE router
# LOGO_NAME: name of your device

LOGO_IF1 Ethernet1/1
LOGO_IF1_MAC 00:00:00:00:00:01
# LOGO_IF2 : interface name and mac address on your device
# If LOGO_TYPE is router, you need to edit LOGO_IF2
LOGO_IF2 Ethernet1/2
LOGO_IF2_MAC 00:00:00:00:00:02
Similarly put the corresponding NIC mac address for the other devices in the file. Mac address can be found from the ifconfig command output.

Edit the following to change the ip address for the management or TG network
TAR1_IFTG eth0 "Put the interface name here"
TAR2_IFTG eth0 "Put the interface name here"
TAR3_IFTG eth0 "Put the interface name here"
TAR4_IFTG eth0 "Put the interface name here"
REF1_IFTG eth0
REF2_IFTG eth0
DUMPER_IFTG_V4_ADDR 192.168.20.

Some Tips

  • Make sure the firewall is disabled in all the devices which you are using. Else, vel manager may fail to connect to the vel clients.
  • Some of the tools wont be there in fedora by default. rtadvd is such a tool which I had to install.
Categories: IPV6, Technical

TCL Tips

August 22, 2013 7 comments

Note: Credits for the tips mentioned here goes to multiple people
and internet sites.  I just consolidated them together for my reference.

Hex Codes for special key combinations to be send to routers/PC

Refer the following table for the hexa decimal code for each of the special key combinations. Most frequently used one is CTRL+C. This can be used in tcl/expect to send these key combinations to a router/PC.

KeyCombination Hexadecimal
CTRL-@ 0x00
CTRL-A 0x01
CTRL-B 0x02
CTRL-C 0x03
CTRL-D 0x04
CTRL-E 0x05
CTRL-F 0x06
CTRL-G 0x07
CTRL-H 0x08
CTRL-I 0x09
CTRL-P 0x10
CTRL-Q 0x11
CTRL-R 0x12
CTRL-S 0x13
CTRL-T 0x14
CTRL-U 0x15
CTRL-V 0x16
CTRL-W 0x17
CTRL-X 0x18
CTRL-Y 0x19

Dynamic variables in Tcl (Eval command to the rescue)

Most often I ran in to issue how to reference or retrieve value from a dynamic tcl variable (or value of a variables, variable)..Got confused!!!? let me explain with an example what the problem is and whats the solution?

set vlanid "11 12 13"
set iplst " 12.0.1 13.0.1"
#Now you want to have the below mapping
#vlan 11->
#vlan 12->
#vlan 13->
#Now lets say i have to store the ip of vlan 11 in a name referenced by the vlan id like below

foreach id $vlanid ip $iplst {
set vlan$id $ip

#Now we have the following variable to value mapping
#vlan11 -->
#vlan12 -->
#vlan13 -->
#The above is called dynamic variable as the variable name is dynamically changing

#Now comes the real question, how to get the value of a dynamic variable
#I cannot use puts "$vlan$id" as it will error out saying cannot read "vlan" no such variable.
#This is where the power of eval comes in to picture and below is the solution

foreach i $vlanid {
puts "The ip of vlan $i is [eval set vlan$i]"

The above code will give the output

The ip of vlan 11 is
The ip of vlan 12 is
The ip of vlan 13 is

Categories: TCL, Technical

Configuring Reliance Netconnect(ZTE AC2738) with TP-Link TL-MR3020 3G Wireless Router

August 12, 2013 177 comments

This post is about how to configure a Reliance Netconnect (USB 3G/4G dongle) with a TP-Link TL-MR3020 Wireless 3G router.

Prelude:  TP-Link MR3030 3G/4G wireless router is a small portable device which helps in sharing an internet connection from 3g/4G USB sticks/connections like Reliance Netconnect/Tata Photon/BSNL EVDO/Airtel etc over a Wifi network.

Some of the highlights of this produce are

  • Very small and lightweight and aesthetics are pretty good (Have the looks of a apple product 🙂 )
  • Powered via a mini USB port and the charger cable is a mini USB to regular USB which means you can power it by simply connecting it a laptop. Also if you have a car mobile charger you can power it up in the car and make your car a mobile wifi hotspot
  • Have a RJ45 Ethernet port which can act as a wan port as well as a lan port depending on the mode of operation
  • Supports 3 modes of operation
    3G/4G only mode: Primary internet connection is from the 3G/4G dongle connected to the USB port of the router and the RJ45 port will act as a LAN port.
    WAN/3G/4G mode: Primary internet connection is from the WAN and if its not working then it will fall back to the 3g/4g usb dongle. Note in this mode the RJ45 port will act like a WAN port.
    Note: This can be used in home as a always connected internet redundancy option
    WAN only mode: Primary internet connection is from the WAN port and 3g/4G is not used In this mode the RJ45 port works as a WAN port.

Out of the box, this router doesn’t support Reliance Netconnect (ZTE AC2738). The router will keep on identifying the device and then say conencting to it and then will get disconnected.   Following are the steps which I followed to make it work. Thought of sharing it as it may help others.

  1. Firmware Upgrade: The default firmware which came with the device needs to be upgraded to the latest one for this to work.(
    Default Firmware which I got was: 3.14.2 Build 120817 Rel.55520n
    Upgraded firmware version : 3.15.2 Build 130326 Rel.58517
    Date of release of the new firmware: 18th April 2013
    Firmware Download Link:  http://www.tp-link.us/support/download/?model=TL-MR3020&version=V1 (if the site is down you get the same from here.
    Firmware file name: TL-MR3020_V1_130326
    Installing the firmware: Unzip/extract the downloaded firmware to a folder. Now go to the the TR3929 websetup click on SystemTools->Firmwareupgrade->and point to the extracted firmware image location.  Upgrade will take about 1 minute, wait for it to be complete and then proceed to step 2.
  2. Configuring the 3G router: Now in the TR3020 websetup, click on Quicksetup, select 3G/4G router only mode ->Next->Select Country as India->Select the Service provider as “Reliance Netconnect” (there are multiple reliance profiles, so select the one with Dial number as #777 and APN is blank (read blank as nothing)”, Select manual option of entering username and password and put username as “net” and password as “net”->Next->Click next until you get finish

Thats it you are done, Now you should be able to connect to the internet.

Categories: Gadgets, Technical