scrapli / scrapli_netconf

Fast and flexible Python 3.7+ netconf client specifically for network devices
https://scrapli.github.io/scrapli_netconf/
MIT License
93 stars 6 forks source link

b'ssh: connect to host <host-ip> port 830: Connection refused #81

Closed hardev20 closed 3 years ago

hardev20 commented 3 years ago

_Hi Carl,

Just tried basic connectivity to IOS-XR using NetconfDriver but I was unable to connect. I have attached the traces and debug logs. I have configured the following on the IOS-XR: ! ssh server v2 ssh server netconf vrf MGMT netconf-yang agent ssh ! Note that ssh server is associated with the VRF as management interface sits in this vrf. interface MgmtEth0/0/CPU0/0 vrf MGMT ipv4 address 192.168.0.122 255.255.255.0

Python script used: from scrapli_netconf.driver import NetconfDriver

import logging

logging.basicConfig(filename="scrapli_ncf.log", level=logging.DEBUG) logger = logging.getLogger("scrapli")

my_device = { "host": "192.168.0.122", "auth_username": "cisco", "auth_password": "cisco", "auth_strict_key": False, "port": 830 }

conn = NetconfDriver(**my_device) conn.open() response = conn.get_config(source="running") print(response.result)

scrapli_ncf.log

Appreciate if you could please help me with this issue. Many thanks NetconfErrorTraces.txt

carlmontanari commented 3 years ago

DEBUG:scrapli.channel:read: b'ssh: connect to host 192.168.0.122 port 830: Connection refused\n'

Your server has refused the connection. Why that is I don't know. You can try to ssh to it manually the same way scrapli does and troubleshoot it that way if you want: ssh 192.168.0.122 -p 830 -o ConnectTimeout=15 -o ServerAliveInterval=30 -l cisco -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -F /dev/null -tt -s netconf

I'm going to close this as it isn't a bug or feature work. Feel free to ask around in slack/discussions/discord for assistance or reopen this if you have some details that indicate this is a bug.