Network Configuration Protocol - Cisco
Network Configuration Protocol - Cisco
The Network Configuration Protocol (NETCONF) defines a simple mechanism through which a network
device can be managed, configuration data information can be retrieved, and new configuration data can
be uploaded and manipulated. NETCONF uses Extensible Markup Language (XML)-based data
encoding for the configuration data and protocol messages.
You can use the NETCONF over SSHv2 feature to perform network configurations via the
Cisco command-line interface (CLI) over an encrypted transport. The NETCONF Network Manager,
which is the NETCONF client, must use Secure Shell Version 2 (SSHv2) as the network transport to the
NETCONF server. Multiple NETCONF clients can connect to the NETCONF server.
You can use the NETCONF over BEEP feature to send notifications of any configuration change over
NETCONF. A notification is an event indicating that a configuration change has happened. The change
can be a new configuration, deleted configuration, or changed configuration. The notifications are sent
at the end of a successful configuration operation as one message showing the set of changes, rather than
individual messages for each line in the configuration that is changed.
Blocks Extensible Exchange Protocol (BEEP) can use the Simple Authentication and Security Layer
(SASL) profile to provide simple and direct mapping to the existing security model. Alternatively,
NETCONF over BEEP can use the transport layer security (TLS) to provide a strong encryption
mechanism with either server authentication or server and client-side authentication.
Americas Headquarters:
Cisco Systems, Inc., 170 West Tasman Drive, San Jose, CA 95134-1706 USA
Contents
Glossary, page 32
NETCONF over SSHv2 requires that a vty line be available for each NETCONF session as specified
in the netconf max-session command.
A vty line must be available for each NETCONF session as specified by the netconf max-session
command.
You must be running a crypto image in order to configure BEEP using TLS.
If authentication, authorization, and accounting (AAA) is configured, the AAA service is used as if a
user had established an SSH session directly to the device. Using the existing security configuration
makes the transition to NETCONF almost seamless. Once the client has been successfully authenticated,
the client invokes the SSH connection protocol and the SSH session is established. After the SSH session
is established, the user or application invokes NETCONF as an SSH subsystem called netconf.
Figure 1
SSHv2 runs on top of a reliable transport layer and provides strong authentication and encryption
capabilities. SSHv2 provides a means to securely access and securely execute commands on another
computer over a network.
NETCONF does not support SSH version 1. The configuration for the SSH Version 2 server is similar
to the configuration for SSH version 1. Use the ip ssh version command to specify which version of SSH
that you want to configure. If you do not configure this command, SSH by default runs in compatibility
mode; that is, both SSH version 1 and SSH version 2 connections are honored.
Note
SSH version 1 is a protocol that has never been defined in a standard. If you do not want your router to
fall back to the undefined protocol (version 1), you should use the ip ssh version command and specify
version 2.
Use the ip ssh rsa keypair-name command to enable an SSH connection using Rivest, Shamir, and
Adelman (RSA) keys that you have configured. If you configure the ip ssh rsa keypair-name command
with a key-pair name, SSH is enabled if the key pair exists, or SSH will be enabled if the key pair is
generated later. If you use this command to enable SSH, you do not need to configure a hostname and a
domain name.
The SASL is an Internet standard method for adding authentication support to connection-based
protocols. SASL can be used between a security appliance and an Lightweight Directory Access
Protocol (LDAP) server to secure user authentication.
Transport Layer Security
The TLS is an application-level protocol that provides for secure communication between a client and
server by allowing mutual authentication, the use of hash for integrity, and encryption for privacy. TLS
relies upon certificates, public keys, and private keys.
Certificates are similar to digital ID cards. They prove the identity of the server to clients. Each
certificate includes the name of the authority that issued it, the name of the entity to which the certificate
was issued, the entitys public key, and time stamps that indicate the certificates expiration date.
Public and private keys are the ciphers used to encrypt and decrypt information. Although the public key
is shared, the private key is never given out. Each public-private key pair works together. Data encrypted
with the public key can be decrypted only with the private key.
Access Lists
You can optionally configure access lists for use with NETCONF over SSHv2 sessions. An access list
is a sequential collection of permit and deny conditions that apply to IP addresses. The Cisco IOS
software tests addresses against the conditions in an access list one by one. The first match determines
whether the software accepts or rejects the address. Because the software stops testing conditions after
the first match, the order of the conditions is critical. If no conditions match, the software rejects the
address.
The two main tasks involved in using access lists are as follows:
1.
Creating an access list by specifying an access list number or name and access conditions.
2.
For more information about configuring access lists, see IP Access List Overview and Creating an IP
Access List and Applying It to an Interface modules in the Cisco IOS Security Configuration Guide:
Securing the Data Plane.
NETCONF Notifications
NETCONF sends notifications of any configuration change over NETCONF. A notification is an event
indicating that a configuration change has occurred. The change can be a new configuration, deleted
configuration, or changed configuration. The notifications are sent at the end of a successful
configuration operation as one message that shows the set of changes rather than showing individual
messages for each line that is changed in the configuration.
Enabling SSH Version 2 Using a Hostname and Domain Name, page 5 (required)
SUMMARY STEPS
1.
enable
2.
configure terminal
3.
hostname hostname
4.
ip domain-name name
5.
6.
7.
ip ssh version 2
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Router> enable
Step 2
configure terminal
Example:
Router# configure terminal
Step 3
hostname hostname
Example:
Router(config)# hostname host1
Step 4
ip domain-name name
Example:
Router(config)# ip domain-name domain1.com
Step 5
Example:
Router(config)# crypto key generate rsa
Step 6
Example:
Router(config)# ip ssh timeout 120
Step 7
ip ssh version 2
Example:
Router(config)# ip ssh version 2
SUMMARY STEPS
1.
enable
2.
configure terminal
3.
4.
5.
6.
ip ssh version 2
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Router> enable
Step 2
configure terminal
Example:
Router# configure terminal
Step 3
Example:
Router(config)# ip ssh rsa keypair-name sshkeys
Step 4
Step 5
Example:
Note
Example:
Router(config)# ip ssh timeout 120
Step 6
ip ssh version 2
Example:
Router(config)# ip ssh version 2
SUMMARY STEPS
1.
ssh [-v {1 | 2}] [-c {3des | aes128-cbc | aes192-cbc | aes256-cbc}] [-m {hmac-md5 | hmac-md5-96
| hmac-sha1 | hmac-sha1-96}] [l userid] [-o numberofpasswordprompts n] [-p port-num]
{ip-addr | hostname} [command]
DETAILED STEPS
Step 1
Command or Action
Purpose
Example:
Router# ssh -v 2 -c aes256-cbc -m hmac-sha1-96
-l user2 10.76.82.24
or
Router# ssh -v 2 -c aes256-cbc -m hmac-sha1-96
[email protected]
Troubleshooting Tips
The ip ssh version command can be used for troubleshooting your SSH configuration. By changing
versions, you can determine which SSH version has a problem.
What to Do Next
For more information about the ssh command, see the Cisco IOS Security Command Reference.
SUMMARY STEPS
1.
enable
2.
show ssh
3.
show ip ssh
Note
You can use the following show commands in user EXEC or privileged EXEC mode.
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Router> enable
Step 2
show ssh
Example:
Router# show ssh
Step 3
show ip ssh
Example:
Router# show ip ssh
Examples
The following output from the show ssh command displays status about SSH version 2 connections.
Router# show ssh
Connection Version Mode Encryption Hmac
Username
1
2.0
IN
aes128-cbc hmac-md5
1
2.0
OUT aes128-cbc hmac-md5
%No SSHv1 server connections running.
State
Session started
Session started
lab
lab
The following output from the show ip ssh command displays the version of SSH that is enabled, the
authentication timeout values, and the number of authentication retries.
Router# show ip ssh
SSH Enabled - version 2.0
Authentication timeout: 120 secs; Authentication retries: 3
Prerequisites
SSHv2 must be enabled.
Note
There must be at least as many vty lines configured as there are concurrent NETCONF sessions.
Restrictions
1.
enable
2.
configure terminal
3.
4.
5.
6.
SUMMARY STEPS
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Router> enable
Step 2
configure terminal
Example:
Router# configure terminal
Step 3
Example:
Step 4
Example:
Router(config)# netconf lock-time 60
10
Step 5
Command or Action
Purpose
Example:
Step 6
Example:
SUMMARY STEPS
1.
enable
2.
configure terminal
3.
4.
mechanism digest-md5
5.
11
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Router> enable
Step 2
configure terminal
Example:
Router# configure terminal
Step 3
Example:
Router(config)# sasl profile beep
Step 4
mechanism digest-md5
Example:
Router(config-SASL-profile)# mechanism
digest-md5
Step 5
Example:
Router(config-SASL-profile)# server user1
password password1
Prerequisites
There must be at least as many vty lines configured as there are concurrent NETCONF sessions.
If you configure NETCONF over BEEP using SASL, you must first configure an SASL profile.
1.
enable
2.
configure terminal
3.
Restrictions
SUMMARY STEPS
12
4.
5.
6.
subject-name name
7.
8.
exit
9.
[encrypt trustpoint]
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Router> enable
Step 2
configure terminal
Example:
Router# configure terminal
Step 3
Example:
Step 4
Example:
Router(config)# crypto pki trustpoint
my_trustpoint
Step 5
Example:
Router(ca-trustpoint)# enrollment url
http://10.2.3.3:80
13
Step 6
Command or Action
Purpose
subject-name name
Example:
Router(ca-trustpoint)# subject-name
CN=dns_name_of_host.com
Step 7
Example:
Router(ca-trustpoint)# revocation-check none
Step 8
exit
Example:
Router(ca-trustpoint)# exit
Step 9
Example:
Router(config)# crypto pki authenticate
my_trustpoint
Step 10
Example:
Router(config)# crypto pki enroll my_trustpoint
Step 11
Example:
Step 12
Example:
Step 13
Example:
Router(config)# netconf max-sessions 16
14
Step 14
Command or Action
Purpose
Example:
Router(config)# netconf beep initiator host1 23
user user1 password password1 encrypt 23
reconnect-time 60
Step 15
Example:
Router(config)# netconf beep listener 26 acl
101 sasl profile1 encrypt 25
Use the following CLI string to configure the NETCONF Network Manager application to invoke
NETCONF as an SSH subsystem:
Unix Side: ssh-2 -s [email protected] netconf
Step 2
As soon as the NETCONF session is established, indicate the server capabilities by sending an XML
document containing a <hello>:
<?xml version="1.0" encoding="UTF-8"?>
<hello>
<capabilities>
<capability>
urn:ietf:params:xml:ns:netconf:base:1.0
</capability>
<capability>
urn:ietf:params:ns:netconf:capability:startup:1.0
</capability>
</capabilities>
<session-id>4<session-id>
</hello>]]>]]>
Note
Although the example shows the server sending a <hello> message followed by the clients message,
both sides send the message as soon as the NETCONF subsystem is initialized, perhaps simultaneously.
15
Tip
All NETCONF requests must end with ]]>]]> which denotes an end to the request. Until the ]]>]]>
sequence is sent, the device will not process the request.
See Configuring NETCONF over SSHv2: Example section on page 23 for a specific example.
Step 3
Use the following XML string to enable the NETCONF network manager application to send and receive
NETCONF notifications:
<?xml version="1.0" encoding="UTF-8" ?>
<rpc message-id="9.0"><notification-on/>
</rpc>]]>]]>
Step 4
Use the following XML string to stop the NETCONF network manager application from sending or
receiving NETCONF notifications:
<?xml version="1.0" encoding="UTF-8" ?>
<rpc message-id="9.13"><notification-off/>
</rpc>]]>]]>
16
</xs:complexContent>
</xs:complexType>
</xs:element>
<!--These elements are used in the filter of a <get> to specify operational data to
return.-->
<xs:element name="oper-data-format-text-block">
<xs:complexType>
<xs:sequence>
<xs:element name="show" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="oper-data-format-xml">
<xs:complexType>
<xs:sequence>
<xs:any/>
</xs:sequence>
</xs:complexType>
</xs:element>
<!--When confing-format-text format is specified, the following describes the content
of the data element in the response-->
<xs:element name="cli-config-data">
<xs:complexType>
<xs:sequence>
<xs:element name="cmd" type="xs:string" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Content is a command. May be multiple
lines.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="cli-config-data-block" type="xs:string">
<xs:annotation>
<xs:documentation>The content of this element is the device configuration as it
would be sent to a terminal session. It contains embedded newline characters that must be
preserved as they represent the boundaries between the individual command
lines</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="text-filter-spec">
<xs:annotation>
<xs:documentation>If this element is included in the config-format-text element,
then the content is treated as if the string was appended to the "show running-config"
command line.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="cli-oper-data-block">
<xs:complexType>
<xs:annotation>
<xs:documentation> This element is included in the response to get operation.
Content of this element is the operational data in text format.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="show"/>
<xs:element name="response"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
17
</xs:complexType>
</xs:element>
<xs:schema>
18
The following are schemas for the NETCONF <get-config> function in CLI and CLI-block format.
NETCONF <get-config> Request: CLI Format
<?xml version="1.0" encoding=\"UTF-8\"?>
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get-config>
<source>
<running/>
</source>
<filter>
<config-format-text-cmd>
<text-filter-spec> | inc interface </text-filter-spec>
</config-format-text-cmd>
</filter>
</get-config>
</rpc>]]>]]>
19
NETCONF uses the <get> function to retrieve configuration and device-state information. The
NETCONF <get> format is the equivalent of a Cisco IOS show command. The <filter> parameter
specifies the portion of the system configuration and device-state data to retrieve. If the <filter>
parameter is empty, nothing is returned.
The following are schemas for the <get> function in CLI and CLI-block format.
NETCONF <get> Request: CLI Format
<?xml version="1.0" encoding=\"UTF-8\"?>
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get>
<filter>
<config-format-text-cmd>
<text-filter-spec> | include interface </text-filter-spec>
</config-format-text-cmd>
<oper-data-format-text-block>
<show>interfaces</show>
<show>arp</show>
</oper-data-format-text-block>
</filter>
</get>
</rpc>]]>]]>
20
</filter>
</get>
</rpc>]]>]]>
Restrictions
1.
enable
2.
3.
4.
SUMMARY STEPS
21
DETAILED STEPS
Step 1
Command or Action
Purpose
enable
Example:
Router> enable
Step 2
Example:
Router# show netconf counters
Step 3
Example:
Router# debug netconf error
Step 4
Example:
Router# clear netconf sessions
22
The following example shows how to get the configuration for loopback interface 113.
Step 1
Step 2
23
</config-format-text-cmd>
</filter>
</get-config>
</rpc>]]>]]>
As soon as the NETCONF session is established, indicate the server capabilities by sending an XML
document containing a <hello>:
<?xml version="1.0" encoding="UTF-8"?>
<hello>
<capabilities>
<capability>
urn:ietf:params:xml:ns:netconf:base:1.0
24
</capability>
<capability>
urn:ietf:params:ns:netconf:capability:startup:1.0
</capability>
</capabilities>
<session-id>4<session-id>
</hello>]]>]]>
Use the following XML string to enable the NETCONF network manager application to send and receive
NETCONF notifications:
<?xml version="1.0" encoding="UTF-8" ?>
<rpc message-id="9.0"><notification-on/>
</rpc>]]>]]>
Use the following XML string to stop the NETCONF network manager application from sending or
receiving NETCONF notifications:
<?xml version="1.0" encoding="UTF-8" ?>
<rpc message-id="9.13"><notification-off/>
</rpc>]]>]]>
The following is sample output from the show netconf session command:
Router# show netconf session
(Current | max) sessions:
Operations received: 100
Connection Requests: 5
ACL dropped : 30
Notifications Sent: 20
3 | 4
Operation errors: 99
Authentication errors: 2
Connection Failures: 0
25
The output of the show netconf schema command describes the element structure for a NETCONF
request and the resulting reply. This schema can be used to construct proper NETCONF requests and
parse the resulting replies. The nodes in the schema are defined in RFC 4741. The following is sample
output from the show netconf schema command:
Router# show netconf schema
New Name Space 'urn:ietf:params:xml:ns:netconf:base:1.0'
<VirtualRootTag> [0, 1] required
<rpc-reply> [0, 1] required
<ok> [0, 1] required
<data> [0, 1] required
<rpc-error> [0, 1] required
<error-type> [0, 1] required
<error-tag> [0, 1] required
<error-severity> [0, 1] required
<error-app-tag> [0, 1] required
<error-path> [0, 1] required
<error-message> [0, 1] required
<error-info> [0, 1] required
<bad-attribute> [0, 1] required
<bad-element> [0, 1] required
<ok-element> [0, 1] required
<err-element> [0, 1] required
<noop-element> [0, 1] required
<bad-namespace> [0, 1] required
<session-id> [0, 1] required
<hello> [0, 1] required
<capabilities> 1 required
<capability> 1+ required
<rpc> [0, 1] required
<close-session> [0, 1] required
<commit> [0, 1] required
<confirmed> [0, 1] required
<confirm-timeout> [0, 1] required
<copy-config> [0, 1] required
<source> 1 required
<config> [0, 1] required
<cli-config-data> [0, 1] required
<cmd> 1+ required
<cli-config-data-block> [0, 1] required
<xml-config-data> [0, 1] required
<Device-Configuration> [0, 1] required
<> any subtree is allowed
<candidate> [0, 1] required
<running> [0, 1] required
<startup> [0, 1] required
<url> [0, 1] required
<target> 1 required
<candidate> [0, 1] required
<running> [0, 1] required
<startup> [0, 1] required
<url> [0, 1] required
<delete-config> [0, 1] required
<target> 1 required
<candidate> [0, 1] required
<running> [0, 1] required
<startup> [0, 1] required
<url> [0, 1] required
<discard-changes> [0, 1] required
<edit-config> [0, 1] required
<target> 1 required
<candidate> [0, 1] required
26
27
Additional References
The following sections provide references related to the NETCONF feature.
Related Documents
Related Topic
Document Title
IP access lists
IP access lists commands: complete command syntax, Cisco IOS Security Command Reference
command mode, command history, defaults, usage
guidelines, and examples
Security commands: complete command syntax,
command mode, command history, defaults, usage
guidelines, and examples
Standards
Standard
Title
None
MIBs
MIB
MIBs Link
None
28
RFCs
RFC
Title
RFC 2222
RFC 2246
RFC 3080
RFC 4251
RFC 4252
RFC 4741
RFC 4742
RFC 4744
Technical Assistance
Description
Link
http://www.cisco.com/techsupport
29
Note
Table 1
Table 1 lists only the Cisco IOS software release that introduced support for a given feature in a given
Cisco IOS software release train. Unless noted otherwise, subsequent releases of that Cisco IOS
software release train also support that feature.
Feature Name
Releases
Feature Information
12.2(33)SRA
12.4(9)T
12.2(33)SB
12.2(33)SXI
30
Table 1
Feature Name
Releases
Feature Information
12.4(9)T
12.2(33)SRB
12.2(33)SB
12.2(33)SXI
31
Glossary
BEEPBlocks Extensible Exchange Protocol. A generic application protocol framework for
connection-oriented, asynchronous interactions.
NETCONFNetwork Configuration Protocol. A protocol that defines a simple mechanism through
which a network device can be managed, configuration data information can be retrieved, and new
configuration data can be uploaded and manipulated.
SASLSimple Authentication and Security Layer. An Internet standard method for adding
authentication support to connection-based protocols. SASL can be used between a security appliance
and an Lightweight Directory Access Protocol (LDAP) server to secure user authentication.
SSHv2Secure Shell Version 2. SSH runs on top of a reliable transport layer and provides strong
authentication and encryption capabilities. SSHv2 provides a means to securely access and securely
execute commands on another computer over a network.
TLSTransport Layer Security. An application-level protocol that provides for secure communication
between a client and server by allowing mutual authentication, the use of hash for integrity, and
encryption for privacy. TLS relies upon certificates, public keys, and private keys.
XMLExtensible Markup Language. A standard maintained by the World Wide Web Consortium
(W3C) that defines a syntax that lets you create markup languages to specify information structures.
Information structures define the type of information (for example, subscriber name or address), not how
the information looks (bold, italic, and so on). External processes can manipulate these information
structures and publish them in a variety of formats. XML allows you to define your own customized
markup language.
CCDE, CCSI, CCENT, Cisco Eos, Cisco HealthPresence, the Cisco logo, Cisco Lumin, Cisco Nexus, Cisco Nurse Connect, Cisco Stackpower,
Cisco StadiumVision, Cisco TelePresence, Cisco WebEx, DCE, and Welcome to the Human Network are trademarks; Changing the Way We Work,
Live, Play, and Learn and Cisco Store are service marks; and Access Registrar, Aironet, AsyncOS, Bringing the Meeting To You, Catalyst, CCDA,
CCDP, CCIE, CCIP, CCNA, CCNP, CCSP, CCVP, Cisco, the Cisco Certified Internetwork Expert logo, Cisco IOS, Cisco Press, Cisco Systems,
Cisco Systems Capital, the Cisco Systems logo, Cisco Unity, Collaboration Without Limitation, EtherFast, EtherSwitch, Event Center, Fast Step,
Follow Me Browsing, FormShare, GigaDrive, HomeLink, Internet Quotient, IOS, iPhone, iQuick Study, IronPort, the IronPort logo, LightStream,
Linksys, MediaTone, MeetingPlace, MeetingPlace Chime Sound, MGX, Networkers, Networking Academy, Network Registrar, PCNow, PIX,
PowerPanels, ProConnect, ScriptShare, SenderBase, SMARTnet, Spectrum Expert, StackWise, The Fastest Way to Increase Your Internet Quotient,
TransPath, WebEx, and the WebEx logo are registered trademarks of Cisco Systems, Inc. and/or its affiliates in the United States and certain other
countries.
All other trademarks mentioned in this document or website are the property of their respective owners. The use of the word partner does not imply
a partnership relationship between Cisco and any other company. (0903R)
Any Internet Protocol (IP) addresses used in this document are not intended to be actual addresses. Any examples, command display output, and
figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses in illustrative content is unintentional and
coincidental.
2007-2009 Cisco Systems, Inc. All rights reserved.
32