Hostname of ESP?

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
yellowsky
Normal user
Posts: 30
Joined: 10 Dec 2016, 20:09

Hostname of ESP?

#1 Post by yellowsky » 26 Dec 2017, 15:06

Hi everyone, i would like to know if it exists any way to reach a esp with espeasy software by http protocol with a hostname instead of ip.

Currently i need to hit the following url http://someip/ to get the web configuration page. But i would like to try to reach http://hostname/ to avoid an issue if the esp changes its ip
I already try to reach http://name_of_esp without results.

Of course i could defined a fixed ip but if another computer try this ip on a network , none of them could be reach due to network problem.

Thank you.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden

Re: Hostname of ESP?

#2 Post by grovkillen » 26 Dec 2017, 17:20

Not a problem to connect to host name. What is your ESP Easy version?

I run 2.0.0 (dev12)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Hostname of ESP?

#3 Post by vader » 26 Dec 2017, 17:24

Host name is unit name '-' unit number!

Eg.
unit name = ESP01
unit # = 1

Host name: ESP01-1

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden

Re: Hostname of ESP?

#4 Post by grovkillen » 26 Dec 2017, 17:29

vader wrote: 26 Dec 2017, 17:24 Host name is unit name '-' unit number!

Eg.
unit name = ESP01
unit # = 1

Host name: ESP01-1
"_" is the correct character:

Code: Select all

unit name = ESP01
unit # = 1

Host name: ESP01_1
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

yellowsky
Normal user
Posts: 30
Joined: 10 Dec 2016, 20:09

Re: Hostname of ESP?

#5 Post by yellowsky » 26 Dec 2017, 17:40

My name is ESP and the unit number is 1 the version of ESP easy is dev12 (v2.0.0-dev12)

When i type in firefox or internet explorer

http://ESP_1 (or http://ESP-1)

