NETCONF

acronym

networking

Kept in this browser · My desk

Stands for: Network Configuration Protocol

The Internet Engineering Task Force (IETF) protocol of RFC (Request for Comments) 6241 for installing, changing and deleting the configuration of network devices through remote procedure calls encoded in XML (Extensible Markup Language), usually carried over SSH (Secure Shell) on port 830 (RFC 6242).

It is what the command line becomes when a program, not a person, is on the other end: requests and replies are structured, an error arrives as an rpc-error element instead of text to recognize, and a device with a candidate datastore lets a change be prepared and then committed. Where a platform offers it for the task, it replaces the screen scraping an Expect script does.

What it is, and what it is not. NETCONF (Network Configuration Protocol) is a protocol, not a data model. RFC (Request for Comments) 6241 of June 2011, edited by R. Enns of Juniper Networks, M. Bjorklund of Tail-f Systems, J. Schoenwaelder of Jacobs University and A. Bierman of Brocade, describes it in four layers: a secure transport at the bottom; a messages layer that frames remote procedure calls and notifications; an operations layer of base operations invoked as RPCs (remote procedure calls) with XML (Extensible Markup Language) parameters; and a content layer, the configuration and state data themselves, which the RFC leaves out of scope. That content is described in YANG, the modelling language written for NETCONF, so the protocol says how to read, change and lock a tree and YANG says what the tree contains. RFC 6241 is a Proposed Standard; it obsoleted the first specification, RFC 4741 of December 2006, also edited by Enns, and has itself been updated by RFC 7803 and RFC 8526.

Sessions and messages. NETCONF is connection-oriented: it needs a reliable, sequenced and persistent connection, sessions are long-lived, and anything a session holds, a lock above all, is released automatically when the connection closes. Each side opens by sending a hello message listing its capabilities, identified by URIs (uniform resource identifiers); the base protocol is urn:ietf:params:netconf:base:1.0 or base:1.1, and the version both sides support decides how the session behaves. A request is an rpc element with a mandatory message-id attribute, and the server echoes that value in its rpc-reply so that a client can match answers to questions. A failure comes back as an rpc-error element with a fixed error-tag, such as data-exists, data-missing, in-use or malformed-message, which a program can test instead of parsing prose. Asynchronous events were added in RFC 5277 of July 2008: a client sends create-subscription and the server pushes notifications from an event stream over the same session.

The nine base operations. get-config reads all or part of a configuration datastore; get reads the running configuration together with device state; edit-config changes a datastore; copy-config replaces one datastore with another; delete-config removes one; lock and unlock give a session exclusive write access; close-session ends the session politely and kill-session forces another one to end. The work is done by edit-config. Each element of the data sent can carry an operation attribute: merge, the default, combines it with what is there; replace overwrites only the configuration actually present in the request, unlike copy-config, which replaces the whole target; create fails with data-exists if the node is already there; delete fails with data-missing if it is not; and remove, added in RFC 6241, deletes if present and is silently ignored otherwise. A default-operation parameter sets merge, replace or none for the request, and an error-option decides what happens on a failure: stop-on-error is the default, continue-on-error carries on and reports, and rollback-on-error restores the datastore to its state before the request. The test-option value test-only, also new in RFC 6241, validates a change without applying it. Reads can be narrowed by subtree filtering, or by XPath (XML Path Language) expressions where the server advertises that capability.

Datastores, capabilities and the confirmed commit. The base protocol knows the running datastore; capabilities add the rest. writable-running lets a client edit running directly; candidate adds a scratch configuration that a commit operation copies into running, and because other sessions may share it, the RFC calls it prudent to lock the candidate before modifying it; startup adds a separate boot configuration; validate checks a configuration before use; url and xpath add file locations and XPath filters. The capability engineers learn to value is confirmed-commit. A commit sent with the confirmed parameter is applied but reverted automatically unless a confirming commit follows within the timeout, 600 seconds by default and adjustable with confirm-timeout; the change is also reverted if the session that sent it ends first, unless a persist token was supplied, and if the device reboots. RFC 6241 added persist, persist-id and cancel-commit. In practice this is the safety net for remote changes: an edit that cuts the management path undoes itself ten minutes later. RFC 8526 (March 2019) brought NETCONF into the Network Management Datastore Architecture (NMDA) with get-data and edit-data, which can address any datastore including the operational state datastore.

Transport and framing. Every implementation must support SSH (Secure Shell), as defined in RFC 6242 of June 2011, which obsoleted RFC 4742. The client invokes NETCONF as an SSH subsystem named netconf, and servers must by default offer that subsystem only on the port IANA (Internet Assigned Numbers Authority) assigned, TCP (Transmission Control Protocol) 830, so firewalls can tell management automation from interactive logins; the RFC's own example of opening a session is ssh -s server.example.org -p 830 netconf. Framing changed between versions. NETCONF 1.0 ended every message with the character sequence ]]>]]> on the assumption that it could not occur in well-formed XML, an assumption RFC 6242 admits was wrong, since it can legally appear in attributes, comments and processing instructions. When both peers advertise base:1.1, the session switches after the hello to chunked framing: each chunk is preceded by a line feed, a hash sign and its length in octets, and the message ends with a line feed, two hash signs and a line feed. A client that speaks only one framing hangs on a server that sends the other, which is one of the first things to check when a session opens and then nothing happens. RFC 7589 (June 2015) defines the alternative transport, TLS (Transport Layer Security) with mutual X.509 certificate authentication on TCP port 6513.

Who may do what. The NETCONF Access Control Model, RFC 8341 of March 2018, which obsoleted RFC 6536, decides which authenticated user may read, write or execute which part of the data tree. Its defaults are worth knowing because they surprise people: access control is enabled, reads and operation execution are permitted when no rule matches, and writes are denied when no rule matches, so a new account can often read the entire configuration but cannot change it until a rule allows it. close-session is always allowed, and an implementation may offer a recovery session that bypasses the rules for emergencies. Vendors add their own gate in front: Cisco IOS XE requires privilege level 15 for any NETCONF work.

On real devices. Cisco IOS XE enables the service with the global command netconf-yang, listens on SSH port 830 by default, and needs no netconf legacy if the older pre-standard implementation is enabled. Its candidate datastore is optional, enabled with netconf-yang feature candidate-datastore, and once enabled the running datastore is no longer writable through NETCONF; a NETCONF global lock also blocks changes from the CLI (command-line interface) and from SNMP (Simple Network Management Protocol), and show netconf-yang sessions lists who holds what. Junos enables it with set netconf ssh at the edit system services level; Juniper recommends the default port 830, because the device can then identify and filter NETCONF traffic, and a custom port configured there accepts only NETCONF over SSH. F5 documents the F5OS programmability interface, RESTCONF and NETCONF, as built on OpenConfig YANG models extended with F5 namespaces. In Python the usual client is ncclient, written by Shikar Bhushan and now maintained by Leonidas Poulopoulos and Einar Nilsen-Nygaard, with device handlers for Juniper, several Cisco platforms (among them Nexus, IOS XR and IOS XE), Huawei, H3C and Alcatel-Lucent; its 0.7.1 release is dated 15 March 2026.

Neighbours and pitfalls. RESTCONF carries the same YANG data over HTTPS (Hypertext Transfer Protocol Secure) and implements a subset of NETCONF without locks or a choice of datastore, so NETCONF remains the tool for coordinated multi-step changes; SNMP still serves monitoring better than configuration; and CLI automation with Expect works everywhere but has to recognize text that was written for people. The recurring mistakes are predictable. Assuming the candidate datastore exists, instead of reading the capabilities in the hello, fails on devices that offer only writable-running, and the reverse fails on Cisco with candidate enabled. Forgetting that merge is the default leaves old entries in place when replace was meant. A script that crashes while holding a lock blocks everyone else until the server notices the dead connection or an operator sends kill-session. And the same interface can exist in a native model, a model of the IETF (Internet Engineering Task Force) and an OpenConfig model on one device, with different paths and different behaviour, so the model list the device itself reports is the only reliable starting point.

Also known as: netconf, rfc 6241, netconf over ssh

Sources

← Back to N Back to the glossary