a brief guide to using netmaker from the command line (without the UI)
- using bash shell
- nmctl and jq have been installed
- netmaker server has been set up at example.com. This can be a SaaS (managed) tenant as well.
export NN_DOMAIN=example.com
curl --location 'https://api.$NM_DOMAIN/api/users/adm/createsuperadmin' \ --header 'Content-Type: application/json' \ --data '{ "username":"superadmin", "password":"NetmakerIsAwe$ome" }'
nmctl context set commandline --endpoint https://api.$NM_DOMAIN --username $USER --password $PASSWORD
nmctl user create --admin --name $USER --password $PASSWORD
nmctl user create --name <user> --password <user-password>
assume that users have been created by superadmin
export USER=<user> export PASSWORD=<user-password>
nmctl context set commandline --endpoint https://api.$NM_DOMAIN --username $USER --password $PASSWORD nmctl context use commandline
nmctl network create --name mynetwork --ip4v_addr 10.10.10.0/24
create one of Unlimited/LimitedUse/Expiration
export KEY=$(nmctl enrollment_key create --network mynetwork --unlimited | jq .token)
export KEY=$(nmctl enrollment_key create --network mynetwork --uses 3 | jq .token)
export EXPIRES=$(date -d "+2 days" +$s) export KEY=$(nmctl enrollment_key create --network mynetwork --expires $EXPIRES | jq .token)
sudo netclient join -t $KEY