Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-20-2017, 10:03 AM
ruben.dario ruben.dario is offline
Registered User
 
Join Date: Jun 2017
Posts: 5
Question Massive Hostname Change

Hello,

The main reason I am using SecureCRT is because I need to change the hostname (and interface descriptions) for over more than 5000+ Cisco routers/switches in a practical and "fast" way.

It seems that the best method for completing this task is using the VanDyke's example script "RunCommandsOnMultipleHostsAndLogResults.vbs" which allows to connect to a list of IP Addresses (or hostnames) and run a list of commands. However this list of commands (in my case) must be unique for each IP address, due the configuration of different hostnames. That is, executing a unique set of commands suck as #hostname HOSTA, for IP_1; then #hostname HOSTB, for IP_2 and so on...

If you have any suggestion for this requirement, I will be more than grateful.

Many thanks in advance,

Ruben D. Colmenares
ruben.colmenares@wdna.com
Reply With Quote
  #2  
Old 06-20-2017, 10:59 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi Ruben,

I think "fast" may be a subjective term in this case.

If I understand correctly what you are saying, you are going to need 5000 separate ##commands_variable.txt files, correct?

Have you done any of the setup so far?

If so, is any part of the specific entry in the ##hosts.txt file used to identify the specific "commands filename"?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 06-20-2017, 11:31 AM
ruben.dario ruben.dario is offline
Registered User
 
Join Date: Jun 2017
Posts: 5
Hey Brenda!

Indeed, maybe "fast" was incorrectly used. What I meant, was to look a more efficient way through SecureCRT rather updating each NE's hostname manually.

Answering your first question, Yes. I'd need a specific configuration file for each router/switch; considering that each hostname will be different.

For the hosts.txt file, I'll have something like this:

14.191.214.6
14.191.214.5

Then, the commands to execute:

enable
config
sysname NEW_HOSTNAME


So as you can see there is no specification of the configuration command script in the hostname files.

Thanks,
Reply With Quote
  #4  
Old 06-20-2017, 11:48 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi Ruben,

Are you saying in the commands file, only that one command differs from host to host?

Do you want to be prompted to provide NEW_HOSTNAME?

If not, is there some sort of pattern so it can be automated?

Can you list the explicit steps of how you would do this manually?

If the list contains sensitive data, please send an email to support@vandyke.com and include "Attn Brenda - Forum Thread #12733" in the subject line.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 06-20-2017, 11:57 AM
ruben.dario ruben.dario is offline
Registered User
 
Join Date: Jun 2017
Posts: 5
That's correct Brenda. The only "field" that'll be different from one command configuration script from another is the "NEW_HOSTNAME" info.

The manual configuration it's very simple:

Right after the NE is logged on:

<CX-OpLab>system-view
[CX-OpLab]
[CX-OpLab]sysname TestsNamingConvention
[TestNamingConvention]
[TestNamingConvention]

And for the interfaces description:

[TestNamingConvention]inter
[TestNamingConvention]interface GigabitEthernet6/0/13
[TestNamingConvention-GigabitEthernet6/0/13]description InterfaceNamingConvention


Every NE to manipulate holds the same OS and syntaxis, so the command script can be used to all 5000+ NEs. However the HOSTNAME information must be different for each element.
Reply With Quote
  #6  
Old 06-20-2017, 01:13 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi Ruben,

What is the "TestsNamingConvention" pattern you will be using?

What is the "InterfaceNamingConvention" pattern will be using?

Is this something that can be derived from the IP address?

Do you already have a file that contains all 5000 IP addresses?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 06-20-2017, 01:24 PM
ruben.dario ruben.dario is offline
Registered User
 
Join Date: Jun 2017
Posts: 5
Brenda,


What is the "TestsNamingConvention" pattern you will be using?
No, this is only an example. The new hostnames will have a format like this: MXTLAM01EDG01 based on our network's parameteres and characteristics.

What is the "InterfaceNamingConvention" pattern will be using?
Same as above.

Is this something that can be derived from the IP address?
No It cant...

Do you already have a file that contains all 5000 IP addresses?
Yep, I do have a file with all 5000 IPs.
Reply With Quote
  #8  
Old 06-21-2017, 12:07 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi Ruben,

How do you propose associating the IP addresses with the NEW_HOSTNAME?

I previously asked if you would prompt the user, but you did not reply. Is this info also in a file?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #9  
Old 06-21-2017, 02:26 PM
ruben.dario ruben.dario is offline
Registered User
 
Join Date: Jun 2017
Posts: 5
Hello Brenda. It'll be the same username and password for every host...

For your first question, I propose to create an array of host IPs (host.txt). Then use a directory containing individual command configuration script files for each host which names will be set accordingly the IP of the host to be configured. So when the SecureCRT script is executed, the command script files could be executed as well based on the IPs that the SecureCRT is logged on. Did I explain myself crearly (sorry for bad english)?

Let me know your thoughts. Thanks,

Ruben
Reply With Quote
  #10  
Old 06-22-2017, 08:30 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi Ruben,

I thought it made sense to get away from the idea of needing 5000 command files, but that may be the easiest way to associate a new hostname if it can't easily be derived or associated with the current IP address of the device in any other way.

The order of operations will need changed in the example script though. Presently both files (hosts and commands) are opened and all data read into arrays. In your case opening the commands file will depend on the line you are reading from the hosts file.

Another thing to watch out for is that it seems your prompt will change and you will need to detect that in order to "wait for new prompt" before sending that "level of commands".
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply

Tags
batch , change , hostname , script

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 06:33 PM.