Introduction
This document describes how to update your IP address using PowerShell for dynamic networks in Cisco Umbrella.
Prerequisites
Requirements
There are no specific requirements for this document.
Components Used
The information in this document is based on Cisco Umbrella.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.
Overview
This article is intended to serve as a general overview. A list of supported options for updating Umbrella with your dynamic IP is available here.
You can use any scripted method to update your IP address using the API. This article demonstrates how PowerShell can be used.
Before you begin this process:
- Configure your dashboard as detailed here.
- Take note of the name of your dynamic network in the Umbrella Dashboard under Deployments > Networks.
Use PowerShell to Update Dynamic IP (Hard Coded IP)
1. Determine the current external IP address for this network. This must be done from a machine on this network.
$MyIp = Resolve-DnsName myip.opendns.com | Select -ExpandProperty IPAddress
2. Get the credentials. Note that these must have full admin rights to your Dashboard.
$MyCredential = Get-Credential
This opens a pop-up.
3. Enter your email address and password. You can then use these credentials to post an update using this command:
Invoke-RestMethod -Uri "https://updates.opendns.com/nic/update?hostname=biscuit&myip=$MyIP" -Credential $MyCredential
Method to Allow Scripting of Update to Dynamic IP
This method requires pre-storing the credentials for unattended use.
Caution: This method is NOT secure and is provided as an example only. This has been tested on PowerShell 5.1 only.
1. First, generate an obfuscated file containing the password. This needs to only be run once. Enter the email address and password of any full admin user of the dashboard.
(Get-Credential).Password | ConvertFrom-SecureString | Out-File "C:\MyPassword.txt"
2. You can then use this file in a complete script:
$UmbrellaNetwork = "your network name"
$User = "your admin email address"
$MyIp = Resolve-DnsName myip.opendns.com | Select -ExpandProperty IPAddress
$File = "C:\MyPassword.txt"
$MyCredential=New-Object -TypeName System.Management.Automation.PSCredential ` -ArgumentList $User, (Get-Content $File | ConvertTo-SecureString)
Invoke-RestMethod -Uri "https://updates.opendns.com/nic/update?hostname=$UmbrellaNetwork&myip=$MyIp" -Credential $MyCredential