Cisco Nexus NXOS and Fixing broken “switchto” syntax with alias

So you are working on your shiny Cisco Nexus 7000 switch with a few virtual device contexts configured. And then you need to change between contexts that you have created, you use this CLI:

N7K-1(config)# switchto vdc

I know. Annoying right!!

What’s makes this piece of CLI annoying is the overlap with

N7K-1(config)# int eth 1/1

N7K-1(config-int)# switchport

command. One of the most common commands on a Nexus, which, you might remember is a very big switch, is the, wait for it, switchport command. And Ethernet ports, of which there are lots and lots in a Nexus 7000 – it’s called a switch, right, use the switchport command all the time.

And, for anyone who has spent several years working on other Cisco devices with Virtual Device Contexts, it also goes against the flow:

Platform Commands
Platform Command
ASA (Firewall with multiple contexts) changeto context
ACE (Application Control Engine – Load Balancer) changeto context
Nexus / NXOS switchto VDC

Why is this so pointlessly different and hateful to customers ?

Temporary Workaround using Aliases

Of course, you can make a workaround using the alias command.

N7K-1(config)# cli alias name changeto switchto vdc

and then you can do this

N7K-1# changeto MGT

This is common practice for all Network Engineers to be the first thing to fix inside NXOS.

The EtherealMind View

Some contacts at Cisco tell me that this command was part of the SAN-OS syntax, and therefore was not changed during the transition to NX-OS.

Well, OK maybe we shouldn’t change things for the sake of it.

But the switchto command overlaps one of the most commonly used commands – switchport. Thus, you have the switchto command, used perhaps one in a thousand times, overlapping with the most common command in a large switch.

And given that the ACE and FWSM set this syntax in place three to five years ago, I do not understand why NXOS should use something different. And because the overlap with the switchport command is so egregious, NXOS should update to the modern era and use changeto syntax.

Ok. I feel better now, got that off my chest. Merry Christmas.

Other Posts in A Series On The Same Topic

  1. Cisco IOS CLI Regex: sh ip bgp in (2nd May 2012)
  2. IOS CLI Tip: More accurate pipe commands (1st May 2012)
  3. Cisco Nexus NXOS and Fixing broken “switchto” syntax with alias (18th December 2011)
  4. show ip eigrp topology all (22nd May 2011)
  5. Cisco IOS CLI Shortcuts (6th February 2011)
  6. The poor man's IOS Traffic Generator (19th September 2009)
  7. IOS: "terminal monitor" on, off - logging to your terminal (17th September 2009)
  8. IOS: Console, Terminal, Monitor, VTY - what is what ? (16th September 2009)
  9. IOS: Clearing an interface configuration (13th September 2009)
  10. IOS: Setting Terminal Window Length (10th September 2009)
  11. IOS CLI: show run linenum (9th September 2009)
  12. IOS: Setting the TCP timeout on IOS (14th August 2008)
  13. IOS: enable and .... disable ? (20th July 2008)
  14. IOS: Reverse SSH console access - Part 2 (25th June 2008)
  15. IOS:Open Source Lab DNS and IP addressing (2nd June 2008)
  16. IOS: Reverse SSH console access (29th May 2008)
  17. ip tcp timestamp (14th April 2008)
  18. Cisco ASA and IOS command tip - test aaa-server (18th February 2008)
  • http://www.facebook.com/jimleach83 Jim Leach

    I don’t think you’ll have this problem under ‘normal’ DC config operations.. switchto/switchback is only used between the default VDC and additional VDCs.  When the additional VDCs are setup, they typically have their own management addressing and you’d SSH into them as you would any other switch – the ‘switchto’ command won’t exist. Managing multi-VDCs via the default VDC is a bad idea ( we only do it in labs where there’s limited addressing available..)

  • Will

    Probably a mute point but the VDC features of the 7Ks are a terrible idea.  

    Every single reason for them seems not quite right to me
     -Development environment – ‘test everything – except the NXOS upgrades – the most important part of  DEV’  
     -Have your internet facing DMZs/AppVaults share the same Core switch.  Sure thing!!
     -Use VDC to support new hardware that isn’t compatible with your old hardware.  If you have one Aggregation layer, why not have two for the price of one! or three…of four.  but that’s it.  Why is four the limitation?  Because of resources?  IMO it’s because cabling will get Crazy with more than four.
     -Services VDC Sandwich – It’s less complex than not having a VDC sandwich.  Right….
     -Have multiple core switches for multiple customers – limited to four customers though.  k…

    I could be totally missing the point.  Just my view at this slightly inebriated time.

  • Guest

    OT but why do you use a [CODE] field for single word commands when you can just use bold or quotation marks (“). 

    But theswitchtocommand overlaps one of the most commonly 

    It unnecessarily increases the pause while reading. A [CODE] tag is much better when you’re pasting a config script or a code snippet (more than a few words)