(See the README.md file in the upper level 'examples' directory for more information about examples.)
The application first finds a network interface with an IPv6 address of**Global**or**Unique Local**type.
The application then creates a raw ICMPv6 socket and sends an ICMPv6 Echo Request to the destination ipv6 address, with the ipv6 address previously found over the interface as the source address. The application keeps waiting for an echo reply from the target destination.
## Hardware Required
This example can be run on any commonly available ESP32 development board.
## How to use example
### Build and execute for **ESP32** targets:
Set the target as:
```sh
idf.py set-target esp32
```
#### Configure the project:
Set the following parameters under "***Example Connection Configuration***" Options:
* Set `WiFi SSID` of your IPv6 enabled WiFi network.
Ensure the WiFi network supports SLAAC.
* Set `WiFi Password` of the selected Wifi network.
* Press '**`Esc`**' to go to the previous menu.
Set the following parameters under "***Example Configuration***" Options:
* Set the '**Destination IPV6 Address**' for the ICMPv6 ping example.
**Destination IPV6 Address** can also be set manually by modifying the source file `icmpv6_ping.c`.
* Press '**`s`**' to save and '**`q`**' to quit the menu.
#### Build and execute as follows:
```sh
idf.py build
idf.py flash monitor -p <COMPORT>
```
The output of the execution should be as follows:
```sh
I (7668) ICMPv6_PING: Interface: st1
I (7668) ICMPv6_PING: IPv6 address: fe80:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (7678) ICMPv6_PING: IPv6 address: 2001:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx, type: ESP_IP6_ADDR_IS_GLOBAL
I (7688) ICMPv6_PING: Source address: 2001:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
I (7698) ICMPv6_PING: Destination address: 2001:xxxx::xxxx:xxxx:xxxx:xxxx
According to [RFC 2460 section 8.1](https://datatracker.ietf.org/doc/html/rfc2460#section-8.1), any transport or other upper-layer protocol that includes the
addresses from the IP header in its checksum computation must be modified for use over IPv6, to include the 128-bit IPv6 addresses instead of 32-bit IPv4 addresses.
ICMPv6 is one of such protocols, and the responsibility of checksum calculation is supposed to be part of the ICMPv6 header building process.
But LWIP does this for the user. LWIP expects the checksum field to be set to zero by the user, and it calculates and sets the ICMPv6 checksum value before transmitting the packet.