cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6227
Views
6
Helpful
11
Replies

ssh error

baalagar
Level 1
Level 1

>>> from ydk.models.cisco_ios_xr import Cisco_IOS_XR_ip_static_cfg

>>> from ydk.providers import NetconfServiceProvider

>>> from ydk.services import CRUDService

>>> ncc = NetconfServiceProvider(address='172.27.121.52',username='root',password='lab',port=830)

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ydk/providers/netconf_provider.py", line 69, in __init__

    self._connect()

  File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ydk/providers/netconf_provider.py", line 75, in _connect

    self.sp_instance.connect(self.session_config)

  File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ydk/providers/_provider_plugin.py", line 296, in connect

    hostkey_verify=False)

  File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ncclient/manager.py", line 154, in connect

    return connect_ssh(*args, **kwds)

  File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ncclient/manager.py", line 119, in connect_ssh

    session.connect(*args, **kwds)

  File "/auto/cafy_dev/cafykit/exec/lib/python3.4/site-packages/ncclient/transport/ssh.py", line 383, in connect

    raise SSHError("Could not open socket to %s:%s" % (host, port))

ncclient.transport.errors.SSHError: Could not open socket to 172.27.121.52:830

11 Replies 11

baalagar
Level 1
Level 1

baalagar@exr-idt-ucs.cisco.com%>ssh root@172.27.121.52

Password:

RP/0/RP0/CPU0:ios#

manually i can login as well , but through netconfserviceprovider

Please try:

ssh -p 830 -s root@172.27.121.52<mailto:root@172.27.121.52> netconf

Cheers,

Einar

Hi Einar,

sorry for the dealy as non availability of setup

when i connect with port 830 i seen some prob .

without port

==========

[exec] baalagar@exr-idt-ucs.cisco.com%>ssh root@192.168.122.10 netconf

Password:

Thu May 11 09:43:45.384 UTC

<?xml version="1.0" encoding="UTF-8"?>

<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><capabilities><capability>urn:ietf:params:netconf:base:1.0</capability><capability>urn:ietf:params:netconf:capability:candidate:1.0</capability><capability>urn:ietf:params:netconf:capability:notification:1.0</capability></capabilities><session-id>285212672</session-id></hello>

]]>]]>

with Port

==========

[exec] baalagar@exr-idt-ucs.cisco.com%>ssh -p 830 root@192.168.122.10 netconf

ssh: connect to host 192.168.122.10 port 830: Connection refused

===========

if i pass port no at the end . it execute like below . however it is not taking me to router prompt . could you please help here this is the place i am struggling  long time

[exec] baalagar@exr-idt-ucs.cisco.com%>ssh  root@192.168.122.10 netconf -p 830

Password:

                                ^

% Invalid input detected at '^' marker.

Even i gave correct password

Balakrishnan,

The SSH command to connect should be:

ssh -p 830 -s root@192.168.122.10<mailto:root@192.168.122.10> netconf

The “-s” option is required to instruct ssh to open a channel to the netconf subsystem. Without the -s, ssh will attempt to open a console channel and invoke a command call ed “netconf”.

Cheers,

Einar

Hi Einar ,

Same error only i am hitting

[exec] baalagar@exr-idt-ucs.cisco.com%>ssh -p 830 -s root@192.168.122.10 netconf

ssh: connect to host 192.168.122.10 port 830: Connection refused

Were you able to resolve this issue ?

I am facing same issue wanted to know if I am missing something.

Hi,

Can you let me know the full error message which you are seeing?

Below is the error I get, but as pointed by Einar in another post my issue is probably to do with me using IoS version 15.2 with libydk which might not be supported. (https://communities.cisco.com/message/266997#266997).

$ python hello.py

Traceback (most recent call last):

  File "hello.py", line 13, in <module>

    provider = NetconfServiceProvider(address="10.138.77.179", port=830, username="test", password="test123", protocol="ssh")

RuntimeError: YCPPClientError: Could not connect to 10.138.77.179

mervinh16
Level 1
Level 1

Have you been able to solve this issue ? i am facing same issue. Cannot connect with port 830. Can you please help ?

 

Could you please be more specific and post your test environment, script and YDK log with enabled DEBUG level.

Were you able connect to the Netconf server from CLI? The command is:

$ ssh <uname>@<IP-address> -p 830 -v -s netconf

I also would suggest to open new discussian thread as YDK changed a lot since 2017 and some SSH issues have already been addressed.

Yan Gorelik
YDK Solutions

SimonJohansen
Level 1
Level 1

Good morning Baalagar!

 

Its a while, but I think I encountered something of a similar issue.

 

The way I solved it was to check if the router/switch (the device in question) had port 830 opened by the network department.
And in my case it did not. So I had to request the port opened by the network department.

It still would not work for me, and when I enquired the network dep. again they said it could be some firewall issues. They opened the internal firewall for that port and it now works for me.

 

Hope you get a good day,
Kind regards,
Simon Johansen

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: