MAC Address Commands
show mac address-table
show mac address-table
import requests
import json
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
"version": "1.0",
"type": "cli_show",
"chunk": "0",
"sid": "1",
"input": "show mac address-table",
"output_format": "json"
}
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
"ins_api": {
"type": "cli_show",
"version": "1.2",
"sid": "eoc",
"outputs": {
"output": {
"input": "show mac address-table",
"msg": "Success",
"code": "200",
"body": {
"header": [
" __Note__: MAC table entries displayed are getting read from software.\n Use the 'hardware-age' keyword to get information related to 'Age' \n\n Legend: \n * - primary entry, G - Gateway MAC, (R) - Routed MAC, O - Overlay MAC\n age - seconds since last seen,+ - primary entry using vPC Peer-Link, E - EVPN entry \n (T) - True, (F) - False , ~~~ - use 'hardware-age' keyword to retrieve age info \n",
" VLAN/BD MAC Address Type age Secure NTFY Ports/SWID.SSID.LID\n",
"---------+-----------------+--------+---------+------+----+------------------\n"
],
"TABLE_mac_address": {
"ROW_mac_address": {
"disp_mac_addr": "0026.51c7.fcc1",
"disp_type": "G ",
"disp_vlan": 0,
"disp_is_static": "enabled",
"disp_age": 0,
"disp_is_secure": "disabled",
"disp_is_ntfy": "disabled",
"disp_port": "sup-eth1(R)"
}
}
}
}
}
}
}
To display the number of entries in the MAC address table, use the show mac address-table command.
For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.
Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.2(1).
CLI Output |
---|
|
show mac address-table vlan 2
show mac address-table vlan 2
import requests
import json
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
"version": "1.0",
"type": "cli_show",
"chunk": "0",
"sid": "1",
"input": "show mac address-table vlan 2",
"output_format": "json"
}
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
"ins_api": {
"type": "cli_show",
"version": "1.2",
"sid": "eoc",
"outputs": {
"output": {
"input": "show mac address-table vlan 2",
"msg": "Success",
"code": "200",
"body": {
"header": [
" Note: MAC table entries displayed are getting read from software.\n Use the 'hardware-age' keyword to get information related to 'Age' \n\n Legend: \n * - primary entry, G - Gateway MAC, (R) - Routed MAC, O - Overlay MAC\n age - seconds since last seen,+ - primary entry using vPC Peer-Link, E - EVPN entry \n (T) - True, (F) - False , ~~~ - use 'hardware-age' keyword to retrieve age info \n",
" VLAN/BD MAC Address Type age Secure NTFY Ports/SWID.SSID.LID\n",
"---------+-----------------+--------+---------+------+----+------------------\n"
],
"TABLE_mac_address": {
"ROW_mac_address": [{
"disp_mac_addr": "0026.51c7.fcc1",
"disp_type": "G ",
"disp_vlan": 2,
"disp_is_static": "enabled",
"disp_age": 0,
"disp_is_secure": "disabled",
"disp_is_ntfy": "disabled",
"disp_port": "sup-eth1(R)"
}, {
"disp_mac_addr": "8c60.4ff8.60fc",
"disp_type": "* ",
"disp_vlan": 2,
"disp_is_static": "disabled",
"disp_age": 0,
"disp_is_secure": "disabled",
"disp_is_ntfy": "disabled",
"disp_port": "port-channel22"
}]
}
}
}
}
}
}
For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.
Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.2(1).
CLI Output |
---|
|
show mac address-table static
show mac address-table static
import requests
import json
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
"version": "1.0",
"type": "cli_show",
"chunk": "0",
"sid": "1",
"input": "show mac address-table static",
"output_format": "json"
}
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
"ins_api": {
"type": "cli_show",
"version": "1.2",
"sid": "eoc",
"outputs": {
"output": {
"input": "show mac address-table static",
"msg": "Success",
"code": "200",
"body": {
"header": [
" Note: MAC table entries displayed are getting read from software.\n Use the 'hardware-age' keyword to get information related to 'Age' \n\n Legend: \n * - primary entry, G - Gateway MAC, (R) - Routed MAC, O - Overlay MAC\n age - seconds since last seen,+ - primary entry using vPC Peer-Link, E - EVPN entry \n (T) - True, (F) - False , ~~~ - use 'hardware-age' keyword to retrieve age info \n",
" VLAN/BD MAC Address Type age Secure NTFY Ports/SWID.SSID.LID\n",
"---------+-----------------+--------+---------+------+----+------------------\n"
],
"TABLE_mac_address": {
"ROW_mac_address": {
"disp_mac_addr": "0026.51c7.fcc1",
"disp_type": "G ",
"disp_vlan": 0,
"disp_is_static": "enabled",
"disp_age": 0,
"disp_is_secure": "disabled",
"disp_is_ntfy": "disabled",
"disp_port": "sup-eth1(R)"
}
}
}
}
}
}
}
To display information about static MAC address to a virtual interface, use show mac-address-table static command.
For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.
Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.2(1).
CLI Output |
---|
|
show mac address-table dynamic
show mac address-table dynamic
import requests
import json
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
"version": "1.0",
"type": "cli_show",
"chunk": "0",
"sid": "1",
"input": "show mac address-table dynamic",
"output_format": "json"
}
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
"ins_api": {
"type": "cli_show",
"version": "1.2",
"sid": "eoc",
"outputs": {
"output": {
"input": "show mac address-table dynamic",
"msg": "Success",
"code": "200",
"body": {
"header": [
" Note: MAC table entries displayed are getting read from software.\n Use the 'hardware-age' keyword to get information related to 'Age' \n\n Legend: \n * - primary entry, G - Gateway MAC, (R) - Routed MAC, O - Overlay MAC\n age - seconds since last seen,+ - primary entry using vPC Peer-Link, E - EVPN entry \n (T) - True, (F) - False , ~~~ - use 'hardware-age' keyword to retrieve age info \n",
" VLAN/BD MAC Address Type age Secure NTFY Ports/SWID.SSID.LID\n",
"---------+-----------------+--------+---------+------+----+------------------\n"
]
}
}
}
}
}
For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.
Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.2(1).
CLI Output |
---|
|
show mac address-table aging-mode
show mac address-table aging-mode
import requests
import json
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
"version": "1.0",
"type": "cli_show",
"chunk": "0",
"sid": "1",
"input": "show mac address-table aging-mode",
"output_format": "json"
}
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
"aging_mode_str": "aging mode of portchannel-refresh is enabled"
}
switch# show mac address-table aging-mode | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:1.0:l2fm" xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0">
<nf:data>
<show>
<mac>
<address-table>
<aging-mode>
<__XML__OPT_Cmd_show_mac_addr_tbl_agingmode___readonly__>
<__readonly__>
<aging_mode_str>aging mode of portchannel-refresh is enabled</aging_mode_str>
</__readonly__>
</__XML__OPT_Cmd_show_mac_addr_tbl_agingmode___readonly__>
</aging-mode>
</address-table>
</mac>
</show>
</nf:data>
</nf:rpc-reply>
]]>]]>
For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.
Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1).
CLI Output |
---|
|
show mac address-table aging-time [vlan | bridge-domain ]
show mac address-table aging-time [vlan <id> | bridge-domain <bdid>]
import requests
import json
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
"version": "1.0",
"type": "cli_show",
"chunk": "0",
"sid": "1",
"input": "show mac address-table aging-time vlan 10",
"output_format": "json"
}
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
"age_str": "Vlan/BD Aging Time\n---- ----------",
"TABLE_mac_aging_time": {
"ROW_mac_aging_time": {
"vlan_id": 10,
"age": 1800
}
}
}
switch# show mac address-table aging-time vlan 10 | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:1.0:l2fm" xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0">
<nf:data>
<show>
<mac>
<address-table>
<aging-time>
<__XML__OPT_Cmd_show_mac_addr_tbl_aging_time_vlan>
<vlan>
<id>10</id>
</vlan>
<__XML__OPT_Cmd_show_mac_addr_tbl_aging_time___readonly__>
<__readonly__>
<age_str>Vlan/BD Aging Time
---- ----------
</age_str>
<TABLE_mac_aging_time>
<ROW_mac_aging_time>
<vlan_id>10</vlan_id>
<age>1800</age>
</ROW_mac_aging_time>
</TABLE_mac_aging_time>
</__readonly__>
</__XML__OPT_Cmd_show_mac_addr_tbl_aging_time___readonly__>
</__XML__OPT_Cmd_show_mac_addr_tbl_aging_time_vlan>
</aging-time>
</address-table>
</mac>
</show>
</nf:data>
</nf:rpc-reply>
]]>]]>
For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.
Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1).
CLI Output |
---|
|
show mac address-table count [[vlan | bridge-domain ] | interface | {switch-id [sub-switch-id ]}]
show mac address-table count [[vlan <id> | bridge-domain <bdid>] | interface <interface-name> | {switch-id <swid> [sub-switch-id <sswid>]}]
import requests
import json
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
"version": "1.0",
"type": "cli_show",
"chunk": "0",
"sid": "1",
"input": "show mac address-table count vlan 10",
"output_format": "json"
}
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
"id-out": 10,
"dyn_cnt": 3500,
"static_cnt": 0,
"secure_cnt": 0
}
switch# show mac address-table count vlan 10 | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:1.0:l2fm" xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0">
<nf:data>
<show>
<mac>
<address-table>
<count>
<__XML__OPT_Cmd_show_mac_addr_tbl_count_vlan>
<__XML__OPT_Cmd_show_mac_addr_tbl_count_vlan>
<vlan>
<id>10</id>
</vlan>
</__XML__OPT_Cmd_show_mac_addr_tbl_count_vlan>
<__XML__OPT_Cmd_show_mac_addr_tbl_count___readonly__>
<__readonly__>
<id-out>10</id-out>
<dyn_cnt>3500</dyn_cnt>
<static_cnt>0</static_cnt>
<secure_cnt>0</secure_cnt>
</__readonly__>
</__XML__OPT_Cmd_show_mac_addr_tbl_count___readonly__>
</__XML__OPT_Cmd_show_mac_addr_tbl_count_vlan>
</count>
</address-table>
</mac>
</show>
</nf:data>
</nf:rpc-reply>
]]>]]>
For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.
Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1).
CLI Output |
---|
|
show mac address-table learning-mode [vlan | bridge-domain ]
show mac address-table learning-mode [vlan <id> | bridge-domain <bdid>]
import requests
import json
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
"version": "1.0",
"type": "cli_show",
"chunk": "0",
"sid": "1",
"input": "show mac address-table learning-mode vlan 10",
"output_format": "json"
}
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
"learning_mode_str": "Vlan/BD Learning Mode\n---- ----------",
"TABLE_mac_learning_mode": {
"ROW_mac_learning_mode": {
"vlan_id": 10,
"mode_str": "Non-Conversational-Learning"
}
}
}
switch# show mac address-table learning-mode vlan 10 | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:1.0:l2fm" xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0">
<nf:data>
<show>
<mac>
<address-table>
<learning-mode>
<__XML__OPT_Cmd_show_mac_addr_tbl_learning_mode_vlan>
<vlan>
<id>10</id>
</vlan>
<__XML__OPT_Cmd_show_mac_addr_tbl_learning_mode___readonly__>
<__readonly__>
<learning_mode_str>Vlan/BD Learning Mode
---- ----------
</learning_mode_str>
<TABLE_mac_learning_mode>
<ROW_mac_learning_mode>
<vlan_id>10</vlan_id>
<mode_str>Non-Conversational-Learning</mode_str>
</ROW_mac_learning_mode>
</TABLE_mac_learning_mode>
</__readonly__>
</__XML__OPT_Cmd_show_mac_addr_tbl_learning_mode___readonly__>
</__XML__OPT_Cmd_show_mac_addr_tbl_learning_mode_vlan>
</learning-mode>
</address-table>
</mac>
</show>
</nf:data>
</nf:rpc-reply>
]]>]]>
For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.
Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1).
CLI Output |
---|
|