Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Junos PyEZ Developer Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

Troubleshoot Junos PyEZ Connection Errors

date_range 18-Aug-22

Problem

Description

When using Junos PyEZ to manage Junos devices, the code generates an error that the connection was refused. For example:

content_copy zoom_out_map
jnpr.junos.exception.ConnectRefusedError

Cause

NETCONF is not enabled on the device or the number of connections exceeds the limit.

The most likely cause for a refused connection error is that NETCONF over SSH is not enabled on the Junos device. To quickly test whether NETCONF is enabled, verify that the user account can successfully start a NETCONF session with the device.

content_copy zoom_out_map
[user@server]$ ssh user@R1.example.com -p 830 -s netconf

Solution

If NETCONF is not enabled on the Junos device, enable NETCONF.

content_copy zoom_out_map
[edit]
user@R1# set system services netconf ssh
user@R1# commit

If the number of NETCONF sessions exceeds the limit, increase the maximum number of permitted sessions up to 250. The default is 75.

content_copy zoom_out_map
[edit]
user@R1# set system services netconf ssh connection-limit limit
user@R1# commit
footer-navigation