0

I have a Cisco Catalyst 4500 L3 Switch and have a user called user1. Switch IP is 192.168.1.1.

I have a server which IP is 192.168.2.1.

I created a user in my switch and I can SSH into my switch without password:

[email protected]:~# ssh 192.168.1.1 'show version'

MPC8548 CPU at 1GHz, Cisco Catalyst 4948E-F
Last reset from Reload
2 Virtual Ethernet interfaces
48 Gigabit Ethernet interfaces
4 Ten Gigabit Ethernet interfaces
511K bytes of non-volatile configuration memory.

Configuration register is 0x2102
Connection to 192.168.1.1 closed by remote host.

But this only shows the first command's output:

[email protected]:~# ssh 192.168.1.1 'show version; show run; show ip arp'

Also I'm going to do this:

Changing the description of a port like 1/34 to like "test desc"

I think it should be something like this:

ssh 192.168.1.1 'conf t; int gig 1/34; description "test desc"; exit; write'

Do you please help me how can I do this?

0

2 Answers 2

3

There are many, many tools available to automate network configurations. There are Expect scripts, numerous python libraries, as well as open source and commercial products. Google "network automation tools", or "network automation tools open source" for many examples.

2
  • As @zac67 said, I'm trying to use ansible and its cisco playbook module, and so far I haven't any successes yet. But it seems ansible is what I should've been looking for. Commented Apr 24 at 12:59
  • You might find more help with Ansible on Server Fault.
    – Ron Trunk
    Commented Apr 24 at 13:16
2

You cannot submit multiple commands in a single line with Cisco switches, the ; syntax is *nix bash.

You should look into more integrated approaches like Ansible. That way you could also properly handle error conditions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.