cancel
Showing results for 
Search instead for 
Did you mean: 

mDNS on LWIP TCP server

jaykay
Associate

I'm tying to setup TCP server using ethernet communications (Nucleo-F767ZI) and find that I can ping the board using the router allocated IP address but I'd like to do the same using Hostname. In STM32CubeMx .ioc file, under Network Interface Options, LWIP_ENABLE_NETIF_HOSTNAME is set to 'enable' and I've set the host name I want to use in LWIP_NETIF_HOSTNAME to 'my_lwip'. However, I still find that I cannot ping the board using the hostname. I know my router DNS is working Ok because I can ping a Raspberry Pi using it's host name.

I realize that in STM32CubeMX generated lwipopts.h #define LWIP_NETIF_HOSTNAME is set to my_lwip by default but I change this to 1 manually. Otherwise, in ethernetif.c, the statement netif ->hostname - "my_lwip" is not enabled.

I think mDNS has to be enabled in LwIP. However, under MDNS/TFTP tab in CubeMX, LWIP_MDNS is always disabled and there is no enable option in the drop-down list.  I've seen a post that suggests to enable LWIP_MDNS, LWIP_UDP and LWIP_IPV4_IGMP have to be enabled.  However, I find that LWIP_IPV4_IGMP has the same issue i.e. no enable option in the drop-down list.   Has anybody successfully enabled mDNS? Thanks.

 

 

1 REPLY 1
STea
ST Employee

Hello @jaykay ,

In order to make this work here are the steps you should follow:

Make sure to display the help for each LWIP option in CubeMX, using the round "i" button, and note that in some panels there is a "Show advanced parameters" checkbox which may need to be activated in case the required parameter is hidden by default.

To enable mDNS: * Under key options, enable LWIP_MULTICAST_TX_OPTIONS *

Under general settings, enable LWIP_IGMP *

Now in the mDNS/TFTP tab, it should be possible to enable mDNS It may be necessary to also show the advanced options in the mDNS tab and enable LWIP_MDNS_RESPONDER.
note that IGMP flag doesn't get set directly from MX and should be done manually in previous version of MX and it will be fixed in upcoming revisions.
you will find attached the IOC file with proper configuration for mDNS.
Regards 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.