Skip to main content
CCNA Automation (200-901 CCNAAUTO) intermediate Free with email

NETCONF and YANG Explained: Operations, Port 830 and Cisco IOS XE Examples (Free PDF)

Reviewed 2026-10-29

Direct answer
NETCONF (Network Configuration Protocol) is an IETF protocol that configures network devices with XML remote procedure calls, normally over SSH on TCP port 830. YANG is the data modelling language that describes what NETCONF can read and change. This free 39-slide PDF explains both, and the page adds Cisco IOS XE commands and a Python example.

What Is NETCONF?

NETCONF (Network Configuration Protocol) is an IETF protocol that installs, changes and deletes the configuration of network devices. RFC 6241 defines it. It sends XML-encoded remote procedure calls (RPCs), normally over SSH on TCP port 830, so a script gets structured data back instead of CLI text to scrape.

Three things set it apart from a CLI script:

  • Structured replies. Every answer is XML you can parse, not text you have to pattern-match.
  • Config and state are separate. <get-config> returns configuration. <get> returns configuration plus operational state.
  • Safer changes. A device can lock a datastore, validate an edit and undo it if part of it fails.

If you still work in the CLI, our Cisco commands cheat sheet covers the commands NETCONF replaces.

What Is NETCONF Used For?

NETCONF is used to push configuration, read device state, and back up or restore configs from code. Its design comes from the operator wish list in RFC 3535, the 2003 report on the IAB’s 2002 network management workshop. Four of those wishes map straight onto NETCONF features:

Operator need (RFC 3535)NETCONF feature
Fetch configuration separately from state<get-config> and <get>
Configuration transactionsCandidate datastore with <commit>, or rollback-on-error
Dump and restore configurations<get-config> and <copy-config>
Check consistency before applying<validate>

What Is a YANG Data Model?

YANG (“Yet Another Next Generation”) is the language that describes what a device exposes: configuration, state data, RPCs and notifications. RFC 7950 defines YANG 1.1. It was built for NETCONF, and RESTCONF uses it too. A YANG module is the schema. Vendors ship modules such as ietf-interfaces and Cisco-IOS-XE-native, and your script reads them to know what it can ask for.

A module is built from four statements:

StatementJobExample
moduleNames and versions the schemaietf-interfaces
containerGroups related nodesinterfaces
listRepeats entries, each with a keyinterface (key: name)
leafHolds one valueenabled (boolean)

This snippet is adapted from the examples in RFC 7950 section 4.2.2:

container system {
  leaf host-name {
    type string;
    description "Hostname for this system.";
  }
}

In XML that becomes <system><host-name>my.example.com</host-name></system>. To see a real model, trim the tree of ietf-interfaces (RFC 8343):

module: ietf-interfaces
  +--rw interfaces
     +--rw interface* [name]
        +--rw name                        string
        +--rw description?                string
        +--rw type                        identityref
        +--rw enabled?                    boolean
        +--ro admin-status                enumeration {if-mib}?
        +--ro oper-status                 enumeration

rw is configuration you can change. ro is read-only state. * marks a list, ? an optional node, and [name] the key. Browse more modules in the YANG Catalog.

NETCONF vs YANG: What’s the Difference?

NETCONF is the protocol that moves data. YANG is the model that says what the data looks like. You can’t use one without the other for model-driven automation.

NETCONFYANG
What it isManagement protocolData modelling language
JobReads and changes device dataDefines which data exists and its type
Defined inRFC 6241RFC 7950 (YANG 1.1)
Format on the wireXML RPCsText modules, read by tools
Also used byNot applicableRESTCONF
NETCONF vs YANG: YANG container and leaf describe the data, NETCONF get-config and edit-config move it
YANG describes the data and NETCONF moves it. RESTCONF reads the same YANG models.

Does NETCONF Use Port 830?

Yes. IANA assigned TCP port 830 as the default for NETCONF over SSH (RFC 6242), and Cisco’s IOS XE guide says the port is configurable. NETCONF over TLS is a separate option (RFC 7589) and uses TCP 6513. You’ll also see port 830 in our common ports cheat sheet.

The SSH session carries one more detail. NETCONF 1.0 ends every message with ]]>]]>. NETCONF 1.1 uses chunked framing instead. To open a raw session and see the server’s hello, run:

ssh -s [email protected] -p 830 netconf

NETCONF Operations: get, get-config, edit-config, lock and commit

Every NETCONF request is an <rpc> with a message-id. The device answers with <ok/> or an <rpc-error>. These are the operations you’ll meet most:

OperationWhat it doesNeeds a capability?
<get>Returns running config and device stateNo
<get-config>Returns all or part of one datastoreNo
<edit-config>Loads all or part of a config into a datastoreNo
<copy-config>Replaces one datastore with anotherNo
<delete-config>Deletes a datastore (not running)No
<lock> / <unlock>Stops other sessions editing a datastoreNo
<close-session> / <kill-session>Ends your session, or forces another to endNo
<commit>Copies candidate into running:candidate
<discard-changes>Throws away the candidate edits:candidate
<validate>Checks a config without applying it:validate
<create-subscription>Streams event notifications (RFC 5277):notification

<edit-config> stops at the first error by default (stop-on-error). If the device advertises :rollback-on-error, you can ask it to undo the whole edit instead. The base operations are in RFC 6241 sections 7.1 to 7.9.

NETCONF Datastores: Running, Candidate and Startup

A datastore is a complete configuration the device can hold. NETCONF names three:

DatastoreCapabilityRole
runningAlways presentThe configuration in use now
candidate:candidateA scratch copy you edit, then <commit>
startup:startupThe configuration loaded at boot

With a candidate, you can stage several edits and apply them together. A confirmed commit adds a safety net: if you don’t confirm within the timeout, the device rolls back. RFC 6241 sets the default at 600 seconds. Newer devices follow the Network Management Datastore Architecture (RFC 8342), which RFC 8526 adds to NETCONF with <get-data> and <edit-data>.

On Cisco IOS XE the candidate datastore has its own switch. Cisco’s 17.3 programmability guide lists netconf-yang feature candidate-datastore to enable it, and show netconf-yang datastores shows what your device offers.

Go deeper

Reading about NETCONF gets you the theory.

Run every operation above in the CCNA Automation Workbook: 60+ labs on IOS XE in the free DevNet Sandbox.

See the CCNA Automation Workbook →

NETCONF Example: Hello, get-config and edit-config

Every session opens with a hello exchange. The server sends its capabilities, and the client answers with its own:

<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <capabilities>
    <capability>urn:ietf:params:netconf:base:1.0</capability>
  </capabilities>
</hello>]]>]]>

Then read the interface list with a subtree filter:

<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <get-config>
    <source><running/></source>
    <filter type="subtree">
      <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"/>
    </filter>
  </get-config>
</rpc>]]>]]>

The reply carries the matching <data> tree. To change something, send <edit-config>. This one sets the hostname through the Cisco-IOS-XE-native module:

<rpc message-id="102" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target><running/></target>
    <config>
      <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
        <hostname>R1</hostname>
      </native>
    </config>
  </edit-config>
</rpc>]]>]]>

A good edit returns <ok/>. Try it on a lab router, never on production.

How to Enable NETCONF on Cisco IOS XE

NETCONF-YANG is supported from IOS XE 16.3.1, according to Cisco’s NETCONF/YANG configuration guide. You need SSH working and a local user at privilege 15. If AAA is on, Cisco also requires aaa authorization exec default local for NETCONF over SSH and for edit-config. Then turn it on:

R1(config)# netconf-yang

Give it up to 90 seconds to start. Then check it:

R1# show platform software yang-management process
R1# show netconf-yang datastores
R1# show netconf-yang sessions

In the process list, ncsshd (the NETCONF SSH daemon) should read Running. show netconf-yang sessions lists your open sessions, so you’ll see yours after you connect.

Three steps to enable NETCONF on Cisco IOS XE: netconf-yang, show platform software yang-management process, ssh -s on port 830
Run netconf-yang, check that the SSH daemon is running, then open a raw NETCONF session on port 830.

Want a free device to try it on? Cisco’s DevNet Sandbox offers IOS XE labs.

NETCONF Not Connecting? Four Checks

SymptomCheck
Nothing answers on port 830Run show platform software yang-management process. ncsshd must read Running, and the first start can take 90 seconds
Login or edit-config fails with AAA onAdd aaa authorization exec default local and use a privilege 15 user
SSH host key error in a scriptSet hostkey_verify=False in a lab only. On real gear, add the key to known_hosts
edit_config is rejectedCheck the target. ncclient defaults to candidate, which IOS XE may not offer

