Below are some example commands and command-combinations I've found particularly useful to get things done quickly and effeciently. If you have a useful command you'd like to share please open an issue to share it or submit a merge-request to the repo.
Placeholders in the command examples will use the format <placeholder>
- List Organizations
- List Networks in an Organization
- List Device Inventory of an Organization
- List Assigned Devices in an Organization
- List Unassigned Devices in an Organization
- List All Switches in an Organization
- List Devices in a Network
- List All Switch Stacks in a Network
- Claim a Device into a Network
- Change Device Name
- Change Device Name (Partial Serial)
- Change Device Management VLAN/IP/DNS
- List Port Settings on a Switch
- Set the Name of a Switch Port
- Set a Switch Port to Access a VLAN
- List SVIs on a Switch
- Create a SVI on a Layer-3 Switch
- Create a SVI and Add it to OSPF on a Layer-3 Switch
- Set DHCP Settings on SVI (Using the SVI Name)
- Filter ports on a switch using LLDP info
- Set camera ports to specific VLAN
Print a list of organizations (and their organization ID numbers) to which you have access.
meraki organizations getOrganizations
Print a list of networks (and their network ID numbers) within an organization
meraki organizations getOrganizationNetworks --organizationId <organizationId>
Print a list of devices in the inventory of a network
meraki organizations getOrganizationInventoryDevices --organizationId <organizationId>
Print a list of devices in an organization which are currently assigned to a network
meraki -f networkId:N_ organizations getOrganizationInventoryDevices --organizationId <organizationId>
Print a list of devices in an organization which are currently not assigned to a network
meraki -f networkId:None organizations getOrganizationInventoryDevices --organizationId <organizationId>
Print a list of all switches in an organization
meraki -f model:^MS organizations getOrganizationInventoryDevices --organizationId <organizationId>
Print a list of devices assigned to a particular network.
meraki networks getNetworkDevices --networkId <networkId>
Print a list of all switch stacks within a particular network.
meraki switch getNetworkSwitchStacks --networkId <networkId>
Claim an unassigned device into an existing Meraki Network
meraki networks claimNetworkDevices --networkId <networkId> --serials <serials>
Change the name of a device using the serial number of the device
meraki devices updateDevice --serial <serial> --name <name>
Change the name of a device in your organization using a partial serial number.
NOTE: If multiple serials match the filter criterion, then you will end up changing the name of multiple devices.
meraki -f serial:<partial_serial> organizations getOrganizationInventoryDevices --organizationId <organizationId> | meraki devices updateDevice --name <name>
Change the management VLAN/IP/DNS of a device (AP, switch, etc)
# Set management VLAN only
meraki -j devices updateDeviceManagementInterface --serial XXXX-XXXX-XXXX --wan1 '{"vlan": 2}'
#
# Set management IP only (DHCP)
meraki -j devices updateDeviceManagementInterface --serial XXXX-XXXX-XXXX --wan1 '{"usingStaticIp": false}'
#
# Set management IP only (static)
meraki -j devices updateDeviceManagementInterface --serial XXXX-XXXX-XXXX --wan1 '{"usingStaticIp": true, "staticIp": "192.168.128.2", "staticSubnetMask": "255.255.255.0", "staticGatewayIp": "192.168.128.1"}'
#
# Set management IP and VLAN
meraki -j devices updateDeviceManagementInterface --serial XXXX-XXXX-XXXX --wan1 '{"vlan": 2, "usingStaticIp": true, "staticIp": "192.168.128.2", "staticSubnetMask": "255.255.255.0", "staticGatewayIp": "192.168.128.1"}'
#
# Set management DNS servers
meraki -j devices updateDeviceManagementInterface --serial XXXX-XXXX-XXXX --wan1 '{"staticDns": [ "1.1.1.1", "8.8.8.8" ]}'
Print out ports and their settings for a particular switch
meraki switch getDeviceSwitchPorts --serial <serial>
Set the name (description) of a port on a switch
meraki switch updateDeviceSwitchPort --serial <serial> --portId <portId> --name "<name_or_description>"
Change a switch port settings to make it an "access" port and set a VLAN ID for it
meraki switch updateDeviceSwitchPort --serial <serial> --type access --portId <portId> --vlan <vlan>
Print a list of SVIs on a layer-3 switch
meraki switch getDeviceSwitchRoutingInterfaces --serial <serial>
Print a list of SVIs on a layer-3 switch stack
meraki switch getNetworkSwitchStackRoutingInterfaces --networkId <networkId> --switchStackId <switchStackId>
Create a new SVI (switched virtual interface) on a layer-3 switch
NOTE: The first SVI created on a switch requires the
defaultGateway
parameter be included.
meraki switch createDeviceSwitchRoutingInterface --serial <serial> --name <name> --vlanId <vlanId> --subnet "<subnet>" --interfaceIp <interfaceIp> --defaultGateway <defaultGateway>
Create a new SVI on a layer-3 switch and add that SVI to OSPF in a passive state.
NOTE: OSPF settings shown are an example and should be adjusted to your needs.
meraki switch createDeviceSwitchRoutingInterface --serial <serial> --name <name> --vlanId <vlanId> --subnet "<subnet>" --interfaceIp <interfaceIp> --ospfSettings '{"area": 0, "cost": 1, "isPassiveEnabled": true}'
Set DHCP relay on a layer-3 switch SVI (which typically requires the SVI ID number) using the name of the SVI instead of the ID number
meraki -f name:<svi_name> switch getDeviceSwitchRoutingInterfaces --serial <serial> | meraki -j switch updateDeviceSwitchRoutingInterfaceDhcp --serial <serial> --dhcpMode dhcpRelay --dhcpRelayServerIps '["<ip_address>"]'
List only switch ports with Meraki cameras connected to them
meraki -f "lldp:Meraki MV" switch getDeviceSwitchPortsStatuses --serial <serial>
List only switch ports with Meraki access points connected to them
meraki -f "lldp:Meraki MR" switch getDeviceSwitchPortsStatuses --serial <serial>
List only switch ports with Meraki switches connected to them
meraki -f "lldp:Meraki MR" switch getDeviceSwitchPortsStatuses --serial <serial>
Set all ports on a switch with Meraki cameras connected to access a specific VLAN
meraki -f "lldp:Meraki MV" switch getDeviceSwitchPortsStatuses --serial <serial> | meraki switch updateDeviceSwitchPort --serial <serial> --vlan <vlan>