Configuring Network Address Translation (NAT)
Enable Network Address Translation (NAT)
Network Address Translation (NAT) enables private IP internetworks that use nonregistered IP addresses to connect to the Internet.
NAT operates on a device, usually connecting two networks, and translates private (not globally unique) IP addresses in the internal
network into legal IP addresses before packets are forwarded to another network.
Before you can use the NX-API REST NAT configuration APIs, you must enable NAT on the switch.
Follow these steps to enable NAT.
Enter global configuration mode:
config t
Enable the NAT feature:
switch(config)# feature nat
NAT configuration mode is now active. You can now issue NX-API REST NAT configuration calls.
Configuring tcp-timeout for NAT Translation Table
Configuring tcp-timeout for NAT Translation Table
POST http://<mgmt0_ip>/api/mo/sys/nat.json
{
"natEntity": {
"children": [
{
"natInst": {
"attributes": {
"tcpTimeout": "100"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<tcpTimeout>100</tcpTimeout>
</inst-items>
</nat-items>
</System>
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
ip nat translation tcp-timeout 100
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Configuring udp-timeout for NAT Translation Table
Configuring udp-timeout for NAT Translation Table
POST http://<mgmt0_IP>/api/mo/sys/nat.json
{
"natEntity": {
"children": [
{
"natInst": {
"attributes": {
"udpTimeout": "101"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<udpTimeout>101</udpTimeout>
</inst-items>
</nat-items>
</System>
Configures udp-timeout for a NAT translation table.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
ip nat translation udp-timeout 101
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Configuring Timeout for NAT Translation Table
Configuring Timeout for NAT Translation Table
POST http://<mgmt0_IP>/api/mo/sys/nat.json
{
"natEntity": {
"children": [
{
"natInst": {
"attributes": {
"timeout": "102"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<timeout>102</timeout>
</inst-items>
</nat-items>
</System>
Configures timeout for NAT translation table.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
ip nat translation timeout 102
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Configuring Maximum Size of NAT Table for All Hosts
Configuring Maximum Size of NAT Table for All Hosts
POST http://<mgmt0_IP>/api/mo/sys/nat.json
{
"natEntity": {
"children": [
{
"natInst": {
"attributes": {
"allhost": "103"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<allhost>103</allhost>
</inst-items>
</nat-items>
</System>
Configures the maximum size of NAT the table for all hosts.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
ip nat translation max-entries all-host 103
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Configuring Maximum Size of NAT Table
Configuring Maximum Size of NAT Table
POST http://<mgmt0_IP>/api/mo/sys/nat.json
{
"natEntity": {
"children": [
{
"natInst": {
"attributes": {
"maxtranslation": "104"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<maxtranslation>104</maxtranslation>
</inst-items>
</nat-items>
</System>
Configures the maximum size of the NAT table.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
ip nat translation max-entries 104
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Creating a NAT Pool with Network Mask
Creating a NAT Pool with Network Mask
POST http://<mgmt0_IP>/api/mo/sys/nat/inst.json
{
"natInst": {
"children": [
{
"natPool": {
"attributes": {
"mask": "255.0.255.0",
"poolname": "pool5"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<pool-items>
<Pool-list>
<poolname>pool5</poolname>
<mask>255.0.255.0</mask>
</Pool-list>
</pool-items>
</inst-items>
</nat-items>
</System>
Creates a NAT pool with a network mask.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
ip nat pool pool5 netmask 255.0.255.0
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Deleting a NAT Pool with Network Mask
Deleting a NAT Pool with Network Mask
POST http://<mgmt0_IP>/api/mo/sys/nat/inst.json
{
"natInst": {
"children": [
{
"natPool": {
"attributes": {
"poolname": "pool5",
"status": "deleted"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<pool-items>
<Pool-list xc:operation="delete">
<poolname>pool5</poolname>
</Pool-list>
</pool-items>
</inst-items>
</nat-items>
</System>
Deletes a NAT pool with a network mask.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
no ip nat pool pool5 netmask 255.0.255.0
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Creating a NAT Pool with Prefix Length
Creating a NAT Pool with Prefix Length
POST http://<mgmt0_IP>/api/mo/sys/nat/inst.json
{
"natInst": {
"children": [
{
"natPool": {
"attributes": {
"poolname": "pool5",
"prefixlen": "24"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<pool-items>
<Pool-list xc:operation="delete">
<poolname>pool5</poolname>
</Pool-list>
</pool-items>
</inst-items>
</nat-items>
</System>
Creates a NAT pool with a prefix length.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
ip nat pool pool5 prefix-length 24
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Deleting a NAT Pool with Prefix Length
Deleting a NAT Pool with Prefix Length
POST http://<mgmt0_IP>/api/mo/sys/nat/inst.json
{
"natInst": {
"children": [
{
"natPool": {
"attributes": {
"poolname": "pool5",
"status": "deleted"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<pool-items>
<Pool-list xc:operation="delete">
<poolname>pool5</poolname>
</Pool-list>
</pool-items>
</inst-items>
</nat-items>
</System>
Deletes a NAT pool with a prefix length.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
no ip nat pool pool5 prefix-length 24
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Creating a NAT Pool with Network Mask
Creating a NAT Pool with Network Mask
POST http://<mgmt0_IP>/api/mo/sys/nat/inst/pool-pool5.json
{
"natPool": {
"attributes": {
"mask": "255.0.255.0",
"poolname": "pool5"
},
"children": [
{
"natPoolAddress": {
"attributes": {
"endip": "20.1.1.5",
"startip": "20.1.1.1"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<pool-items>
<Pool-list>
<poolname>pool5</poolname>
<mask>255.0.255.0</mask>
<startip-items>
<PoolAddress-list>
<startip>20.1.1.1</startip>
<endip>20.1.1.5</endip>
</PoolAddress-list>
</startip-items>
</Pool-list>
</pool-items>
</inst-items>
</nat-items>
</System>
Creates a NAT pool with a network mask.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
ip nat pool pool5 20.1.1.1 20.1.1.5 netmask 255.0.255.0
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Deleting a NAT Pool with Network Mask
Deleting a NAT Pool with Network Mask
POST http://<mgmt0_IP>/api/mo/sys/nat/inst/pool-pool5.json
{
"natPool": {
"attributes": {
"poolname": "pool5"
},
"children": [
{
"natPoolAddress": {
"attributes": {
"endip": "20.1.1.5",
"startip": "20.1.1.1",
"status": "deleted"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<pool-items>
<Pool-list>
<poolname>pool5</poolname>
<startip-items>
<PoolAddress-list xc:operation="delete">
<startip>20.1.1.1</startip>
<endip>20.1.1.5</endip>
</PoolAddress-list>
</startip-items>
</Pool-list>
</pool-items>
</inst-items>
</nat-items>
</System>
Deletes a NAT pool with a network mask.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
no ip nat pool pool5 20.1.1.1 20.1.1.5 netmask 255.0.255.0
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Creating NAT Pool with Prefix Length
Creating a NAT Pool with Prefix Length
POST http://<mgmt0_IP>/api/mo/sys/nat/inst/pool-pool5.json
{
"natPool": {
"attributes": {
"poolname": "pool5",
"prefixlen": "3"
},
"children": [
{
"natPoolAddress": {
"attributes": {
"endip": "20.1.1.5",
"startip": "20.1.1.1"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<pool-items>
<Pool-list>
<poolname>pool5</poolname>
<prefixlen>3</prefixlen>
<startip-items>
<PoolAddress-list>
<startip>20.1.1.1</startip>
<endip>20.1.1.5</endip>
</PoolAddress-list>
</startip-items>
</Pool-list>
</pool-items>
</inst-items>
</nat-items>
</System>
Creates a NAT pool with a prefix length.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
ip nat pool pool5 20.1.1.1 20.1.1.5 prefix-length 3
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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:
Deleting a NAT Pool with Prefix Length
Deleting a NAT Pool with Prefix Length
POST http://<mgmt0_IP>/api/mo/sys/nat/inst/pool-pool5.json
{
"natPool": {
"attributes": {
"poolname": "pool5"
},
"children": [
{
"natPoolAddress": {
"attributes": {
"endip": "20.1.1.5",
"startip": "20.1.1.1",
"status": "deleted"
}}}]}}
{
imdata:[]
}
<System>
<nat-items>
<inst-items>
<pool-items>
<Pool-list>
<poolname>pool5</poolname>
<startip-items>
<PoolAddress-list xc:operation="delete">
<startip>20.1.1.1</startip>
<endip>20.1.1.5</endip>
</PoolAddress-list>
</startip-items>
</Pool-list>
</pool-items>
</inst-items>
</nat-items>
</System>
Deletes a NAT pool with a prefix length.
CLI Commands
The CLI commands and options listed below are the equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload or the YANG tab to view the XML payload.
no ip nat pool pool5 20.1.1.1 20.1.1.5 prefix-length 3
For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:
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: