Onboarding with SNMP via BASH

#!/bin/bash
 
########################################################
#ap.txt or cpe.txt should be simply one IP per line
community=skljdkljfdssd
server=https://cloud.cambiumnetworks.com
cambiumid=LSKJDKLJFDSKLJFDS
onboardkey=123hf78f28hf478h78hf43
########################################################
 
#use this to identify your radio versions (it needs 2.5+)
#while read -r radioip; do
#  echo "Querying" $radioip
#  snmpget -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.1.1.1.0
#done < "ap.txt"
 
#this is how you enable, set host/cambiumid/onboardkey, apply
while read -r radioip; do
  echo "Querying" $radioip
  snmpset -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.3.20.1.0 i 1
  snmpset -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.3.20.2.0 s $server
  snmpset -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.3.20.3.0 s $cambiumid
  snmpset -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.3.20.4.0 s $onboardkey
  snmpset -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.4.4.0 i 1
done < "cpe.txt" >> onboard.log
 
 
 
5 Likes

Nice !  had a similar idea and banged out some scripting to fit my needs but I used  windows  batch instead 

here  is my quick and dirty batch script

@echo OFF
setlocal EnableDelayedExpansion
for /F %%a in (iplist.txt) do (
    ECHO.
    ECHO PINGING %%a, please wait....
    PING -n 2 %%a|find "TTL=" >NUL
    IF !ERRORLEVEL! neq 0 (ECHO %%a is UNREACHABLE
    ) ELSE (
    ECHO.
    ECHO SENDING SNMP COMMANDS....
    snmpset -v2c -c private %%a .1.3.6.1.4.1.17713.21.3.20.1.0 i 1
    snmpset -v2c -c private %%a .1.3.6.1.4.1.17713.21.3.20.2.0 s https://172.16.0.0
    snmpset -v2c -c private %%a .1.3.6.1.4.1.17713.21.3.20.3.0 s cnmaestro_on_premises
    snmpset -v2c -c private %%a .1.3.6.1.4.1.17713.21.3.20.4.0 s SampleOnBoard
    snmpset -v2c -c private %%a .1.3.6.1.4.1.17713.21.4.3.0 i 1
    snmpset -v2c -c private %%a .1.3.6.1.4.1.17713.21.4.4.0 i 1
    snmpset -v2c -c private %%a .1.3.6.1.4.1.17713.21.4.1.0 i 1
    echo Done Sending SNMP Commands %%a should be pending approval.
 )
)
3 Likes

IF you are onboarding PMP450, the correct OID values are as follows:

cnMaestro Remote Management 1=Yes 0=No

snmpset -v2c -c SNMPstring DeviceIP .1.3.6.1.4.1.161.19.3.3.2.257.0 i 1

cnMaestro URL:

snmpset -v2c -c SNMPstring DeviceIP .1.3.6.1.4.1.161.19.3.3.2.258.0 s https://cloud.cambiumnetworks.com

cnMaestro ID

snmpset -v2c -c SNMPstring DeviceIP .1.3.6.1.4.1.161.19.3.3.2.259.0 s CambiumIDhere

cnMaestro Onboarding Key

snmpset -v2c -c SNMPstring DeviceIP .1.3.6.1.4.1.161.19.3.3.2.260.0 s OnboardingKeyHere

Reboot Radio - optional

snmpset -v2c -c SNMPstring DeviceIP .1.3.6.1.4.1.161.19.3.3.3.2.0 i 1

4 Likes

Thank you for the post TopFlight.  Your post will save someone some valuable time and effort.

#!/bin/bash

community=URCOMMUNITY

server=https://cnm.yourcompany.com
cambiumid=KEY2ONBOARDWITH
onboardkey=RANDOMSTRING

#this is how you enable, set host/cambiumid/onboardkey, apply
while read -r radioip; do
echo "Querying" $radioip
snmpset -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.3.20.1.0 i 1
snmpset -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.3.20.2.0 s $server
snmpset -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.3.20.3.0 s $cambiumid
snmpset -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.3.20.4.0 s $onboardkey
snmpset -v2c -c$community $radioip .1.3.6.1.4.1.17713.21.4.4.0 i 1
done < "cpe08222018.txt" >> onboard.log

The other OIDs in the thread don't seem to be necessary.  I just took a csv from my billing system and ran this and everything hit the on prem server.  It was cool to see them all show up quickly and I'm glad there's an "Approve All" button!!!

1 Like

Thanks for this. Any chance you know how to change the IP settings to dhcp using snmp as well?

If you’re doing bridge mode: 1.3.6.1.4.1.17713.21.3.4.7.1
If you’re doing NAT mode: 1.3.6.1.4.1.17713.21.3.4.3.1

Source: https://support.cambiumnetworks.com/framed/onlinetools/

1 Like