When enabling ICMP so that "ping" is enable. It is(seems) necessary to disable hardware CRC generation. In that case the choice "software CRC generation" is (seems to be) stuck on "disable" and "ping" does not respond.
It is then necessary to add in lwipopts.h :
/* USER CODE BEGIN 1 */
/*** because of a bug in STM32CubeMX code generator ? ***/
#define CHECKSUM_GEN_ICMP 1
/* USER CODE END 1 */