Expand all | Collapse all

Rename Vlan, how to?

  • 1.  Rename Vlan, how to?

    Posted 08-28-2012 05:15

    Can a vlan be renamed from the command line? I am running Junos 11.4R2.14 on a stack of two EX4500s

  • 2.  RE: Rename Vlan, how to?

    Posted 08-28-2012 05:58



    > configure

    # edit vlans

    [edit vlans]# rename OLD_VLAN to NEW_VLAN

    [edit vlans]# show | compare

    [edit vlans]# commit


     /edit: my bad, i forgot that it will rename the vlan, but NOT the references.


    To achieve this, you would need to use:

    [edit]# replace OLD_VLAN with NEW_VLAN


    however, you should do this only if the vlan has a name that is very unambigious.  that is - the "replace" command will replace really ALL occurences of the left-hand string with the right-hand string.  If, for any reason, you have this string somewhere else in the config for something else, then it will break your config.  as usual a "top show | compare" is helpful.  Also note, if you use "replace", you won't need "rename" at this point.



  • 3.  RE: Rename Vlan, how to?

    Posted 08-28-2012 12:01

    Thanks for the quick reply, I will give this a try


  • 4.  RE: Rename Vlan, how to?

    Posted 08-30-2012 15:29

    As already said, the replace command is your friend.

    replace pattern "old" with "new"


    It operates from the current level of the configuration hierarchy and below.  In other words, if you are inside vlans it will only operate inside vlans.  If you are at the top level it will affect the entire configuration.


    One thing you can do before doing a global replace like this is to look for the old pattern in the config first to see what appears.  Sometimes the original pattern appears in unexpected places.  From the top of the configuration:

    show | display set | match "old"


    If you are using any annotations, replace pattern will affect them as well.  Unfortunately, annotations don't appear in display set format.  To check for annotations with that pattern:

    show | match "^ */?\*" | match "old"

    The first match will pull out any of the annotations.  The second match looks for the pattern you will be replacing.  If nothing comes back, great!  If something does come back, then you'll need to figure out where it is in the config.  Take a couple words from the annotation text, then do:

    show | find "annotation text"

    And last, absolutely, positively, compare before you commit.  And don't make other changes at the same time to be safe.
    show | compare
    If you see something in the comparison that shouldn't be there, you can use the rollback command to undo all of the changes or just correct the things that shouldn't have changed.  If you understand the patch format displayed by show | compare, you can use that as well.  Copy out the entire comparison output to your favorite text editor.  Inside the text editor, delete the parts that shouldn't have been changed.  Go back to the device and use the rollback command.  Then use "load patch terminal" and paste in the updated contents of the text editor.  Press enter then control-D to finish.  Use show | compare again to make sure that this time the changes are only the ones you want.
    Oh, and be careful doing this on older code (10.0 and earlier).  The switches would sometimes get rather confused and/or upset when the vlan names changed.  Use commit full on those.  It won't hurt to use it on newer code as well.

  • 5.  RE: Rename Vlan, how to?

    Posted 09-01-2012 13:32

    I did find one gotcha in all of this. When I changed the name of my storage vlan, it suddenly stopped passing traffic, here is the setup:


    Netapp Filer<--->EX4500<--->Cisco switch in IBM Bladecenter<--->ESXi host


    All of my servers are virtualized so when all 4 of my ESXi hosts suddenly could not see the storage volumes on my Netapp Filer, my entire environment went down. I made the vlan name changes at about 5:00pm and after wrestling with it for nearly 4 hours I opened a case with Jtac. The Juniper engineer solved it in about 15 minutes. He deactivated the vlan and all ports associated with the vlan and then reactivated them. My ESXi hosts immediately saw the storage and me entire vSphere environment came back online. This was the only vlan change where we had to do a deactivate/active to make it work.


    Any idea why?

  • 6.  RE: Rename Vlan, how to?

    Posted 09-02-2012 22:56



    Renaming a VLAN should not break connectivity. Did JTAC mention any internal/external bug for this issue? If this can be easily recreated on your platform/software, then you should suggest JTAC to file a bug for this issue.




  • 7.  RE: Rename Vlan, how to?

    Posted 11-13-2018 15:49



    Out of curiosity did you ever receive a PR from Juniper stating this issue? Also, was the VLAN facing your ESXi hosts swapped or just typical trunk/access ports?

  • 8.  RE: Rename Vlan, how to?

    Posted 08-30-2012 02:02

    At the junos configration alternatively, You can use replace command for everything.