docs: convert plugins doc md->rst
[vpp.git] / src / plugins / srv6-am / am_plugin_doc.rst
1 .. _srv6_am_plugin_doc:
2
3 SRv6 masquerading
4 =================
5
6 SRv6 endpoint to SR-unaware appliance via masquerading (End.AM)
7 ---------------------------------------------------------------
8
9 The masquerading proxy is an SR endpoint behavior for processing SRv6
10 traffic on behalf of an SR-unaware SF. This proxy thus receives SR
11 traffic that is formed of an IPv6 header and an SRH on top of an inner
12 payload. The masquerading behavior is independent from the inner payload
13 type. Hence, the inner payload can be of any type but it is usually
14 expected to be a transport layer packet, such as TCP or UDP.
15
16 A masquerading SR proxy segment is associated with the following
17 mandatory parameters:
18
19 -  S-ADDR: Ethernet or IPv6 address of the SF
20 -  IFACE-OUT: Local interface for sending traffic towards the SF
21 -  IFACE-IN: Local interface receiving the traffic coming back from the
22    SF
23
24 A masquerading SR proxy segment is thus defined for a specific SF and
25 bound to a pair of directed interfaces or sub-interfaces on the proxy.
26 As opposed to the static and dynamic SR proxies, a masquerading segment
27 can be present at the same time in any number of SR SC policies and the
28 same interfaces can be bound to multiple masquerading proxy segments.
29 The only restriction is that a masquerading proxy segment cannot be the
30 last segment in an SR SC policy.
31
32 The first part of the masquerading behavior is triggered when the proxy
33 node receives an IPv6 packet whose Destination Address matches a
34 masquerading proxy segment. The proxy inspects the IPv6 extension
35 headers and substitutes the Destination Address with the last segment in
36 the SRH attached to the IPv6 header, which represents the final
37 destination of the IPv6 packet. The packet is then sent out towards the
38 SF.
39
40 The SF receives an IPv6 packet whose source and destination addresses
41 are respectively the original source and final destination. It does not
42 attempt to inspect the SRH, as RFC8200 specifies that routing extension
43 headers are not examined or processed by transit nodes. Instead, the SF
44 simply forwards the packet based on its current Destination Address. In
45 this scenario, we assume that the SF can only inspect, drop or perform
46 limited changes to the packets. For example, Intrusion Detection
47 Systems, Deep Packet Inspectors and non-NAT Firewalls are among the SFs
48 that can be supported by a masquerading SR proxy.
49
50 The second part of the masquerading behavior, also called de-
51 masquerading, is an inbound policy attached to the proxy interface
52 receiving the traffic returning from the SF, IFACE-IN. This policy
53 inspects the incoming traffic and triggers a regular SRv6 endpoint
54 processing (End) on any IPv6 packet that contains an SRH. This
55 processing occurs before any lookup on the packet Destination Address is
56 performed and it is sufficient to restore the right active segment as
57 the Destination Address of the IPv6 packet.
58
59 For more information, please see
60 `draft-xuclad-spring-sr-service-chaining <https://datatracker.ietf.org/doc/draft-xuclad-spring-sr-service-chaining/>`__.
61
62 CLI configuration
63 ~~~~~~~~~~~~~~~~~
64
65 The following command instantiates a new End.AM segment that sends
66 masqueraded traffic on interface ``IFACE-OUT`` towards an appliance at
67 address ``S-ADDR`` and restores the active segment in the IPv6 header of
68 the packets coming back on interface ``IFACE-IN``.
69
70 ::
71
72    sr localsid address SID behavior end.am nh S-ADDR oif IFACE-OUT iif IFACE-IN
73
74 For example, the below command configures the SID ``1::A1`` with an
75 End.AM function for sending traffic on interface
76 ``GigabitEthernet0/8/0`` to the appliance at address ``A1::``, and
77 receiving it back on interface ``GigabitEthernet0/9/0``.
78
79 ::
80
81    sr localsid address 1::A1 behavior end.am nh A1:: oif GigabitEthernet0/8/0 iif GigabitEthernet0/9/0
82
83 Pseudocode
84 ~~~~~~~~~~
85
86 Masquerading
87 ^^^^^^^^^^^^
88
89 Upon receiving a packet destined for S, where S is an IPv6 masquerading
90 proxy segment, a node N processes it as follows.
91
92 ::
93
94    IF NH=SRH & SL > 0 THEN
95        Update the IPv6 DA with SRH[0]
96        Forward the packet on IFACE-OUT
97    ELSE
98        Drop the packet
99
100 De-masquerading
101 ^^^^^^^^^^^^^^^
102
103 Upon receiving a non-link-local IPv6 packet on IFACE-IN, a node N
104 processes it as follows.
105
106 ::
107
108    IF NH=SRH & SL > 0 THEN
109        Decrement SL
110        Update the IPv6 DA with SRH[SL]                             ;; Ref1
111        Lookup DA in appropriate table and proceed accordingly
112
113 **Ref1:** This pseudocode can be augmented to support the Penultimate
114 Segment Popping (PSP) endpoint flavor. The exact pseudocode modification
115 are provided in
116 `draft-filsfils-spring-srv6-network-programming <https://datatracker.ietf.org/doc/draft-filsfils-spring-srv6-network-programming/>`__.