0

I am using Micropython on Thonny (version 4.1.6) on Ubuntu 22.04 with a PicoW target.

I wanted to change the hostname, so wrote this code:

import network
import socket


from secret import ssid, password

wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(ssid, password)

wlan.config(hostname="Brian")

print (wlan.config("hostname"))

When this runs, it displays the new hostname.

However, when I check on this via either my router, or nslookup <ipaddress> or host <ipaddress>, I get the same answer - which is e.g. Unknown-<mac address>.

This seemed to be a solution that others found worked, so I wondered what I might be doing wrong.

(As a note, I also tried setting the hostname before connecting, but it had the same result, and elsewhere, I saw the command should be dhcp_hostname=..., but that generated an error.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.