DHCP Reservations on Network with No VLANs

Jason-907
Getting noticed

DHCP Reservations on Network with No VLANs

Normally I can do the call:

myvlans = meraki.getvlans(apikey, networkid, suppressprint=False)
And then I can modify DHCP reservations to my heart's content. Today I needed to have my script do this for a small branch office with a flat network. It's small enough that I'm not using VLANs, so my getvlans call is returning ['VLANs are not enabled for this network']
So, is there a workaround? How do I get to the DHCP info for this network? Do I have to enable VLANs to access this information through the API?
 
Sorry if I've totally missed something that has developed recently. I split my time between firewall, LAN, and server admin. Sometimes I can go for months without touching the meraki API.
6 Replies 6
CptnCrnch
Kind of a big deal
Kind of a big deal

Seems like there are several areas you need VLANs enabled, even if they‘re not needed:

https://community.meraki.com/t5/Developers-APIs/Getting-LAN-Config-via-API-when-VLANs-are-disabled/m...

PhilipDAth
Kind of a big deal
Kind of a big deal

rhbirkelund
Kind of a big deal
Kind of a big deal

I am in no way experienced in the Meraki API.

However, I've found this.

 

You can check if vlans are enabled by using this endpoint;

 

HTTP REQUEST
GET /networks/{networkId}/vlansEnabledState

 

If that returns true, then go ahead using your  getvlans()-call

If false, you can maybe you can use 

 

HTTP REQUEST
GET /networks/{networkId}/vlans/{vlanId}

 

and then return for vlan 1 or 0? I'm not sure if this would work...

LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.
rhbirkelund
Kind of a big deal
Kind of a big deal

What's returned if you call this?

HTTP REQUEST
GET /networks/{networkId}/appliancePorts
LinkedIn ::: https://blog.rhbirkelund.dk/

Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂

All code examples are provided as is. Responsibility for Code execution lies solely your own.
Charlotte
Here to help

The '/networks/{networkId}/appliancePorts' only works if VLANs are enabled. But it doesn't have DHCP information, just says what VLANs are on the MX ports.
Jason-907
Getting noticed

Thanks guys. I hit the easy button--enabled the VLANs and hoped that didn't break anything. It doesn't seem like it should break anything, but right after I did that our monitoring software stopped being able to ping the device. It was only after digging through the dashboard for a while that we figured out that the change broke the VPN mesh. I had to enable it for VLAN 1. 

Get notified when there are additional replies to this discussion.