Change hostname.

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Posts: 62
Joined: Wed Jun 01, 2016 3:41 pm

Re: Change hostname.

Post by markxr » Thu Sep 08, 2016 5:35 pm

The obvious thing to do is to add a new keyword argument to sta.config(... ) - it already has keyword arguments for other parameters.

The function is esp_config in modnetwork.c. It's just a matter of adding a new case: in the argument checking and calling that function wifi_station_set_hostname. Seems easy enough.

User avatar
Posts: 1
Joined: Sun Apr 16, 2017 8:56 pm

Re: Change hostname.

Post by mogul » Sun Apr 16, 2017 9:04 pm

A year later I came across the same problem, and now it is straight forward to change hostname.


Posts: 13
Joined: Mon Jan 26, 2015 2:05 pm

Re: Change hostname.

Post by MCHobby » Mon Sep 18, 2017 8:33 pm

I'm using ESP8266 under MicroPython.
I had use the default ESP8266 hostname from WebRepl and find this really convenient when using the network DHCP. I'm using the modem-router from the Internet Provider.
Using "ws://ESP_xxxx:8266" with WebRepl is really a dream.

However, from time to time this Hostname purely disappears from the network :-(
What the hell to find the new IP for WebRepl(ing).

I have seen in this thread ... n-hostname explaining that ESP8266 reboot would not republish the hostname to the DHCP server (from the last SSID/Password stored in the ESP)
So I tried to connect a wrong network then back to the right network to resend the ESP hostname with DHCP register.
Unfortunately it doesn't work as expected.

I did identify the

Code: Select all

now available in MicroPython sysname='esp8266' release='2.0.0(5a875ba)', version='v1.9.1-8-g7213e78d on 2017-06-12' but cannot get it to push the hostname to the DHCP/DNS server.

Is there an appropriate sequence of instruction to follows ?
Is this depending on my own computer resolve names? (using Linux Mint/Ubuntu/Debian, he resolve properly the name of the other computer on the network).

Any suggestion would be welcome. I'm puzzled.

Posts: 6
Joined: Sat Aug 24, 2019 8:59 am

Re: Change hostname.

Post by GordanTrevis » Thu Sep 12, 2019 2:42 pm

I'm trying to archive similar a few years later.
on ESP32/ESP8266

i tried.
befor or after conecting via wlan.conect returns OSError: TCP/IP IF Not Ready

so how is it possible to add a Cname or hostname?

Post Reply