We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Creating a batch file to control a Cisco Catalyst 2950 Switch Ports

Medium Priority
4,941 Views
1 Endorsement
Last Modified: 2016-03-31
Hi experts,

I need to create a batch file / or any other method, that will enable a user in the Network Operation Center (who has no knowledge of Cisco IOS) to enable and disable certain ports on the Switch.
Comment
Watch Question

Commented:
Its very simple. You can create simple text file with the commands like this
To disable the port-
interface GigabitEthernet0/1
shut
To enable the port-
interface GigabitEthernet0/1
no shut
He just need to change the port number and copy paste these two lines after login on the switch. you can do multiple ports at time by adding same lines in single file or use interface range command.
 

Commented:
Hi,

Whey make things difficult ? Use the GUI - Cluster Management Suite - Standard on the 2950 switches.
Enable on de switch http:
ip http server

login by browser (no username only password =enable secret)

You will see the switch graphically !!!

Right clik on "port" and select --> port settings --> by status you can enable/disable a port

Click and Play!

No mistakes can happen !!!

A/

Author

Commented:
Thanks for the prompt reply guys

Magim IT:
I want to put thos command in a batch file so that just one click can do that. The thing I face is that whenevere I ran that batch file, It does not accept the entries written in the batch file and requires a user login and password. I do not want user to touch Cisco IOS!

This is the Batch File:
' Telnet 192.167.0.151
password (telnet password)
enable
config t
interface fastethernet0/5
shutdown
end
end
exit
logout'

the batch file to enable has no shutdown instead of a shutdown line.

Wiscom:
Yours is a good idea too. It was my first approach when tackling this issue. But when I use http I get the login that requires username and password (priviledge 15). But when I disable the port it does not want to save changes.
When you said 'ip http server' is that a command I should run to enable the feature you are refering to?

Thanks again for the prompt replies guys.

KR., Onesmo
Istvan KalmarHead of IT Security Division
CERTIFIED EXPERT
Top Expert 2010

Commented:
Hi,

I advise you to use privilege levels, cisco has (0 - 15) 15 is a superuser, you able to give policies to a privilege level!

Please refer this page:
http://www.cisco.com/en/US/docs/ios/security/configuration/guide/sec_cfg_sec_4cli_support_TSD_Island_of_Content_Chapter.html#wp1116277

If you want to enable it via radius see this:

http://www.cisco.com/en/US/tech/tk59/technologies_tech_note09186a008009465c.shtml

Best Regards,
Istvan

Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
The batch solution can either work with AutoIt, or (and that is how I do it) by using netcat (http://joncraton.org/files/nc111nt.zip). With netcat, you can do stuff like

(echo user
 echo password
 echo do-whatever
) | nc -t cisco.domain.local 23 -i 1

Commented:
Hi,
Have a look at this link, maybe helpful to you
http://www.zdnetasia.com/techguide/network/0,3800010800,62037703,00.htm
 
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
This is Exactly what I wanted. Thanks a lot Magim IT. Now I am trying to get it in a web application on one of my servers and save this script there! But for this task I am giving out all the points I will give extra points for the next solutions.

Thanks again for this.
Dear
I want to know the script of logical ether-channel.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.