Get Security Appliance lanIp Address

Prodrick
Building a reputation

Get Security Appliance lanIp Address

When getting the list of devices for a given org from the following endpoint, appliances include the wan1Ip and wan2Ip, but not the lanIp.  However, for devices like cameras and wireless, this endpoint provides the lanIp.  I need a way to get the lanIp of appliances, so when I add them to my monitoring platform the it can contact the devices on an internal IP.

 

Thoughts on how one might programmatically get the lanIp for MX Security Appliances?

Thanks.

curl -L --request GET \
--url 'https://api.meraki.com/api/v1/organizations/OrgId/devices' \
--header 'Authorization: Bearer ApiKey' \
--header 'Accept: application/json'

10 Replies 10
alemabrahao
Kind of a big deal
Kind of a big deal

If you are talking about VLANs you can do it with this one.

 

Get Network Appliance Vlans - Meraki Dashboard API v1 - Cisco Meraki Developer Hub

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.

Otherwise you can use this one.

 

Get Organization Devices Statuses - Meraki Dashboard API v1 - Cisco Meraki Developer Hub

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.
Prodrick
Building a reputation

This is the response I get for the first MX.  Given this response, how might I determine the lanIp?

Thanks.

curl -L --request GET \
--url 'https://api.meraki.com/api/v1/organizations/OrgId/devices/statuses' \
--header 'Authorization: Bearer ApiKey' \
--header 'Accept: application/json'
[
{"name":"XXXX-XXX-MX1",
"serial":"XXXX-XXXX-6599",
"mac":"XX:XX:XX:XX:68:68",
"publicIp":"203.XXX.42.110",
"networkId":"L_69805794224244XXXX",
"status":"online",
"lastReportedAt":"2024-02-08T22:03:05.007000Z",
"productType":"appliance",
"components":{"powerSupplies":[]},
"model":"MX100",
"tags":[],

"usingCellularFailover":false,
"wan1Ip":"203.XXX.42.110",
"wan1Gateway":"203.XXX.42.109",
"wan1IpType":"static",
"wan1PrimaryDns":"1.0.0.1",
"wan1SecondaryDns":"8.8.8.8",
"wan2Ip":"10.0.100.5",
"wan2Gateway":"10.0.100.1",
"wan2IpType":"dhcp",
"wan2PrimaryDns":"1.0.0.1",
"wan2SecondaryDns":"8.8.8.8"}

The MX does not have LAN IP,  It has the WAN IP or VLAN IP.

 

You can get both with two links that I sent to you.

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.
Prodrick
Building a reputation

Thanks.  I made calls to both endpoints, and I think I follow you now.  However, the vlans endpoint returns applianceIp, but no serial field.  How might one resolve which of the two (primary/secondary) appliances this applianceIp belongs to?

The config for an HA pair applies to the pair. There wouldn't be different VLANs on the primary and spare.

Have you checked this one?

 

https://developer.cisco.com/meraki/api-v1/get-organization-uplinks-statuses/

 

 

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.
Prodrick
Building a reputation

This is what that returns for an example network with two appliances:

curl -L --request GET \
--url 'https://api.meraki.com/api/v1/organizations/OrgId/uplinks/statuses' \
--header 'Authorization: Bearer ApiKey' \
--header 'Accept: application/json'
[
{"networkId":"L_XXXX5794224244XXXX","serial":"Q2JN-229D-XXXX","model":"MX100","highAvailability":{"enabled":true,"role":"primary"},"lastReportedAt":"2024-02-08T23:05:07Z","uplinks":[
 
{"interface":"wan1","status":"active","ip":"203.XXX.42.110","gateway":"203.220.42.109","publicIp":"203.XXX.42.110","primaryDns":"1.0.0.1","secondaryDns":"8.8.8.8","ipAssignedBy":"static"},
 
{"interface":"wan2","status":"ready","ip":"10.0.100.5","gateway":"10.0.100.1","publicIp":"1.XXX.1.161","primaryDns":"1.0.0.1","secondaryDns":"8.8.8.8","ipAssignedBy":"dhcp"}]},
 
{"networkId":"L_XXXX5794224244XXXX","serial":"Q2JN-2UKG-XXXX","model":"MX100","highAvailability":{"enabled":true,"role":"spare"},"lastReportedAt":"2024-02-08T23:05:09Z","uplinks":[
 
{"interface":"wan1","status":"active","ip":"10.0.100.4","gateway":"10.0.100.1","publicIp":"1.XXX.1.161","primaryDns":"1.0.0.1","secondaryDns":"8.8.8.8","ipAssignedBy":"dhcp"},
 
{"interface":"wan2","status":"not connected","ip":null,"gateway":null,"publicIp":null,"primaryDns":null,"secondaryDns":null,"ipAssignedBy":null}]
}

Great, I believe this meets your needs.

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.

Just to be clear, you will not get all the information with a single API, you will have to use a set of APIs and work on a script to cross-reference the information.

 

You're going to have a little work.

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.
Get notified when there are additional replies to this discussion.