NETCONF With Python: ncclient Example

ncclient is a Python library for NETCONF clients. Install it with pip install ncclient, then connect on port 830:

from ncclient import manager

with manager.connect(
    host="192.0.2.10", port=830,
    username="cisco1", password="cisco1",
    hostkey_verify=False,  # lab only: skips SSH host key checks
) as m:
    flt = ("subtree",
           '<native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native"/>')
    print(m.get_config(source="running", filter=flt).data_xml)

    cfg = """<config>
      <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
        <hostname>R1</hostname>
      </native>
    </config>"""
    m.edit_config(target="running", config=cfg)

Watch the target. In ncclient 0.6.15, edit_config defaults to candidate, so pass target="running" unless you’ve enabled the candidate datastore.

Netmiko is the other common choice. It sends CLI text over SSH, while ncclient exchanges structured XML. Our free BGP multi-AS lab PDF automates seven routers with Netmiko, and the Python for network engineers guide shows where each fits. Ansible can drive NETCONF too, through its netconf_config module (see our Ansible commands cheat sheet, and our Terraform vs Ansible guide for how the two tools differ). Terraform’s IOS XE provider also manages devices over NETCONF on port 830, according to Cisco’s Network as Code docs, so the same netconf-yang command applies.

Reading about get_config is the easy part. The CCNA Automation Workbook has you build NETCONF sessions, filter the reply and push YANG-based config templates on IOS XE devices in the DevNet Sandbox.

NETCONF vs RESTCONF: Which One Should You Use?

Both protocols read the same YANG models. They differ in how you reach them. RFC 8040 describes RESTCONF as an HTTP-based protocol for accessing data defined in YANG, using NETCONF’s datastore concepts.

NETCONFRESTCONF
TransportSSH (TCP 830)HTTPS (TLS is required)
EncodingXMLXML or JSON
OperationsRPCs such as <get-config>HTTP methods
Edits<edit-config> plus <commit>POST, PUT, PATCH, DELETE
Python toolncclientrequests

RFC 8040 maps GET to <get-config> or <get>, POST to a create, PUT to a create or replace, and DELETE to a delete. A rule of thumb: reach for NETCONF when a change needs locks, validation and a commit. Reach for RESTCONF when a script or web tool only needs to read and write a few values.

NETCONF vs RESTCONF: NETCONF uses SSH on port 830 with XML, RESTCONF uses HTTPS with XML or JSON
NETCONF runs over SSH with XML. RESTCONF runs over HTTPS and accepts XML or JSON.

NETCONF vs SNMP

SNMP uses MIBs and sends messages over UDP. NETCONF uses YANG and sends XML over SSH on TCP. RFC 3535, the report on the 2002 operators’ workshop that led to NETCONF, says SNMP “works reasonably well for device monitoring”. NETCONF fills the gap SNMP leaves: reliable configuration changes. SNMP isn’t going away, though. Objective 5.4 of the new CCNA 200-301 v2.0 blueprint still asks you to describe its function, so know both. See what changed in CCNA v2.0.

NETCONF and YANG on the CCNA Automation Exam

Cisco renamed the DevNet Associate to CCNA Automation (exam 200-901 CCNAAUTO v1.1), and every DevNet Associate holder was migrated on 2026-02-03. The exam topics PDF covers this topic in five objectives:

  • 3.8: Apply concepts of model driven programmability (YANG, RESTCONF and NETCONF) in a Cisco environment.
  • 5.1: Describe the value of model driven programmability for infrastructure automation.
  • 5.10: Interpret the results of a RESTCONF or NETCONF query.
  • 5.11: Interpret basic YANG models.
  • 6.7: Recognize common protocol port values, including NETCONF.

So port 830 and the tree format above are exam material. Every lab in this 200-901 lab workbook maps to the v1.1 blueprint. The same blueprint covers Git (1.8) and automation tools such as Ansible and Terraform (5.6). Brush up with our Git commands and Terraform commands cheat sheets, and read the CCNA 200-901 Python automation guide.

What’s Inside the Free NETCONF and YANG PDF?

The PDF is a 39-slide deck. It covers:

  • Why NETCONF exists: the operator requirements in RFC 3535
  • NETCONF and YANG overviews, and a comparison with SNMP
  • Protocol layers, with an example RPC message
  • Operations: <get>, <get-config>, <edit-config>, <lock>, <commit> and confirmed commits
  • Content layers, general behaviour and notifications

Its router examples come from a service-provider operating system, so the syntax differs from Cisco IOS XE. Use the IOS XE commands on this page for Cisco labs.

Free NETCONF and YANG PDF with 39 slides compared with the CCNA Automation Workbook with 60+ labs and 720+ pages
Read the 39-slide PDF first, then run NETCONF and YANG labs in the CCNA Automation Workbook.

The PDF stops at theory and reference. For hands-on practice at the next level, the CCIE Enterprise Workbook includes a model-driven automation lab set covering gNMI, YANG models, NETCONF and streaming telemetry.

Frequently asked questions

Does NETCONF use port 830?
Yes. NETCONF over SSH uses TCP port 830, the default that IANA assigned in RFC 6242. Cisco's IOS XE guide lists SSH port 830 as the default and says you can change it. NETCONF over TLS is a separate transport on TCP port 6513 (RFC 7589). To test the SSH port, run ssh -s user@host -p 830 netconf.
What is NETCONF used for?
NETCONF is used to configure network devices from code, read their configuration and state, and back up or restore configs. It sends XML-encoded remote procedure calls, usually over SSH. Locks, validation, the candidate datastore with commit, and rollback-on-error make multi-step changes safer than scraping a CLI. RFC 3535 lists the operator needs behind it.
What is the difference between NETCONF and YANG?
NETCONF is the protocol that moves data to and from a device. YANG is the data modelling language that defines what that data looks like, using containers, lists, leaves and types. RFC 6241 defines NETCONF and RFC 7950 defines YANG 1.1. RESTCONF reads YANG models too, so one model can serve both protocols.
Which two options are common NETCONF operations?
The two you'll see most are , which reads a configuration datastore, and , which changes one. Others include (configuration plus state), , , and . With the candidate capability you also get and .
What is the difference between RESTCONF and a REST API?
RESTCONF is an HTTP-based protocol for accessing data defined in YANG, using NETCONF's datastore concepts (RFC 8040). A generic REST API defines its own URLs and data. RESTCONF's resources come from YANG modules, and its HTTP methods map to NETCONF operations: GET to get-config or get, POST to create, DELETE to delete.
Which two protocols use YANG data models?
NETCONF and RESTCONF. YANG was designed to model data for NETCONF, and RFC 7950 notes that it is also used with RESTCONF. RFC 8040 describes RESTCONF as a way to access data defined in YANG over HTTP.
How do you use NETCONF over SSH?
Enable it on the device first, for example netconf-yang on Cisco IOS XE. Then connect with ssh -s user@host -p 830 netconf. The server answers with a hello message listing its capabilities. Send your own hello ending in ]]>]]>, then send requests. In Python, ncclient's manager.connect() does the same on port 830.
Is NETCONF on the CCNA Automation exam?
Yes. The 200-901 CCNAAUTO v1.1 blueprint covers it in objectives 3.8 (apply YANG, RESTCONF and NETCONF concepts), 5.10 (interpret a RESTCONF or NETCONF query) and 5.11 (interpret basic YANG models). Objective 6.7 lists NETCONF among the protocol port values to recognize, and 5.1 covers model-driven programmability.

Questions about this PDF

No questions yet. Ask the first one.

Ask a question

Your email address won't be published. We review every question before it appears. How we handle your data. Required fields are marked

Reviewed by

CCDE/CCIE

How to cite this resource

SMEnode Labs (2026). NETCONF and YANG Explained: Operations, Port 830 and Cisco IOS XE Examples (Free PDF). SMEnode Labs. https://smenode-labs.com/free-pdf/networking/netconf-and-yang/

APA

SMEnode Labs. (2026). NETCONF and YANG Explained: Operations, Port 830 and Cisco IOS XE Examples (Free PDF). SMEnode Labs. https://smenode-labs.com/free-pdf/networking/netconf-and-yang/

BibTeX

@misc{smenodelabs2026,
  title = {NETCONF and YANG Explained: Operations, Port 830 and Cisco IOS XE Examples (Free PDF)},
  author = {{SMEnode Labs}},
  year = {2026},
  url = {https://smenode-labs.com/free-pdf/networking/netconf-and-yang/},
  note = {SMEnode Labs}
}