In IPv4 option field one field option is source routing option this means packet will always be routed by router Or not. Packet can also be routed by source such routing is known as source routing. Based on this routing are two types strict source routing and loose source routing. If the packets are strictly following the path that is specified by the source, known as strict source routing.

My question is how is it possible to maintain strict route in in spite of connectionless IPv4?

And flow label in IPv6 avoid reordering of data packets and maintain sequential flow of packets. How the connectionless is also happening here ?

It seems both cases are connection oriented. Please help..

2 Answers 2


About source routing:

What does connectionless or stateless mean?

Each packet has a destination address. Each time a router sees a packet it considers only this particular packet. It looks up the address in its forwarding table and forwards the packet accordingly. This packet does not change anything on the router. In a statefull mode a packet could change router's state, which would in turn affect forwarding of subsequent packets.

In the case of source routing instead of having only one destination address, the packet contains a list of addresses. They are effectively routed one after another. The router treats the packet the same, it takes "current" destination and routes to it. When the packet reaches the "current" destination, next destination on the list becomes current and the packet is routed again. This does not change internal state of any router.

In other words: It is stateless because every packet still contains the full list. If you were to insert the list in only one packet and then have the router remember it and use it for subsequent packets, then it would not be stateless.

About flow label:

With regards to what is written in the rest of the sentence:

This is the case where theory does not exactly work. You have to design layer 3 while considering properties of layer 4. The layer 4 problem: reordering affects TCP's performance. TCP will correctly deal with reordered packets and restore the original stream. However congestion control will kick in erroneously and bandwidth will sink (I believe it is better now). Congestion control will kick in after 3 duplicate ACKs which will happen if 3 (4?) packets are reordered.

Now a router can have several next hops for the same destination (I will call them entries). In this case the router will choose one entry and forward packet accordingly. Classical example is called ECMP(Equal-cost multi-path routing (ECMP) is a routing strategy where packet forwarding to a single destination can occur over multiple best paths with equal routing priority/cost). It is used for load balancing - distribute traffic evenly between several paths (each entry corresponds to a path). In theory you should be able to decide for each packet individually which entry to choose. But if you send different packets of the same TCP flow over different paths they will come reordered. As I said it is highly desirable to avoid this situation. How this could be done?

You take values of several fields in the packet which could identify such a flow (called flow identifier). You compute a hash of these values. The resulting hash is a number between one and "number of entries" and you select the entry with this number. This is still stateless. In IPv4 we usually use 5-tuple flow identifier <source ip, destination ip, protocol, source port, destination port>. Yes this does mean that the router needs to look into TCP header. In IPv6, in order to avoid this, end system puts some meaningful (to it) identifier of a flow in flow label. An the flow identifier becomes <source ip, destination ip, next header, flow label>.

Similar shenanigan happens in your network card when it distributes arriving packets between CPU cores.

Regarding flow label in general:

There are other situations when you would want to identify several packets of the same flow. Most of them are in Quality of Service. In this case the forwarding is not necessarily stateless.

  • Lot of grammatical error.. Please correct this..
    – S. M.
    Sep 8, 2021 at 3:17
  • should be a little bit better now, but it is the best i can do, sorry
    – Effie
    Sep 8, 2021 at 11:15
  • "<src ip, dst ip, proto, src port, dst port> " here 'proto' means port number?
    – S. M.
    Sep 8, 2021 at 11:31
  • no, the value of the "protocol" field in IPv4 header. It lists l4 protocol (so that we know which header to parse next). In IPv6 this field is called next header. I think you can generally have UDP and TCP flows using the same ports. src port and dst port are port numbers.
    – Effie
    Sep 8, 2021 at 11:34
  • guys, could everyone please stop replacing protocol with layer 4 protocol. there is a field in IP header that is called "protocol" or "proto" (see packet format here: en.wikipedia.org/wiki/IPv4#Header) . The list of registered values for this field is here: en.wikipedia.org/wiki/List_of_IP_protocol_numbers. ICMP, OSPF, and co are not layer 4 protocols.
    – Effie
    Sep 8, 2021 at 19:13

The IP source routing options are largely deprecated for security reasons. When supported they allow the source host to define the routing path (in part for LSR), instead of each hop deciding independently by the packet's destination address.

Better alternatives to source routing are policy-based routing, tunneling, or even NAT, depending on the scenario. (You could argue that source routing is a kind of tunneling, not defined by tunnel endpoints but by the source host.)

There is no relation to the stateless/connectionless routing model in TCP/IP. Source routing options are not defined for an entire flow in advance but in each packet.

Re IPv6 flow label:

You should open a new question before changing the focus of a question. This site tries to compile a large number of questions and answers for reference. The more concise and focused these are the better.

The flow label as per RFC 3697:

  1. IPv6 Flow Label Specification

The 20-bit Flow Label field in the IPv6 header [IPv6] is used by a source to label packets of a flow. A Flow Label of zero is used to indicate packets not part of any flow. Packet classifiers use the triplet of Flow Label, Source Address, and Destination Address fields to identify which flow a particular packet belongs to. Packets are processed in a flow-specific manner by the nodes that have been set up with flow-specific state. The nature of the specific treatment and the methods for the flow state establishment are out of scope for this specification.

The Flow Label value set by the source MUST be delivered unchanged to the destination node(s).

So yes, that's somewhat of a break in the stateless model. It's an improvement to the commonly used assumption of a flow when the 5-tuple (source/destination address/L4port, L4 protocol) matches - which is already a stateful concept.

However, it's not at all a departure from stateless routing. Note that the RFC merely defines what a flow label is and what not to do with it - a router/gateway/firewall isn't obliged to any special (stateful) handling. It can just as well remain stateless.

You should see the flow label as a means for simplification and standardization. It doesn't change normal practice and doesn't change the statelessness of IPv6. Actually, it's a generalized reference for the used transport-layer protocol which may absolutely be stateful.

  • port, L4 protocol used in ipv6?
    – S. M.
    Sep 4, 2021 at 10:20
  • @AlokMaity Ports are used in (some) L4/transport-layer protocols.
    – Zac67
    Sep 4, 2021 at 10:20
  • in your beginning answer this statement "instead of each hop deciding independently by the packet's destination address" makes ipv4 connection oriented..
    – S. M.
    Sep 4, 2021 at 10:27
  • Basing the forwarding decisision entirely on the destination address of a packet is completely stateless and not connection-oriented. There is no connection concept on the packet level/network layer.
    – Zac67
    Sep 4, 2021 at 10:37
  • But you write "source host to define the routing path" , how is it connectionless?
    – S. M.
    Sep 4, 2021 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.