# Finding Your IP Address
There are many ways to find your Moku's IP Address. You may use the Desktop App (if installed) or the Moku CLI tool (bundled with the Moku Scripting API for Python). Additionally, if you're using the USB Connection to your Moku, the IP Address can be calculated based on the serial number.
# Using the Desktop App
- Open the Desktop Application
- On the "Select Device" screen, find the tile of the Moku to which you wish to connect
- Right-click and select
Device Info > Copy IP Address
# Moku CLI
moku Command Line Utility is installed as part of the Moku Scripting API for Python. If you're using MATLAB then you may choose to install the Python library additionally, or use one of the other methods listed on this page
At a terminal or command prompt, use the Moku CLI tool to list all the Moku devices your computer can see.
$: moku list
# USB Connection
USB is Moku:Go Only
The Moku:Pro doesn't yet support API over USB. Please connect using Ethernet or WiFi, and use one of the above methods to discover the IP address
API support over the USB is possible as the USB link presents as an Ethernet interface. The interface is configured to have an IPv6 Link-Local address only, which can be found using any of the methods above. IPv6 support is limited in some environments, see below.
IPv6, and especially IPv6 link-local addressing as used when your Moku is connected over USB, is not universally supported. As such the API cannot be used over USB in some environments without a proxy (see below). A non-exhaustive list of limited of unsupported environments is
- Windows Subsystem for Linux Version 2 (WSL2), as discussed with workarounds here (opens new window)
- LabVIEW, as discussed here (opens new window)
- Most web browsers (opens new window) (which aren't full API clients but which may be required to use Moku Cloud Compile and other features)
If you require API connectivity from these environments, you must use a proxy as below, or a network connection like Ethernet or WiFi configured to use IPv4. Ethernet may be configured as a point-to-point network with Static IPs if security is a concern.
# Specifying IPv6 Addresses
The above unsupported environments notwithstanding, some IPv6 errors simply come from how the address is specified. One should keep the following points in mind:
- Most importantly make sure your libraries are up to date. In particular, Python parsing of these addresses was broken in some versions of
urllib3. See this Troubleshooting tip for details.
- Enclose the IP address in square brackets:
- If specifying the IP address on the command line, ensure those brackets are escaped if required, e.g. using single quotes in Bash:
'[fe80::1:2:3:4%eth0]'. Windows CMD does not require escaping the brackets, and in fact will fail if you specify quotes (which will incorrectly be interpreted as part of the address)
- If the scope id (element after the percent sign) is numeric, e.g. on Windows, ensure that your programming language does not interpret it as a special character
# Configuring a Proxy
Windows comes with a
portproxy that can be used to listen on an IPv4 address (that your restricted environment can connect to) and forward it to an IPv6 one (like the Moku over USB).
CMD.exe as Administrator and enter the below. Replace the
connectaddress with the IPv6 address of your Moku's USB interface, e.g. by using the "Copy IP Address" option from the Desktop App. Remember to enclose the address in square brackets.
PS > netsh interface portproxy set v4tov6 ` listenport=8090 ` connectaddress=[fe80:0000:0000:0000:7269:1234:5678:0000%0] ` connectport=http
You can then use the address
localhost:8090 to connect using the API.
If this command doesn't work, check that no other service is operating on port
8090. You can change this number as required (typically a number between 1024 and 65535 on which nothing else is running), just make sure the
listenport and the port specifier in the address match.