How to find valid DNS for a device? Via API and Console?

FredY1
Here to help

How to find valid DNS for a device? Via API and Console?

Hi all,

 

I am unable to find a valid DNS through the APIs or console.

We tried following Dashboard REST APIs:

- https://api.meraki.com/api/v1/networks/{network_id}/devices
- https://api.meraki.com/api/v1/networks/{network_id}/devices/{serial_num}
- https://api.meraki.com/api/v1/devices/{serial_num}
- https://api.meraki.com/api/v1/devices/{serial_num}/managementInterface
- https://api.meraki.com/api/v1/organizations/{orgnization_id}/devices?networkIds[]={network_ids}

The "name" field is supposed be a valid DNS/ hostname but we receive something like :
"ABCD-A-1-Google Office", which is an invalid DNS with the space in between. We are looking for something like "ABCD-A-1-Google-Office-123".

Where or which API could we use? Thanks.

We also tried using this API https://api.meraki.com/api/v1/devices/{serial_num}/managementInterface
from  https://developer.cisco.com/meraki/api-v1/get-device-management-interface/

But received following:

{

    "wan1": {

        "usingStaticIp": false,

        "vlan": null

    }

}


I checked on Meraki console. The name was also "ABCD-A-1-Google Office".

6 Replies 6
alemabrahao
Kind of a big deal
Kind of a big deal

It seems like you're trying to retrieve the DNS name of a device from the Meraki API, but you're getting a name with spaces which is not a valid DNS name. The name field in the Meraki API and console is not guaranteed to be a valid DNS name, it's just a human-readable name for the device.

 

The Meraki API does not provide a separate field for the DNS name of a device. If you need to store a valid DNS name for each device, you might consider using the "notes" field to store this information. You can then retrieve it using the same API calls you're already using.

 

As for the `managementInterface` endpoint, it returns the configuration of the management interface for a device. The `usingStaticIp` field indicates whether the device is configured with a static IP. If this field is `false`, it means the device is using DHCP to obtain its IP configuration, including the DNS servers. The actual DNS servers being used are not exposed via the API.

 

If you have control over the DHCP server, you could configure it to assign a specific DNS name to each device based on its MAC address. This DNS name would then be valid and could be resolved by other devices on your network.

Please note that manipulating DNS settings and hostnames can have impacts on your network and should be done carefully. Always make sure to test changes in a controlled environment before deploying them to your production network.

 

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.
FredY1
Here to help

Do you know if there is a way to configure Meraki so we could obtain a valid DNS name through the 'name' fields or other fields from any of the APIs?

Ryan_Miles
Meraki Employee
Meraki Employee

Is Dynamic DNS enabled? The API call you mentioned above should return dyn dns info if enabled.

 

https://documentation.meraki.com/MX/Other_Topics/Dynamic_DNS_(DDNS)#Enabling_Dynamic_DNS

Ryan

If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.
FredY1
Here to help
alemabrahao
Kind of a big deal
Kind of a big deal

None of these APIs appear to return DDNS information.

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.
sungod
Kind of a big deal

Searching the API doesn't find any likely calls to get the name in general.

 

But I wouldn't really expect it to for most devices, finding a device's FQDN is done via a reverse lookup on the DNS server, Dashboard doesn't have it.

 

In the specific case of appliances, the name is managed by Meraki's dynamic DNS service, this call seems to provide it...

 

https://developer.cisco.com/meraki/api-v1/get-network-appliance-settings/

 

The example shows a single DDNS name, but Dashboard UI shows more than one name (in the pop-up), with the hostname of the first FQDN used to generate two more hostnames with '-1' and '-2' suffixes.

 

For instance (this is my interpretation/guess of name-IP correspondence, not sure if it is documented somewhere)...

 
hostname.dynamic-m.com        seems to map to the main IP, perhaps the primary uplink port
hostname-1.dynamic-m.com     WAN 1
hostname-2.dynamic-m.com     WAN 2

 

Also, I can see that f it's an HA pair with virtual IPs used, it is the virtual IP returned, rather than the underlying device IP.

 

Get notified when there are additional replies to this discussion.