cisco

SNMP: ifAdminStatus vs ifOperStatus

こ雲淡風輕ζ 提交于 2019-12-03 16:11:35
I have a question about ifAdminStatus and ifOperStatus. Here is an output of my network interfaces state using ifAdminStatus: snmpwalk -Os -c public -v 1 192.168.1.1 1.3.6.1.2.1.2.2.1.7ifAdminStatus.1 = INTEGER: up(1) ifAdminStatus.12 = INTEGER: down(2) ifAdminStatus.13 = INTEGER: up(1) ifAdminStatus.14 = INTEGER: up(1) And here is the same list using ifOperStatus: snmpwalk -Os -c public -v 1 192.168.1.1 1.3.6.1.2.1.2.2.1.8 ifOperStatus.12 = INTEGER: down(2) ifOperStatus.13 = INTEGER: down(2) ifOperStatus.14 = INTEGER: down(2) As you can see an ifAdminStatus reports that #13 and #14 are up but

Import error when using netmiko with django : No module named '_cffi_backend'

不羁的心 提交于 2019-12-02 13:59:23
Netmiko works fine when I execute below script file (test.py) from the linux cli #!/var/www/html/devopsenv/bin/python from netmiko import ConnectHandler import getpass cisco_asr = { 'device_type': 'cisco_xr', 'ip': 'my ip', 'username': 'user', 'password': 'pass', 'verbose': True } net_connect = ConnectHandler(**cisco_asr) config_commands = [ 'int BE222.2481', 'vrf devops_test', 'ip add 10.1.1.1/30'] output = net_connect.send_config_set(config_commands) #net_connect.commit() print(output) However when I try to use the same script from a django view by importing as below, I get the import error.

What is the difference between exec_command and send with invoke_shell() on Paramiko?

。_饼干妹妹 提交于 2019-12-01 10:55:10
So what is the difference between SSHClient.exec_command() and send with SSHClient.invoke_shell on Paramiko? I can send and execute command with exec_command to MikroTik router device but can't execute it with send ( invoke_shell() ). On the other hand, I can send and execute command send ( invoke_shell() ) to Cisco device, but can't execute it with exec_command . The command I mean is the configuration command like routing (ip route xxx xxx) or make vlan or add an ip address and etc.. The difference is that invoke_shell uses SSH shell channel, while exec_command uses SSH exec channel. What

Execute multiple commands via SSH and PowerShell

99封情书 提交于 2019-12-01 06:21:44
I successfully managed to connect to a Cisco IE-2000-L switch via SSH. I used the Renci SSH.NET library. Starting guide: http://vwiki.co.uk/SSH_Client_(PowerShell) My working code is # Load SSH library (for .NET 4.0 and PowerShell 3) $DllPath = "D:\temp\Renci.SshNet.dll" [void][reflection.assembly]::LoadFrom( (Resolve-Path $DllPath) ) # Connect to switch (Cisco IE2000-L) with IP, port, username, password $SshClient = New-Object Renci.SshNet.SshClient('172.20.91.30', 22, 'admin', 'mypassword') $SshClient.Connect() # execute one command on Cisco switch $SshCommand = $SshClient.RunCommand('show

Converting subnet mask “/” notation to Cisco 0.0.0.0 standard

女生的网名这么多〃 提交于 2019-12-01 01:08:33
I've searched SO for help but could'nt find a answer to my question. Situation: I need to convert a "/NN" subnet mask notation (think IPTABLES) to a 0.0.0.0 cisco notation. NN are the number of "1" in the submask, from the lowest octet to the higher. Each octet are 8 bit integers. Possible solution: Make a array of 32 "0" and filling the last NN digits with "1", then group in 4 octets and converting to int... a /23 mask should be like 0.0.1.255. My question is how to do it in .NET... i never used binary manipulation and conversion. Can you guys help me with this solution? UPDATE - Stephen has

Programatially determine if Cisco VPN Client is connected

强颜欢笑 提交于 2019-11-30 15:35:43
I am working with the basic Cisco VPN client (v.5 I believe). Is there anyway to determine programatically if a partciular profile (or any profile for that matter) is connected? I'm looking to somehow get a status from the client itself. I don't want to have to try to ping some IP on the other end of the VPN to see if I get a response. There is an API for Cisco VPN (vpnapi.dll). Below a vbs script to check the connection status: bIsVPNConnected = False Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32

Connect CISCO Anyconnect VPN via bash

半腔热情 提交于 2019-11-30 09:06:44
As title says, trying to connect vpn via bash. The following script seemed closest to the answer I'm looking for: #!/bin/bash /opt/cisco/anyconnect/bin/vpn -s << EOF connect https://your.cisco.vpn.hostname/vpn_name here_goes_your_username here_goes_your_passwordy EOF When I run this the vpn starts but then exits without an error and without connecting. This seems to be caused by the -s. If I remove this parameter the VPN will start but none of the commands (ie connect vpn, username, password) will be entered. From what I read the -s option will allow the username/password to be passed. Help! I

Persistent ssh session to Cisco router

我只是一个虾纸丫 提交于 2019-11-30 07:23:16
I have search on this site and multiple other locations but I have been unable to resolve my problem of connecting and maintaining ssh session after one command. Below is my current code: #!/opt/local/bin/python import os import pexpect import paramiko import hashlib import StringIO while True: cisco_cmd = raw_input("Enter cisco router cmd:") ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('192.168.221.235', username='nuts', password='cisco', timeout = 30) stdin, stdout, stderr = ssh.exec_command(cisco_cmd) print stdout.read() ssh.close() if

Connecting to a VPN without installation of client software

有些话、适合烂在心里 提交于 2019-11-30 06:38:15
问题 I must sometimes write software to establish a socket with a particular server residing within a Cisco VPN. I simply write my software as if there were no VPN (making use of the standard sockets library). When it is time to run this program, I manually connect to the VPN using the client software installed on my computer, then run the program itself. However, it would be desirable to write the software to take advantage of a specialized socket library capable of communicating over the VPN

Paramiko session times out, but i need to execute a lot of commands

风流意气都作罢 提交于 2019-11-29 18:29:49
I'm working on a script (python 2.7) that is wotking with a remote device running Cisco IOS, so I need to execute a lot of commands through ssh. Few commands have no output and some of them have, and I want to recieve the output. It goes something like this: import paramiko ssh=paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(self._ip, port=22, username=username, password=password stdin, stdout, stderr = ssh.exec_command('command with no output') stdin, stdout, stderr = ssh.exec_command('command with no output') stdin, stdout, stderr = ssh.exec_command