Welcome, Guest. Please login or register.

Author Topic: Config Backup of Cisco Nexus  (Read 307 times)

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Config Backup of Cisco Nexus
« on: February 15, 2017, 04:05:58 PM »
Hi everybody,

I trie to backup the config of a nexus device. But there's a pattern matching error:

Code: [Select]
Config (CLI)   ----------------------------------------------------------------
TEL :nedi@xxx.xxx.xxx.xxx:222 Tout:1s OS:NXOS EN:[\w+().-]+#\s?$
ERR0:pattern match timed-out

Yes, it's port 222. SSH login on tcp/222 with given password for nedi works. On IOS everything also is fine:

Code: [Select]
Config (CLI)   ----------------------------------------------------------------
SSH :nedi@xxx.xxx.xxx.xxx:22 Tout:1s OS:IOS EN:[\w+().-]+#\s?$
PTY :Forking ssh  -l nedi xxx.xxx.xxx.xxx
CLI2:Matched 'Password:' sending password
CLI3:Password sent
CLI4:Matched switch> (or gen. prompt with enpass & enable cmd), enabling
CLI7:Matched 'Password:' sending password
CLI8:Matched enable prompt, OK
CMD :terminal length 0,
CMD :show run OK
WAIT:Building configuration...
WAIT:
CONF:Current configuration : 103093 bytes

I suppose, nedi is expecting something that the switch is not delivering...

ascii

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Config Backup of Cisco Nexus
« Reply #1 on: February 16, 2017, 08:08:45 AM »
my N5K with NXOS 7 works with nexus OS in the .def

libcli
Code: [Select]
$cmd{'NXOS'}{'ropr'} = '[\w+().-]+>\s?$';
$cmd{'NXOS'}{'enpr'} = '[\w+().-]+#\s?$';
$cmd{'NXOS'}{'enab'} = 'enable';
$cmd{'NXOS'}{'page'} = 'terminal length 0';
$cmd{'NXOS'}{'dfwd'} = 'sh mac address-table dyn';
$cmd{'NXOS'}{'shcf'} = 'show running-config';
$cmd{'NXOS'}{'cfst'} = '^begin|running-config';
$cmd{'NXOS'}{'arp'} = 'sh ip arp vrf all';

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: Config Backup of Cisco Nexus
« Reply #2 on: February 16, 2017, 08:48:29 AM »
Mh, for me it's unclear what does not match against what? What does NeDi expect?

gerold

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Config Backup of Cisco Nexus
« Reply #3 on: February 18, 2017, 02:19:50 PM »
Hi,

after a quick glance at libcli.pm, I'd guess that nedi is waiting for the config start pattern, which for
NXOS is initialized as follows:
Code: [Select]
$cmd{'NXOS'}{'cfst'} = '^begin|running-config';

What kind of Nexus device are you trying to backup?

On our Nexen (5500s and 9500s), backup works as expected.
"show runn" output starts with
Quote
!Command: show running-config
which matches the regex above.

Hope this helps!

Gerold

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: Config Backup of Cisco Nexus
« Reply #4 on: February 20, 2017, 08:22:16 AM »
Hi Gerold,

we're running

Code: [Select]
server:/ # ssh nedi@xxx.xxx.xxx.xxx -p 222
User Access Verification
Password:
Cisco Nexus Operating System (NX-OS) Software
[..]
Switch# show running-config

!Command: show running-config
!Time: Mon Feb 20 08:08:50 2017

version 6.2(16)

on N7K-SUP1 (Nexus 7018). In my (v1.0.9) libcli.pm the following applies:

Code: [Select]
$cmd{'NXOS'}{'conf'} = 'show running-config';
$cmd{'NXOS'}{'strt'} = '^begin|running-config';

Think that's ok. Is there a possibility to see what nedi really sends to the switch and what receives it?

gerold

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Config Backup of Cisco Nexus
« Reply #5 on: February 21, 2017, 10:24:24 PM »
Hi again!

In your initial post it looks like NeDi is using the telnet protocol ("TEL") to connect to your SSH server on port 222/TCP.

SSH is only used by libcli.pm when the port number is 22.

Hope this helps

Gerold
« Last Edit: February 21, 2017, 10:32:31 PM by gerold »

dobst

  • Full Member
  • ***
  • Posts: 144
    • View Profile
Re: Config Backup of Cisco Nexus
« Reply #6 on: February 28, 2017, 12:42:24 PM »
Hi Gerold,

testing against a Nexus 9300 works fine. Indeed it looks like NeDi uses Telnet on Port tcp/222.

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2494
    • View Profile
    • NeDi
Re: Config Backup of Cisco Nexus
« Reply #7 on: March 06, 2017, 10:20:16 AM »
I've implemented it with that SSH is only considered on port 22. Everything else reverts to telnet...
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo