-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Set hostname for Ethernet router configuration? #554
Comments
I think you are additionally confusing L2 with L3. The What you are looking at is the L2 wired connection through ethernet or USB, which I don't think has anything to do with the IP/DNS hostname. |
If you want a nice name for your ESP hostname, you need to run a local DNS proxy (and deliver the DNS proxy IP via the DHCP conf to your PC) which resolves whatever name you select for your ESP as its IP, but further forwards all other DNS requests to the actual DNS server (1.1.1.1, 8.8.8.8 etc.). Difficult. Or.... you can run mDNS, and then you can get your hostname as |
Huh, I thought the dhcp hostname option was sent over when the handshake is happening. So you're saying mDNS is the solution here. Seems right to me. But iirc in #529 we established there was a problem when ethernet is in router mode.. I'm not too hung up over this though. If it doesn't work it's fine, as it doesn't impact functionality at all. It's purely cosmetic. |
You can still fix the mDNS issue if you want though - comment here: #529 (comment) This you need to patch:
|
Right yeah, that's what I have currently: let mut eth_netif = EspEth::wrap_all(
eth_driver,
EspNetif::new_with_conf(&NetifConfiguration {
flags: 0,
key: "ETH_DEF".try_into().unwrap(),
description: "eth".try_into().unwrap(),
route_priority: 10,
ip_configuration: Some(Configuration::Router(RouterConfiguration {
subnet: Subnet {
gateway: ETH_GATEWAY,
mask: Mask(30),
},
dhcp_enabled: true, // adds dhcp_server flag
dns: None,
secondary_dns: None,
})),
stack: NetifStack::Eth,
custom_mac: None,
got_ip_event_id: None,
lost_ip_event_id: None,
})?,
)?; I think I had tried at the time to do this and it didn't work so I gave up, but my memory's fuzzy on this. Might try again in a bit. |
Ok so I took the time to recompile everything properly. The ethernet code is the one pasted above, I added those lines afterward (mdns is kept in scope after this, never dropped.) let mut mdns = EspMdns::take()?;
mdns.set_hostname("charizhard")?; I also added this line to kconfig Wireshark is not seeing any answers to my mdns requests. My suspicion at this point is that this The way i'm doing it is by simply adding the line at the end of the |
Hi, is there a way to set a hostname so that the computer the esp is connected to gets that hostname attributed on the wired connection? I saw this function
But its wrapped version isn't public..
And unless I'm mistaken, the
new_with_conf
function never sets a hostname if the configuration is in router mode. Why is that?I also tried calling the function directly, just before starting the netif, but it didn't seem to work.
The program runs fine, but the name hasn't changed. I get a generic "Network 5" wired connection name on my computer.
The text was updated successfully, but these errors were encountered: