Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Espressif ESP32 Core 3.1.1 Why ping by name is Ko ? #11133

Closed Unanswered
Duglof asked this question in Q&A
Discussion options

My environment:
Arduino IDE V1.8.19
Preferences : https://arduino.esp8266.com/stable/package_esp8266com_index.json,https://espressif.github.io/arduino-esp32/package_esp32_index.json
Library esp32 by Espressif Systems v3.1.1

Test code :

 #include <WiFi.h>
// Replace with your network credentials (STATION)
// const char* ssid = "REPLACE_WITH_YOUR_SSID";
// const char* password = "REPLACE_WITH_YOUR_PASSWORD";
String hostname = "ESP32TEMP";
void initWiFi() {
 WiFi.setHostname(hostname.c_str()); //define hostname
 
 WiFi.mode(WIFI_STA);
 
 WiFi.begin(ssid, password);
 Serial.print("Connecting to WiFi ..");
 while (WiFi.status() != WL_CONNECTED) {
 Serial.print('.');
 delay(1000);
 }
 Serial.println(WiFi.localIP());
}
void setup() {
 Serial.begin(115200);
 initWiFi();
 Serial.print("RSSI: ");
 Serial.println(WiFi.RSSI());
}
void loop() {
 // put your main code here, to run repeatedly:
 delay(1000);
 Serial.print(WiFi.getHostname());
 Serial.println(" Ok");
} 

Arduino Monitor :

ESP32TEMP Ok
ESP32TEMP Ok
...

A scan network with nmap

nmap -sL 192.168.1.*
Nmap scan report for ESP32TEMP (192.168.1.87)

Connection to WiFi : Ok
Ping by IP : Ok
ping 192.168.1.87
PING 192.168.1.87 (192.168.1.87) 56(84) bytes of data.
64 bytes from 192.168.1.87: icmp_seq=1 ttl=64 time=146 ms

Ping by hostname : Ko
ping ESP32TEMP
ping: ESP32TEMP: Nom ou service inconnu (english : Name or service unknown)

I can't find any solution to my problem. Thank you in advance.

You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