No configuration page is provided (in the case of firefox, it forward to http://www.esp_1.com/ (i guess it tries to adapt the request).

I'm using Windows 10 64 bits

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Hostname of ESP?

#6 Post by Shardan » 26 Dec 2017, 18:08

Yes, that is possible but it comes with some work.

At first, this is not a problem of ESPEasy.
If you look into the network interface config of your computer you will notice a setting "DNS" possibly together with an IP address.

DNS (the "Domain Name Service") is the service who translates a domain name "www.whatever.xyz" into an IP address for you.
Every country has an authority that allocates an IP to your comain name. They run the main DNS server of the "Top Level Domain".
Top Level Domains are the third part of the domain name, for example .com, .de, .net, .org and so on. The DNS server of your provider
is a sub-server of this main server. If your router has it's own DNS server, this is s subserver of your providers DNS server.
So if you enter "www.abc.xyz" at your browser, your browser asks the DNS configured in your settings for the IP. That DNS may know
the IP address already. If not, he will ask the server of your provider and so on.

So everything depends on what is configured in your home network. If you use an external DNS from your provider, or the "8.8.8.8"
DNS from Google, name resolution is not possible as your home isn't an official domain registered by your countries domain authority.
Usually it is not even possible to get an official IP for your home domain as you will use the 192.168.x.y or other non-routing addresses
like 172.16.x.y or 10.x.y.z. These addresses are for internal use and will not be routed through the net.

If your router provides an internal DNS and your computer is configured to use that DNS instead of an external one, you may check your
router configuration if it is possible to set internal addresses and names. If your router is really good it might be able to handle this
even automatically.

There is a third way: Use a small computer, an Raspberry Pi for example and leave the automatic IP adress configuration (DHCP)
and DNS to this one, deactivating all these services in your router.
But be warned: Setting up a full DNS/DHCP with dynamic DNS configuration is definitely not trivial. This way gives a lot of possibilities
a usual home router can't give but many possibilities on the other hand always says many possibilities to go wrong. It needs some
knowledge about IP itself, the BIND DNS server, ISC DHCP and generating encryption certificates to configure that.

Regards
Shardan
Regards
Shardan

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Hostname of ESP?

#7 Post by vader » 26 Dec 2017, 18:21

Can you ping the device from your windows system?

ping esp_1 (or http://esp_1)

What is the answer?

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Hostname of ESP?

#8 Post by vader » 27 Dec 2017, 20:24

@grovkillen: What you mean is SSID. That is with "_". But SSID is not host name.
See source code:

SSID:
String ssid(Settings.Name);
ssid+=F("_");
ssid+=Settings.Unit;
return (ssid);

Host name:
String hostname(WifiGetAPssid());
hostname.replace(F(" "), F("-"));
return (hostname);

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden

Re: Hostname of ESP?

#9 Post by grovkillen » 27 Dec 2017, 20:25

vader wrote: 27 Dec 2017, 20:24 @grovkillen: What you mean is SSID. That is with "_". But SSID is not host name.
See source code:

SSID:
String ssid(Settings.Name);
ssid+=F("_");
ssid+=Settings.Unit;
return (ssid);

Host name:
String hostname(WifiGetAPssid());
hostname.replace(F(" "), F("-"));
return (hostname);
Weird, I connect to my units using the hostname with "_" as separator...?

EDIT: aaaah, any spaces are replaced with "-"! The separator between name and number is still "_".
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Hostname of ESP?

#10 Post by Shardan » 27 Dec 2017, 20:55

yellowsky wrote: 26 Dec 2017, 15:06
Of course i could defined a fixed ip but if another computer try this ip on a network , none of them could be reach due to network problem.

Thank you.
In this case your router has a DHCP service running that gives your devices an IP address.
Check router configuration, it should be possible to limit the address range.

For example if your router works in a network of 192.168.1.xxx limit the range from 192.168.1.50 to 192.168.1.150.
All Adresses from 192.168.1.151 to 192.168.1.254 can be used for devices with fixed IP without running into address collisions,

Regards
Shardan
Regards
Shardan

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Hostname of ESP?

#11 Post by vader » 27 Dec 2017, 21:44

@grovkillen: Sure? I have made a test with a fresh installation (2.0.0-dev12). Only AP configured! And see what Linux means to the host name: :mrgreen:
You do not have the required permissions to view the files attached to this post.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden

Re: Hostname of ESP?

#12 Post by grovkillen » 27 Dec 2017, 21:57

Have you tried "esp-easy_0"?

Mine work:
You do not have the required permissions to view the files attached to this post.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Hostname of ESP?

#13 Post by Shardan » 27 Dec 2017, 23:16

vader wrote: 27 Dec 2017, 21:44 @grovkillen: Sure? I have made a test with a fresh installation (2.0.0-dev12). Only AP configured! And see what Linux means to the host name: :mrgreen:
The fritz.box uses a DHCP which feeds the name automatically to DNS (so called "Dynamic DNS"). You may notice from the name "<name>.fritz.box"
So if you enter a "Ping <hostname>" the DNS inside the Fritz.Box automatically resolves the given URL to the IP address.

Obviously the router of the thread opener can't do dynamic DNS or it is not configured.
Regards
Shardan

yellowsky
Normal user
Posts: 30
Joined: 10 Dec 2016, 20:09

Re: Hostname of ESP?

#14 Post by yellowsky » 28 Dec 2017, 09:04

pinging host name is unknow.

For the recommandation of the DHCP list between 1 and 150, i is ok but if someone add the same ip of ESP, it could happen a network conflict and in this case none of the devices are reachable.

On my side i have an old router Cisco

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Hostname of ESP?

#15 Post by Shardan » 28 Dec 2017, 10:37

yellowsky wrote: 28 Dec 2017, 09:04 pinging host name is unknow.

For the recommandation of the DHCP list between 1 and 150, i is ok but if someone add the same ip of ESP, it could happen a network conflict and in this case none of the devices are reachable.

On my side i have an old router Cisco
"Hostname unknown" says that the name can't be resolved to an IP address by the DNS you use.
Take a look at my first post in this thread, this is solveable, but it needs some work.

The DHCP server gives addresses between 1..150. If you assign adresses manually from 151 upwards a collision is unlikely. Or are several people giving addresses to ESPs? That might indeed run into problems.

I can't say much about cisco routers, i don't know them.

Regards
Shardan
Regards
Shardan

Who is online

Users browsing this forum: Anthropic Claude Bot [bot], Bing [Bot] and 12 guests