Configuring IP Addresses
This section contains payload examples to demonstrate how to use the NX-API REST API to configure IP addresses on the Cisco Nexus 3000 and 9000 Series switches.
Configuring an IPv4 Address for a Subinterface
Configuring an IPv4 Address for a Subinterface
POST
http://<IP_address>/api/mo/sys/intf.json
{
"topSystem": {
"children": [
{
"ipv4Entity": {
"children": [
{
"ipv4Inst" : {
"children" : [
{
"ipv4Dom" : {
"attributes" : {
"name" : "default"
},
"children" : [
{
"ipv4If" : {
"attributes" : {
"id" : "eth3/35.101"
}
"children" : [
{
"ipv4Addr" : {
"attributes" : {
"addr" : "113.1.1.1/24"
}}}]}}]}}]}}]}}]}}
The example in this section configures an IPv4 Address for a Subinterface.
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Configuring a Secondary IPv4 Address for a Subinterface
Configuring a Secondary IPv4 Address for a Subinterface
POST http://<IP_address>/api/mo/sys/intf.json
{
"topSystem": {
"children": [ {
"ipv4Entity": {
"children": [ {
"ipv4Inst" : {
"children" : [
{
"ipv4Dom" : {
"attributes" : {
"name" : "default"
},
"children" : [
{
"ipv4If" : {
"attributes" : {
"id" : "eth3/35.101"
}
"children" : [
{
"ipv4Addr" : {
"attributes" : {
"addr" : "101.101.101.1/24",
"type" : "secondary"
}}}]}}]}}]}}]}}]}}
The example in this section configures a secondary IPv4 address for a specified subinterface.
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Configuring an IPv4 and an IPv6 Address for a Subinterface
Configuring an IPv4 and an IPv6 Address for a Subinterface
POST
http://<IP_address>/api/mo/sys/intf.json
{
"topSystem": {
"children" : [ {
"l3Inst" : {
"attributes" : {
"name" : "default"
}
"children" : [{
"l3EncRtdIf" : {
"attributes" : {
"id" : "eth3/35.101",
"descr": "new interface 101",
"encap": "vlan-100",
"adminSt": "up",
"mediumType" : "p2p"
}}}]}}]
"children": [ {
"ipv4Entity": {
"children": [ {
"ipv4Inst" : {
"children" : [ {
"ipv4Dom" : {
"attributes" : {
"name" : "default"
},
"children" : [ {
"ipv4If" : {
"attributes" : {
"id" : "eth3/24.101"
}
"children" : [ {
"ipv4Addr" : {
"attributes" : {
"addr" : "101.1.1.1/24"
}}}]}}]}}]}}]}}]
"children": [ {
"ipv6Entity": {
"children": [ {
"ipv6Inst" : {
"children" : [{
"ipv6Dom" : {
"attributes" : {
"name" : "default"
}
"children" : [{
"ipv6If" : {
"attributes" : {
"id" : "eth3/24.101"
}
"children" : [{
"ipv6LLaddr": {
"attributes": {
"addr": "fe82::ab3"
}}},{
"ipv6Addr" : {
"attributes" : {
"addr" : "100:100:10::10/96"
}}}{
"ipv6Neighbor": {
"attributes": {
"addr": "9134::a3f2",
"neighborMac": "00:50:56:A6:50:D6"
}}}]}}]}}]}}]}}]}}
This example assigns an IPv4 and an IPv6 address to a subinterface.
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html