Verbose debug at startup ...

ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4916
load:0x40078000,len:16436
load:0x40080400,len:4
ho 8 tail 4 room 4
load:0x40080404,len:3524
entry 0x400805b8
[ 1][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x400d983c
[ 12][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x400d980c
[ 26][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x400d97dc
[ 39][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x400d97ac
[ 53][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x400d983c
[ 66][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x400d980c
[ 80][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x400d97dc
[ 93][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x400d97ac
[ 107][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x400d983c
[ 120][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x400d980c
[ 134][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x400d97dc
[ 147][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x400d97ac
[ 187][D][esp32-hal-cpu.c:263] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[ 224][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 3 successfully set to type UART_RX (2) with bus 0x3ffbdb74
[ 235][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 1 successfully set to type UART_TX (3) with bus 0x3ffbdb74
=========== Before Setup Start ===========
Chip Info:
------------------------------------------
 Model : ESP32
 Package : D0WD-Q5
 Revision : 3.01
 Cores : 2
 CPU Frequency : 240 MHz
 XTAL Frequency : 40 MHz
 Features Bitfield : 0x00000032
 Embedded Flash : No
 Embedded PSRAM : No
 2.4GHz WiFi : Yes
 Classic BT : Yes
 BT Low Energy : Yes
 IEEE 802.15.4 : No
------------------------------------------
INTERNAL Memory Info:
------------------------------------------
 Total Size : 336808 B ( 328.9 KB)
 Free Bytes : 296580 B ( 289.6 KB)
 Allocated Bytes : 32964 B ( 32.2 KB)
 Minimum Free Bytes: 290708 B ( 283.9 KB)
 Largest Free Block: 110580 B ( 108.0 KB)
------------------------------------------
Flash Info:
------------------------------------------
 Chip Size : 4194304 B (4 MB)
 Block Size : 65536 B ( 64.0 KB)
 Sector Size : 4096 B ( 4.0 KB)
 Page Size : 256 B ( 0.2 KB)
 Bus Speed : 80 MHz
 Bus Mode : QIO
------------------------------------------
Partitions Info:
------------------------------------------
 nvs : addr: 0x00009000, size: 20.0 KB, type: DATA, subtype: NVS
 otadata : addr: 0x0000E000, size: 8.0 KB, type: DATA, subtype: OTA
 app0 : addr: 0x00010000, size: 1280.0 KB, type: APP, subtype: OTA_0
 app1 : addr: 0x00150000, size: 1280.0 KB, type: APP, subtype: OTA_1
 spiffs : addr: 0x00290000, size: 1408.0 KB, type: DATA, subtype: SPIFFS
 coredump : addr: 0x003F0000, size: 64.0 KB, type: DATA, subtype: COREDUMP
------------------------------------------
Software Info:
------------------------------------------
 Compile Date/Time : Mar 17 2025 15:30:11
 Compile Host OS : linux
 ESP-IDF Version : v5.3.2-282-gcfea4f7c98-dirty
 Arduino Version : 3.1.1
------------------------------------------
Board Info:
------------------------------------------
 Arduino Board : ESP32_WROOM_DA
 Arduino Variant : esp32da
 Arduino FQBN : esp32:esp32:esp32da:PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,LoopCore=1,EventsCore=1,DebugLevel=verbose,EraseFlash=none
============ Before Setup End ============
[ 741][V][esp32-hal-uart.c:421] uartBegin(): UART0 baud(115200) Mode(800001c) rxPin(3) txPin(1)
[ 750][V][esp32-hal-uart.c:510] uartBegin(): UART0 not installed. Starting installation
[ 761][V][esp32-hal-uart.c:575] uartBegin(): UART0 initialization done.
[ 795][V][NetworkEvents.cpp:113] _checkForEvent(): Network Event: 101 - WIFI_READY
[ 955][I][WiFiGeneric.cpp:799] setDualAntennaConfig(): TX Antenna will be automatically selected
[ 956][V][STA.cpp:186] _onStaEvent(): STA Started
[ 968][V][NetworkEvents.cpp:113] _checkForEvent(): Network Event: 110 - STA_START
[ 976][V][STA.cpp:110] _onStaArduinoEvent(): Arduino STA Event: 110 - STA_START
Connecting to WiFi ...[ 1034][V][STA.cpp:206] _onStaEvent(): STA Connected: SSID: SFR_A760, BSSID: cc:2d:1b:73:a7:66, Channel: 1, Auth: WPA_WPA2_PSK
[ 1046][V][NetworkEvents.cpp:113] _checkForEvent(): Network Event: 112 - STA_CONNECTED
[ 1054][V][STA.cpp:110] _onStaArduinoEvent(): Arduino STA Event: 112 - STA_CONNECTED
[ 1554][V][NetworkInterface.cpp:78] _onIpEvent(): sta Got New IP: 192.168.1.87 MASK: 255.255.255.0 GW: 192.168.1.1
[ 1565][V][NetworkEvents.cpp:113] _checkForEvent(): Network Event: 115 - STA_GOT_IP
[ 1572][V][STA.cpp:110] _onStaArduinoEvent(): Arduino STA Event: 115 - STA_GOT_IP
[ 1579][V][STA.cpp:171] _onStaArduinoEvent(): STA IP: 192.168.1.87, MASK: 255.255.255.0, GW: 192.168.1.1
192.168.1.87
RRSI: -45
=========== After Setup Start ============
INTERNAL Memory Info:
------------------------------------------
 Total Size : 336808 B ( 328.9 KB)
 Free Bytes : 245364 B ( 239.6 KB)
 Allocated Bytes : 81420 B ( 79.5 KB)
 Minimum Free Bytes: 242896 B ( 237.2 KB)
 Largest Free Block: 110580 B ( 108.0 KB)
------------------------------------------
GPIO Info:
------------------------------------------
 GPIO : BUS_TYPE[bus/unit][chan]
 -------------------------------------- 
 1 : UART_TX[0]
 3 : UART_RX[0]
============ After Setup End =============
ESP32TEMP Ok
ESP32TEMP Ok
ESP32TEMP Ok
...
You must be logged in to vote
1 reply
Comment options

This is a different hostname. One that is reported to the DHCP server, not one that you can ping.

  • For Windows you needs NBNS (ping ESP32TEMP)
  • For Mac and Linux you need MDNS (ping ESP32TEMP.local)
#include "NetBIOS.h"
#include "ESPmDNS.h"
 #include <WiFi.h>
// Replace with your network credentials (STATION)
// const char* ssid = "REPLACE_WITH_YOUR_SSID";
// const char* password = "REPLACE_WITH_YOUR_PASSWORD";
String hostname = "ESP32TEMP";
void initWiFi() {
 WiFi.setHostname(hostname.c_str()); //define hostname
 
 WiFi.mode(WIFI_STA);
 
 WiFi.begin(ssid, password);
 Serial.print("Connecting to WiFi ..");
 while (WiFi.status() != WL_CONNECTED) {
 Serial.print('.');
 delay(1000);
 }
 Serial.println(WiFi.localIP());
}
void setup() {
 Serial.begin(115200);
 initWiFi();
 Serial.print("RSSI: ");
 Serial.println(WiFi.RSSI());
 NBNS.begin(hostname.c_str());
 MDNS.begin(hostname.c_str());
}
void loop() {
 // put your main code here, to run repeatedly:
 delay(1000);
 Serial.print(WiFi.getHostname());
 Serial.println(" Ok");
} 
Comment options

Thanks for your answer. Response to ping is Ok now.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /