Loose Source Routing
(sometimes called LSRR, meaning Loose Source and Record Route) is an IP header option
which allows you to specify a list of IP address
es to go through on the path to a destination. In loose source routing, you specify that before going to it's final destination, the packet should go through the following IP addresses as intermediate destinations
. These intermediate destinations are responsible for forwarding it on to the next destination (whether intermediate or final).
This was original used for reverse traceroutes, although because it can be used to circumvent firewalls or other access control devices, it is widely believed that LSRR is no longer supported. Testing reveals that about a third of the routers on the Internet will do loose source routing.
A less-used fact of LSRR is that the intermediate routers will record their IP address in the header as they forward the packet. Moreover, the IP address that
is record must (per RFC 791) be the IP address of the interface that packet is forwarded out-of. This can be used to discover IP aliasing.
LSRR is option number 131. It has variable length. The first two octets of the option payload are the length of the option (including the type and length octets) and a pointer into the option indicating the next address to be processed. The smallest legal pointer value is 4. The rest of the packet contain the source addresses. The final destination is the last source address. The first source address is listed as the destination of the IP packet.
This format means that routers between the source and the first source address or between two source addresses forward the packet without alteration (other than TTL and checksum, of course). The only time a router must pay attention to the contents of the LSRR option is when the destination of the packet is the router's IP address. Then, the router must copy the next source address to the destination of the IP packet, copy it's IP address into the location that source address was and increment the pointer by 4 before continuing to forward it.