nat: Include platform specific headers on FreeBSD
[vpp.git] / src / plugins / srv6-as / as_plugin_doc.rst
1 .. _srv6_as_plugin_doc:
2
3 SRv6 static proxy
4 =================
5
6 The document describes SRv6 endpoint to SR-unaware appliance via static
7 proxy (End.AS)
8
9 Overview
10 --------
11
12 The static proxy is an SR endpoint behavior for processing SR-MPLS or
13 SRv6 encapsulated traffic on behalf of an SR-unaware SF. This proxy thus
14 receives SR traffic that is formed of an MPLS label stack or an IPv6
15 header on top of an inner packet, which can be Ethernet, IPv4 or IPv6.
16
17 A static SR proxy segment is associated with the following mandatory
18 parameters:
19
20 -  INNER-TYPE: Inner packet type
21 -  S-ADDR: Ethernet or IP address of the SF (only for inner type IPv4
22    and IPv6)
23 -  IFACE-OUT: Local interface for sending traffic towards the SF
24 -  IFACE-IN: Local interface receiving the traffic coming back from the
25    SF
26 -  CACHE: SR information to be attached on the traffic coming back from
27    the SF, including at least
28
29    -  CACHE.SA: IPv6 source address (SRv6 only)
30    -  CACHE.LIST: Segment list expressed as MPLS labels or IPv6 address
31
32 A static SR proxy segment is thus defined for a specific SF, inner
33 packet type and cached SR information. It is also bound to a pair of
34 directed interfaces on the proxy. These may be both directions of a
35 single interface, or opposite directions of two different interfaces.
36 The latter is recommended in case the SF is to be used as part of a
37 bi-directional SR SC policy. If the proxy and the SF both support
38 802.1Q, IFACE-OUT and IFACE-IN can also represent sub-interfaces.
39
40 The first part of this behavior is triggered when the proxy node
41 receives a packet whose active segment matches a segment associated with
42 the static proxy behavior. It removes the SR information from the packet
43 then sends it on a specific interface towards the associated SF. This SR
44 information corresponds to the full label stack for SR-MPLS or to the
45 encapsulation IPv6 header with any attached extension header in the case
46 of SRv6.
47
48 The second part is an inbound policy attached to the proxy interface
49 receiving the traffic returning from the SF, IFACE-IN. This policy
50 attaches to the incoming traffic the cached SR information associated
51 with the SR proxy segment. If the proxy segment uses the SR-MPLS data
52 plane, CACHE contains a stack of labels to be pushed on top the packets.
53 With the SRv6 data plane, CACHE is defined as a source address, an
54 active segment and an optional SRH (tag, segments left, segment list and
55 metadata). The proxy encapsulates the packets with an IPv6 header that
56 has the source address, the active segment as destination address and
57 the SRH as a routing extension header. After the SR information has been
58 attached, the packets are forwarded according to the active segment,
59 which is represented by the top MPLS label or the IPv6 Destination
60 Address.
61
62 In this scenario, there are no restrictions on the operations that can
63 be performed by the SF on the stream of packets. It may operate at all
64 protocol layers, terminate transport layer connections, generate new
65 packets and initiate transport layer connections. This behavior may also
66 be used to integrate an IPv4-only SF into an SRv6 policy. However, a
67 static SR proxy segment can be used in only one service chain at a time.
68 As opposed to most other segment types, a static SR proxy segment is
69 bound to a unique list of segments, which represents a directed SR SC
70 policy. This is due to the cached SR information being defined in the
71 segment configuration. This limitation only prevents multiple segment
72 lists from using the same static SR proxy segment at the same time, but
73 a single segment list can be shared by any number of traffic flows.
74 Besides, since the returning traffic from the SF is re-classified based
75 on the incoming interface, an interface can be used as receiving
76 interface (IFACE-IN) only for a single SR proxy segment at a time. In
77 the case of a bi-directional SR SC policy, a different SR proxy segment
78 and receiving interface are required for the return direction.
79
80 For more information, please see
81 `draft-xuclad-spring-sr-service-chaining <https://datatracker.ietf.org/doc/draft-xuclad-spring-sr-service-chaining/>`__.
82
83 CLI configuration
84 -----------------
85
86 The following command instantiates a new End.AS segment that sends the
87 inner packets on interface ``IFACE-OUT`` towards an appliance at address
88 ``S-ADDR`` and restores the segment list ``<S1, S2, S3>`` with a source
89 address ``SRC-ADDR`` on the packets coming back on interface
90 ``IFACE-IN``.
91
92 ::
93
94    sr localsid address SID behavior end.as nh S-ADDR oif IFACE-OUT iif IFACE-IN src SRC-ADDR next S1 next S2 next S3
95
96 For example, the below command configures the SID ``1::A1`` with an
97 End.AS function for sending traffic on interface
98 ``GigabitEthernet0/8/0`` to the appliance at address ``A1::``, and
99 receiving it back on interface ``GigabitEthernet0/9/0``.
100
101 ::
102
103    sr localsid address 1::A1 behavior end.as nh A1:: oif GigabitEthernet0/8/0 iif GigabitEthernet0/9/0 src 1:: next 2::20 next 3::30 next 4::40
104
105 Pseudocode
106 ----------
107
108 Static proxy for inner type IPv4
109 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110
111 Upon receiving an IPv6 packet destined for S, where S is an IPv6 static
112 proxy segment for IPv4 traffic, a node N does:
113
114 ::
115
116    IF ENH == 4 THEN                                                ;; Ref1
117        Remove the (outer) IPv6 header and its extension headers
118        Forward the exposed packet on IFACE-OUT towards S-ADDR
119    ELSE
120        Drop the packet
121
122 **Ref1:** 4 refers to IPv4 encapsulation as defined by IANA allocation
123 for Internet Protocol Numbers.
124
125 Upon receiving a non link-local IPv4 packet on IFACE-IN, a node N does:
126
127 ::
128
129    Decrement TTL and update checksum
130    IF CACHE.SRH THEN                                               ;; Ref2
131        Push CACHE.SRH on top of the existing IPv4 header
132        Set NH value of the pushed SRH to 4
133    Push outer IPv6 header with SA, DA and traffic class from CACHE
134    Set outer payload length and flow label
135    Set NH value to 43 if an SRH was added, or 4 otherwise
136    Lookup outer DA in appropriate table and proceed accordingly
137
138 **Ref2:** CACHE.SRH represents the SRH defined in CACHE, if any, for the
139 static SR proxy segment associated with IFACE-IN.
140
141 Static proxy for inner type IPv6
142 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143
144 Upon receiving an IPv6 packet destined for S, where S is an IPv6 static
145 proxy segment for IPv6 traffic, a node N does:
146
147 ::
148
149    IF ENH == 41 THEN                                               ;; Ref1
150        Remove the (outer) IPv6 header and its extension headers
151        Forward the exposed packet on IFACE-OUT towards S-ADDR
152    ELSE
153        Drop the packet
154
155 **Ref1:** 41 refers to IPv6 encapsulation as defined by IANA allocation
156 for Internet Protocol Numbers.
157
158 Upon receiving a non-link-local IPv6 packet on IFACE-IN, a node N does:
159
160 ::
161
162    Decrement Hop Limit
163    IF CACHE.SRH THEN                                               ;; Ref2
164        Push CACHE.SRH on top of the existing IPv6 header
165        Set NH value of the pushed SRH to 41
166    Push outer IPv6 header with SA, DA and traffic class from CACHE
167    Set outer payload length and flow label
168    Set NH value to 43 if an SRH was added, or 41 otherwise
169    Lookup outer DA in appropriate table and proceed accordingly
170
171 **Ref2:** CACHE.SRH represents the SRH defined in CACHE, if any, for the
172 static SR proxy segment associated with IFACE-IN.