-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to establish NETCONF sessions using SSH authentication in AWS ? #227
Comments
I tired the following.
I tried to debug the python script and it turns out that there is a problem with argument type which is private_key_path for the code above
How can I solve this issue? |
Can you ssh into this 1000v instance either on port 22 or port 830, without Critically, can you do it with the same Can you post that Also the official docs on making an ssh connection to this don't specifically mentioned port 830, so one could assume this may run on 22 by default in this AMI image (which I am assuming is this one from the marketplace?). So it may be worth trying to specify Obviously to test the raw connection via
|
Can you try with providing the |
Yes, I could. I think the default port is 22 to access to EC2 instance by simply using
here it is
Actually, I deployed this is one
Well, I just tried with 22 port and still the same issue.
Yes, it is like that to access to EC2 instance. |
Well, I did and it did not work.
|
Can you post your full script? You need all the arguments: |
Her
Here it is.
And I'm still getting the same error. |
Can you expand on this? IS this definately the public half of the same key. You can generate that from mykey.pem, with something like: If this is all correct, the only other thing I can think of is: does the private key have a passphrase? If that's the case perhaps Perhaps try generating your own (passphraseless) keypair, and upload the public section to amazon, then put the newly generated priv/pub pair into your script. EDIT: Actually just checked this on AWS EC2, it appears generating a keypair doesn't have the option to add a passphrase. The only way you could have a passphrase is if you generated the keys locally with a passphrase, then uploaded the public segment to AWS. So if you are actually using a private key created in the AWS EC2 console, then generating the public half with the command in this post shouldn't introduce any passphrase issue. |
I tried but still nothing, it did not work and same error as before. I generated the public key exactly as you told me, uploaded it to Amazon.
Well, while creating EC2 instance, the private key is generated automatically.
You mean, I generate a new private key right ? the problem is |
Sorry just to recap... Usually when connecting to something else with SSH keyauth, the client needs the There are two methods of creating a keypair on AWS:
I'm assuming you have followed method 1 in which case you wouldn't need to upload the public key to AWS, as you've already got Perhaps I'm degressing, I just wanted to be sure this wasn't a case of jumbled up keys. The error you refer to earlier:
Has line 2 of this been manually snipped? If so could you possibly post the full trackback alongside latest set of arguments? |
Can you please post the full error log from commandline? |
@vulcan25 @abhikeshav Here it is.
and the error log.
and @vulcan25 you are right. Something wrong maybe with the implementation itself. |
Thanks. Can you enable debug log and post the debug log? import logging
log = logging.getLogger('ydk')
log.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
formatter = logging.Formatter(("%(asctime)s - %(name)s - %(levelname)s - %(message)s"))
handler.setFormatter(formatter)
log.addHandler(handler) |
Same error after putting the logging lib, and nothing is shown.
|
EDIT: of course the following probably doesn't effect it because the cannot connect error is before any of this is called, but maybe something to be aware of for the next step. Stab in the dark here: What version of the bundle did you install? Going by the Quick Install guidance:
The AMI you linked uses XE according to the product description:
So you should have installed the compatible bundle:
This should also be reflected in your script though. The sample appears to use XR.
Maybe change this to:
(I've just changed Then update the system_time line:
(Again, I'm assuming the naming convention is identical between XE/XE versions).
|
Can you connect to your netconf server via command line (not using YDK)? |
@abhikeshav This AMI has console access on port 22, not 830. @khalilmebarkia confirmed earlier that he was able to access this via ssh. I was so curious to know about this I spun up one of these CSR 1000v instances myself to check. Connecting on port 22 definitely takes you to an IOS console, and is accessible using the |
Connecting to ssh terminal is different. Netconf is usually accessed on ssh via port 830. If he is able to connect to netconf on port 830 using the command line arguments above, then YDK should also work. See the RFC for details. |
It is so weird because I deleted the line of calling XE libraries and deleted the functions below, and still the same error.
|
I tried it and here what I wrote |
@abhikeshav I can also confirm this AMI image is defininately not serving anything on port 830 by default:
Are there any Cisco commands I could run at the terminal to launch netconf on 830? |
Please make sure you have netconf configured on your router. Try the below config
|
Apparently, These commands are incorrect.
as well as the others
|
Well, I decided to go for RESTCONF because of that auth problem, and in case of RESTCONF it goes over HTTP in which HTTP/HTTP port can be opened in AWS console. The simple sent request is the following:
Obviously, the auth is still in here, too. |
For IOS XE, you should need at least the following configuration:
The router configuration mentioned earlier is for IOS XR devices. Once the router is properly configured, make sure you can manually establish an SSH session on port 830 from your client and that the
You should receive a |
Did not work, I followed the configuration as you mentioned and when I tried to establish the SSH session, here what I got:
I have to enter a password, and since I'm using a private key to access the router. It is the same case when I don't pass the private key. |
I'm running docker Yang Development Kit for python ydk-py in my remote server Linux Ubuntu. I would like to Establish a connection using with the remote server and my AWS EC2 instance that runs CSR 1000v (SSH authentication)
I used to access my router using the following ssh command:
ssh -i "ssh-key.pem" [email protected]
Where e
c2-xx-xx-xx-xxx.us-west-2.compute.amazonaws.com
is the hostname,ec2-user
is the username and the ssh keyssh-key.pem
is for authentification.As the first step, I want to run the given example in here ydk-py samples
This is the creation of NETCONF session in the given example:
I have tried this
I have got this error
I kept going through all possibility where I found in the
README
file in here Read me the running a sample app is the following:Unless specified by the app, all basic apps take two command line arguments. An optional argument (-v | --verbose) to enable logging and a mandatory argument in URL format that describes the connection details to the networking device (ssh://user:password@device:port):
$ ./nc-read-xr-ip-ntp-oper-10-ydk.py ssh://admin:[email protected]
So in my case, it should be like this, right?
$ ./hello-ydk.py ssh://ec2-user:[email protected]
But still did not work, and here's what I got
The text was updated successfully, but these errors were encountered: