# Adding IPv6 header for INT

**URL:** <https://forum.p4.org/t/adding-ipv6-header-for-int/159>\
**Category:** Getting Started with P4\
**Created:** [October 28, 2021, 11:03am UTC](https://forum.p4.org/t/adding-ipv6-header-for-int/159 "2021-10-28T11:03:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![akshara](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@akshara](https://forum.p4.org/u/akshara)\
**Post date:** [October 28, 2021, 11:03am UTC](https://forum.p4.org/t/adding-ipv6-header-for-int/159/1 "2021-10-28T11:03:17Z")

</div>

I wish to use IPv6 as a header for inband-network telemetry, can I get some suggestion on how to proceed from scratch?

---

<div class="post-metadata">

**Author:** ![ederollora](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/ederollora/32/21_2.png) [@ederollora](https://forum.p4.org/u/ederollora)\
**Post date:** [October 28, 2021, 1:22pm UTC](https://forum.p4.org/t/adding-ipv6-header-for-int/159/2 "2021-10-28T13:22:52Z")

</div>

Hi!

I think you should be a little more specific about IPv6. In principle, there is no difference on having IPv4 or IPv6 as a L3 protocol to carry INT. Would you mind explaining which parts do you need suggestions about? For instance:

- Suggestions about the P4 code or implementations working?
- Is it about how to indicate the presence of INT in IPv6 headers (compared to a new UDP header, a 64-bit marker, etc.)?
- Is it about which prototyping tools to use? (like BMv2 and Mininet)
- Is it about how to add IPv6 for the collector encapsulation? (i.e., deparsing a new header)

Cheers,

---

<div class="post-metadata">

**Author:** ![akshara](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@akshara](https://forum.p4.org/u/akshara)\
**Post date:** [November 10, 2021, 10:39am UTC](https://forum.p4.org/t/adding-ipv6-header-for-int/159/3 "2021-11-10T10:39:59Z")

</div>

Hi Sir,  
We wish to use P4 and implement the presence of INT in IPv6 headers as well as how to add IPv6 for collector encapsulation, we require your urgent guidance for our project.  
Thank you.

---

<div class="post-metadata">

**Author:** ![ederollora](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/ederollora/32/21_2.png) [@ederollora](https://forum.p4.org/u/ederollora)\
**Post date:** [November 16, 2021, 10:58am UTC](https://forum.p4.org/t/adding-ipv6-header-for-int/159/4 "2021-11-16T10:58:22Z")

</div>

Hi!

Sorry for the late response, but I could not access the forum these weeks. Let me answer your questions.

> We wish to use P4 and implement the presence of INT in IPv6 headers

If you take a look at [this documen](https://p4.org/p4-spec/docs/INT_v2_1.pdf)t, you will see the INT data plane specification. In the current release, there are multiple ways to include INT header in IPv6 packets. The one I always use is “IN T over TCP/UDP” (I hope that this is the type of traffic you also use) modifying IPv4 DSCP (normally value 0x17) to indicate the presence of INT. For IPv6, you can use a similar value in the Traffic Class field. See here:

![image](https://us1.discourse-cdn.com/flex019/uploads/p4/original/1X/21ac5884391b6080c7072b377c33e8ac403e131f.png)

If you don’t like this method, you can also use the new UDP header method (using the port as an indicator) or, alternatively, a probe marker (see page 15 and on).

> how to add IPv6 for collector encapsulation

Well, this could be a very long answer, but I will try to be short. The way that I have done encapsulation for INT is by setting invalid the original packet’s headers (this is usually a cloned packet using `clone(CloneType.I2E, REPORT_MIRROR_SESSION_ID)`). Then I generate (i.e., setting valid) the report headers, which are normally Ethernet, IPv6 (in your case) and UDP. You might also want to set valid the INT report header that comes after UDP (if you want to be close to the specification for INT reports, check page 9 and on [here](https://p4.org/p4-spec/docs/telemetry_report_v2_0.pdf)).

Hope that helps, but ask anything else if you need to.

Cheers,
