Archive for the ‘Technical’ Category

Sed Tips

Note: This sed tips are more focused on how sed can be used along with Cisco NXOS to format the output. Some syntax may be slightly different from the linux one, but concepts remain the same

    1. Simple Find and replace : How to use sed to replace multiple spaces in an output with a single space
      show ip arp | sed ‘s: \+: :g’
      The sed command will look for zero or more(+) spaces and replace it with a single space

      N6K-SPINE3# show ip arp | head lines 11
      Flags: * - Adjacencies learnt on non-active FHRP router
             + - Adjacencies synced via CFSoE
             # - Adjacencies Throttled for Glean
             D - Static Adjacencies attached to down interface
      IP ARP Table for context default
      Total number of entries: 7631
      Address         Age       MAC Address     Interface    00:18:33  5801.0500.0028  Vlan3740    00:18:33  5801.0500.0050  Vlan3740
      % cli: command canceled
      N6K-SPINE3# show ip arp | head lines 11 | sed 's: \+: :g'
      Flags: * - Adjacencies learnt on non-active FHRP router
       + - Adjacencies synced via CFSoE
       # - Adjacencies Throttled for Glean
       D - Static Adjacencies attached to down interface
      IP ARP Table for context default
      Total number of entries: 7631
      Address Age MAC Address Interface 00:18:41 5801.0500.0028 Vlan3740 00:18:40 5801.0500.0050 Vlan3740
      % cli: command canceled
    2. Advanced Find and Replace: How to remove duplicate spaces in an output as well as replace space between two words(alpha numeric) with a hyphen(-).
      Note: This is really useful when we are using cut command to select columns with a delimiter as space. Some outputs will have column members having values with space and we need to replace those spaces with hyphen else the cut logic will get screwed up

      N6K-SPINE3# show platform afm info copp-tbls 
      COPP table                                   
      * mgmt/ipv6-mgmt - http,snmp,ntp,telnet,ssh,ftp
      ** excp/ipv6-excp - mtu failure, martian address, punt, l3 header errors, icmp errors
      Policer-Num  Name                  CIR       Burst     Passed-Bytes  Dropped-Bytes
      0            default               64000     6250      41239419        0             
      1            stp                   2500000   4687      12456664        0             
      2            lacp                  128000    4687      171548112       0             
      3            fc control            3750000   65535     0               0             
      4            fc errors             125000    65535     0               0             
      5            fc data               125000    65535     0               0             
      6            lldp                  256000    4687      428894355       0             
      7            sat control           62500000  65535     0               0             
      8            sat data              250000    16000     0               0             
      9            udld                  256000    4687      170310698       0             
      10           igmp/ipv6-mld         128000    63        1998396656      200172        
      11           fip                   128000    4687      0               0             
      13           dhcp/ipv6-dhcp        128000    4687      9555449676      1213208586    
      14           L3 data hi            2500000   4096      0               0             
      15           L3 data low           1250000   512       0               0             
      16           L3 front panel rdt    250000    2048      0               0
      17           isis                  128000    4687      6499005632      0
      18           cdp                   128000    4687      186341581       0
      19           dot1x                 125000    65535     0               0
      20           pim/ipv6-pim          128000    4687      4997316070      0
      21           mgmt/ipv6-mgmt*       1500000   4687      0               0
      23           arp/ipv6-nd           128000    3515      1373801198      0
      24           rip                   1200000   4687      0               0
      25           ospf/ipv6-ospf        1200000   4687      115913712       0
      26           eigrp/ipv6-eigrp      1200000   4687      0               0
      27           hsrp vrrp/ipv6-hsrp   128000    250       119511901630    0
      29           bgp/ipv6-bpg          1200000   4687      0               0
      30           mcast first hop       1200000   4687      0               0
      31           ping                  8000      3515      0               0
      33           mcast rpf fail        64000     3125      0               0
      35           ucast fib miss        8000      15        122942          2313730
      36           glean                 128000    4687      27752854        51827500
      37           msdp                  1200000   4687      0               0
      38           excption ttl          8000      3125      0               0
      39           exception same intf   8000      3125      0               0
      40           exception ip frag     8000      3125      0               0
      41           excp/ipv6-excp**      8000      4687      1734386         0
      42           bfd                   1200000   4687      5277193652      0
      43           mcast last hop        64000     3125      0               0
      44           wccp                  132500    4687      0               0
      45           onep dpss             78125     3125      0               0
      46           ecp                   800000    3125      0               0
      47           vxlan                 128000    4687      0               0
      48           nvgre                 125000    65535     0               0
      49           L3 isis               128000    4687      0               0
      50           CFSoE Rel             62500000  65535     0               0

      Note: In the above output below fields in the 2nd column has spaces in between the entry like “sat control”, “sat data”, “L3 data hi”, “L3 data low”, “L3 front panel rdt”, “hsrp vrrp/ipv6-hsrp”, “mcast rpf fail”, “ucast fib miss”, “excption ttl”, “exception same intf”, “exception ip frag”, “mcast last hop”, “L3 isis”, “CFSoE Rel”

      Problem: A use case where we need to print only first three columns. For the aforementioned fields with SPACE we are unable to see the CIR 
      N6K-SPINE3# show platform afm info copp-tbls | sed 's: \+: :g' | cut -d " " -f 1-3
      COPP table                                                                        
      * mgmt/ipv6-mgmt -                                                                
      ** excp/ipv6-excp -                                                               
      Policer-Num Name CIR
      0 default 64000                                                                   
      1 stp 2500000                                                                     
      2 lacp 128000                                                                     
      3 fc control                                                                      
      4 fc errors                                                                       
      5 fc data                                                                         
      6 lldp 256000                                                                     
      7 sat control                                                                     
      8 sat data                                                                        
      9 udld 256000                                                                     
      10 igmp/ipv6-mld 128000                                                           
      11 fip 128000                                                                     
      13 dhcp/ipv6-dhcp 128000                                                          
      14 L3 data                                                                        
      15 L3 data                                                                        
      16 L3 front
      17 isis 128000
      18 cdp 128000
      19 dot1x 125000
      20 pim/ipv6-pim 128000
      21 mgmt/ipv6-mgmt* 1500000
      23 arp/ipv6-nd 128000
      24 rip 1200000
      25 ospf/ipv6-ospf 1200000
      26 eigrp/ipv6-eigrp 1200000
      27 hsrp vrrp/ipv6-hsrp
      29 bgp/ipv6-bpg 1200000
      30 mcast first
      31 ping 8000
      33 mcast rpf
      35 ucast fib
      36 glean 128000
      37 msdp 1200000
      38 excption ttl
      39 exception same
      40 exception ip
      41 excp/ipv6-excp** 8000
      42 bfd 1200000
      43 mcast last
      44 wccp 132500
      45 onep dpss
      46 ecp 800000
      47 vxlan 128000
      48 nvgre 125000
      49 L3 isis
      50 CFSoE Rel

      Sed command to the Rescue

      N6K-SPINE3# show platform afm info copp-tbls | sed 's: \+: :g' | sed 's:\([A-Z,a-z][0-9]*\) \([A-Z,a-z][0-9]*\):\1\-\2:g' | cut -d " " -f 1-3
      * mgmt/ipv6-mgmt -                                                                                                                           
      ** excp/ipv6-excp -                                                                                                                          
      0 default 64000                                                                   
      1 stp 2500000                                                                     
      2 lacp 128000                                                                     
      3 fc-control 3750000                                                              
      4 fc-errors 125000                                                                
      5 fc-data 125000                                                                  
      6 lldp 256000                                                                     
      7 sat-control 62500000                                                            
      8 sat-data 250000                                                                 
      9 udld 256000                                                                     
      10 igmp/ipv6-mld 128000                                                           
      11 fip 128000                                                                     
      13 dhcp/ipv6-dhcp 128000                                                          
      14 L3-data-hi 2500000                                                             
      15 L3-data-low 1250000                                                            
      16 L3-front-panel-rdt 250000
      17 isis 128000
      18 cdp 128000
      19 dot1x 125000
      20 pim/ipv6-pim 128000
      21 mgmt/ipv6-mgmt* 1500000
      23 arp/ipv6-nd 128000
      24 rip 1200000
      25 ospf/ipv6-ospf 1200000
      26 eigrp/ipv6-eigrp 1200000
      27 hsrp-vrrp/ipv6-hsrp 128000
      29 bgp/ipv6-bpg 1200000
      30 mcast-first-hop 1200000
      31 ping 8000
      33 mcast-rpf-fail 64000
      35 ucast-fib-miss 8000
      36 glean 128000
      37 msdp 1200000
      38 excption-ttl 8000
      39 exception-same-intf 8000
      40 exception-ip frag
      41 excp/ipv6-excp** 8000
      42 bfd 1200000
      43 mcast-last-hop 64000
      44 wccp 132500
      45 onep-dpss 78125
      46 ecp 800000
      47 vxlan 128000
      48 nvgre 125000
      49 L3-isis 128000
      50 CFSoE-Rel 62500000
Categories: Linux

PC Based Traffic generators


  1. iperf: CLI mode only. Works on all platforms.
  2. jperf : GUI equivalent of iperf.
  3. Ostinato –> Ixia like interface and hence can create any type of packet easily.


  1. mcast.exe -> Windows only
  2. uftp -> Windows/MAC/Linux
  3. vlc –> Works on all platforms


Panasonic KX-TGE273S Link2Cell Review

September 20, 2016 Leave a comment

I have been owning the Panasonic KX-TGE273S Link2Cell for more than a year now and always wanted to put a review of it. This is a smaller review which focuses on its advantages and disadvantages. So here it goes.

Why do I/You need it: If you are staying in a place where the cell phone reception is quite bad then this is a device which you should own as you can keep the cellphone at a place where the range is good and then enable bluetooth on phone and start pairing it with the panasonic base unit. Once paired you can use the panasonic handsets for calling or receiving from your cellphone. Other advantages are


  • Convenience: You can connect up to two cell phones via bluetooth and 1 landphone to the base unit.[Keep the cell phone where there is a good signal reception and turn on the bluetooth and cell will get paired with the base unit). So you will have a single cordless phone using which you can call/receive calls from all the three phones at home. When an incoming call comes all the handsets ring and you can attend the call from any of the units.
  • Less Radiation: Since we are now talking over the headset, we dont need to worry about the cellphone radiation as the handsets talk to the base station using the bluetooth technology. Also cellphones gets heated up fast while using for long hours and using this helps in avoiding the heat on the ears as well.
  • Allows simultaneous use of all linked cell phones: This model supports maximum of two cellphones to be paired and when you are attending a call from a handset on CELL1 at the same time you can recieve/call from another handset using CELL2.
  • Intercom: It can be used like a intercom to call from one room to another by keeping handsets in different rooms/floors. This is very useful if you stay in a duplex/two storied appts.
  • Ring as a cell mode feature makes it easy to identify on which cell the call is coming. Ring as a cell feature means, the ringtone of the paired cell phone will be used as the ringtone for the cordless phone.So this way we can differentiate on which cell the call is incoming.
  • Cellphone Address book syncing: Cellphones address book can be imported to the base unit over bluetooth. For this feature, the cellphone needs to support bluetooth PBAP(phonebook access profile) which is common in the current generation smart phones. Even most Nokia feature phones with Bluetooth HSP (hands free profile) supports the same.This helps in searching for names from the handset itself and allows directly calling from the handset.
  • Talking Caller ID: If the incoming caller’s number is saved in the address book of base unit, then while getting a call, handset will announce the name along with the ring tone which is a useful feature. If the name is not there in the address book, then it will call out the number. This can be disabled if you dont want this feature.
  • Inbuilt clock and Alarm: Clock and Alarm features are there on the handset and can be configured independently on each handset.
  • Battery: It uses regular “AA” rechargeable battery and hence its easy to replace one if it goes bad. This was the main reason why I bought this instead of a Vtec (Vtec uses proprietary battery)
  • Build Quality: Build quality is superb as my handsets had fallen down multiple times and still no major issues. One handset suffered a broken display, but still its functional though its difficult to read from it. But overall the quality is superb considering the price which I paid.


  • Can’t reject the call from the handset: When you get a call on one of the linked cell phones and there is no option from the handset to reject the call. The only way to reject the call is to go and find the cell phone on which the call is coming and reject it from there. In handset you only get the option to silence the handset.This is one of the biggest disadvantages as if you are in the middle of a meeting and then all the handsets around the house will start ringing the moment you get a call and if you want to disconnect the call, only way is to find the cellphone and reject the call from there. Silencing the handset silences only one which we are holding and the remaining handsets and baseunit will still be ringing.
  • Country Code problem: If your address book in the cellphone contains a country code with (+ sign like +1 or +91) then while trying to call from the address book it will not work as it doesn’t understand + sign. This is a big problem as most of my contacts have a country code prefixed for them, so I had to manually remove the  country code (in my case +91.
  • No battery for base unit: It would be great if the base unit came with a battery as in a country like india where power cuts are common, the moment base unit power goes, bluetooth connection between cellphone also goes. To workaround either keep a fully charged handset on the base unit so that the base unit gets the power from the handset. But in my case I connected the base unit to an UPS so that it will always remain up.
  • Power adaptor for base unit and handset: This cannot be a disadvantage as, but it would be great if panasonic could provide a power adaptor which supports 110V and 230V so that it can be used across the globe. Since I bought this from US, it came with a 110V power adaptor. I used a step down transformer adaptor to make it work in India. This product is not yet available in India.

Other things which I couldn’t rate

  • Call Quality: Call quality is Ok . But I think it can be bettered as at times it sounds little muddy.
  • Range (between handset and baseunit): Since I live in a 2 bedroom apartment of 1416sqft, I cannot comment on the range as in my house every room I get a good coverage for the handsets. Base unit is placed in the living room and the handsets are in each bed room.
  • Battery backup: Battery backup is not much of concern and hence I haven’t reviewed the same. But with moderate usage it gives more than a day back up.
  • VoiceMail : It supports storing of voice mails and automatic answering. But I haven’t tested it.

Where to buy

Currently this product is not on sale in India. So you have to get it from US. Following is the amazon link for the same.
Panasonic KX-TGE273S Link2Cell Bluetooth Enabled Phone with Answering Machine & 3 Cordless Handsets


This slideshow requires JavaScript.



Categories: Gadgets

Automating starting of Ixia IxNetwork NGPF DHCP clients

August 8, 2016 4 comments

Courtesy: The baseline script which is mentioned here is provided by Anush Varada of ixia customer support team and a big thanks to him for the same.

Problem: In my system testbed which is using IxNetwork NGPF interfaces,I wanted an automated way of starting all device-groups especially the ones using dhcpv4/dhcpv6 clients one by one. Starting all device blocks doesnt work most of the time and hence I wanted to start one by one.

Resoultion: Run the below python code in your IxNetwork Machine, which will automate the starting of the device blocks.
Note:This script can be easily converted to Tcl as the ixnetwork API’s are mostly same.

Environment setup:

Note: This script assumes that you already have a IxNetwork configuration with a DHCPv4 server running.

  1. IxNetwork TCL server: Instead of opening the Ixnetwork config directly, open it from the IxNetwork TCL server. IxNetwork TCL server is also same as IxNetwork GUI, but it will start a TCL server as well.
  2. Python ENV setup: Add “C:\Program Files (x86)\Ixia\Python\x.x.x” to your PATH variable in windows, where x.x.x is your python version (Refer  for setting up path variable)
  3. Command prompt: Type “cmd” in Run prompt and there type python to  make sure its working fine.
from pprint import pprint
import os
import sys
import time
from datetime import datetime
ixNetPath = r'C:\Program Files (x86)\Ixia\IxNetwork\7.30-GA\API\Python'
from IxNetwork import IxNet
ixNet = IxNet()
ixNet.connect('', '-port', 8009, '-version', '7.30')
root = ixNet.getRoot()
#Retrieves all topologies in the config
topologies = ixNet.getList(root, 'topology')
#Iterating over each topology
device_count = 0
for each_topology in topologies:
	#Retrieving topology name so that DHCP server name can be excluded
	topology_name = ixNet.getAttribute(each_topology, '-name')
	print "Executing for topology %s." %topology_name
	#Execute the below code except for DHCP server topology
	if topology_name != 'N56-55-FEX103-104-EVPC':
		print topology_name
		#Retreiving the device groups in each topology
		device_groups = ixNet.getList(each_topology, 'deviceGroup')
		#Iterating over each device group in the topology
		for each_devicegroup in device_groups:
			devicegroup_name = ixNet.getAttribute(each_devicegroup, '-name')
			print "Executing for devicegroup %s." %devicegroup_name
			#Retrieving the handle for dhcpv4_client and dhcpv6_client
			#this is required to start dhcpv6 client first before starting dhcpv4 client
			dhcpv4_client = ixNet.getList(each_devicegroup + ('/ethernet:1'),'dhcpv4client')
			dhcpv6_client = ixNet.getList(each_devicegroup + ('/ethernet:1'),'dhcpv6client')
			if len(dhcpv6_client) > 0:
				print "STARTING DHCPV6 CLIENT FOR %s."%devicegroup_name
				count=int(ixNet.getAttribute(each_devicegroup, '-multiplier'))
				print count
				ixNet.execute('start', dhcpv6_client)
				if count <=10 :
					print "sleeping for 10 seconds"
				elif count <=50 :
					print "sleeping for 10 seconds"
				elif count  100 :
					print "sleeping for 20 seconds"
			if len(dhcpv4_client) > 0:
				print "STARTING DHCPV4 CLIENT FOR %s."%devicegroup_name
				count=int(ixNet.getAttribute(each_devicegroup, '-multiplier'))
				print count
				ixNet.execute('start', dhcpv4_client)
				if count <=10 :
					print "sleeping for 10 seconds"
				elif count <=50 :
					print "sleeping for 20 seconds"
				elif count 100 :
					print "sleeping for 60 seconds"
			#when a device-group has either static ipv4/ipv6 or ethernet only then dhcpv4_client and dhcpv6_client returns an empty list
			if len(dhcpv6_client) == 0:
				print "Starting IPv4,IPv6 and Ethernet clients for %s"%devicegroup_name
				print "Sleeping for 5 seconds"
#print "Total number of devices is {0}".format(device_count)
print "program started at {0}".format(starttime)
print "program ended at {0}".format(endtime)
print "Ixia program completed"

VI/VIM tips

August 8, 2016 Leave a comment

Following are some random tips which I found to be useful. All of them has been collected from different sites and I am just putting them together for my reference.

Most of the examples mentioned here uses the below methodology

if there is a column prefix “:”  then that indicate its the vi command mode. To do this, open the file, press “ESC” key and type “:”

If you want these changes to be permanent, then you can put these commands in a special file called “.vimrc” which is present in your home directory(/users/<username> in Linux & Mac). Create this file, if it doesnt exist.

Indentation Tips

  1.  Enabling/Disabling auto indent
    :set ai ==> To enable
    :set noai ==> to disable
  2. Disabling auto indentation while pasting a code
    :set paste        ==>To disable autoindenting while pasting
    :set nopaste   ==>To enable it back
  3. How to indent a line which you are newly pasting to the existing code block’s indentation
    use ]p instead of just p. This aligns the pasted block with the surrounding text.
  4. Code block indentation tips
    These commands will fix the indents:

    • =i{ reindents “inner block” (inside the braces).
    • =a{ reindents “a block” (including the braces).
    • =2a{ reindents 2 blocks (this block and containing block).

    Instead of “{“, you can use “}” or “B”, for example, =aB indents a block.

    These commands will decrease or increase indents:

    • >i{ increase indent for inner block.
    • . repeat last change (increase indent of block again).
    • <i{ decrease indent for inner block.

    With the cursor on { or }:

    • =% indents the block (including matching brace).
    • >% or <% indents or unindents the block.

Commenting/uncommenting multiple lines in a file
Open the file in VI and in command mode, press “ctrl+v”, now it will go in to visual mode, now move the cursor using the movement keys (arrow keys up/down), move the up/down arrow till you reach the last line you want to comment. Now press “Shift+i” and now enter the character used for commenting “#”

In Nutshell
Commenting: CTRL+v ==> SHIFT+i ==> # ==> Will insert # on the selected column
Uncommenting: CTRL+v ==> x ==> Will delete the #’s in the selected column

Categories: Linux, MAC, Technical

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

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 ( 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