determination, even though the functions could be used with static
MTU tunnels as well.
The ICMPv4 "packet too big" error messages are handled according to
IPv4 Path MTU Discovery [RFC1191] and the resulting path MTU is
recorded in the IPv4 layer. The recorded path MTU is used by IPv6 to
determine if an ICMPv6 "packet too big" error has to be generated as
described in Section 3.2.2.
The handling of other types of ICMPv4 error messages depends on how
much information is available from the encapsulated packet that
caused the error.
Many older IPv4 routers return only 8 bytes of data beyond the IPv4
header of the packet in error, which is not enough to include the
address fields of the IPv6 header. More modern IPv4 routers are
likely to return enough data beyond the IPv4 header to include the
entire IPv6 header and possibly even the data beyond that. See
[RFC1812].
If sufficient data bytes from the offending packet are available, the
encapsulator MAY extract the encapsulated IPv6 packet and use it to
generate an ICMPv6 message directed back to the originating IPv6
node, as shown below:
+--------------+
| IPv4 Header |
| dst = encaps |
| node |
+--------------+
| ICMPv4 |
| Header |
- - +--------------+
| IPv4 Header |
| src = encaps |
IPv4 | node |
+--------------+ - -
Packet | IPv6 |
| Header | Original IPv6
in +--------------+ Packet -
| Transport | Can be used to
Error | Header | generate an
+--------------+ ICMPv6
| | error message
~ Data ~ back to the source.
| |
- - +--------------+ - -
ICMPv4 Error Message Returned to Encapsulating Node
When receiving ICMPv4 errors as above and the errors are not "packet
too big", it would be useful to log the error as an error related to
the tunnel. Also, if sufficient headers are available, then the
originating node MAY send an ICMPv6 error of type "unreachable" with
code "address unreachable" to the IPv6 source. (The "address
unreachable" code is appropriate since, from the perspective of IPv6,
the tunnel is a link and that code is used for link-specific errors
[RFC2463]).
Note that when the IPv4 path MTU is exceeded, and sufficient bytes of
payload associated with the ICMPv4 errors are not available, or
ICMPv4 errors do not cause the generation of ICMPv6 errors in case
there is enough payload, there will be at least two packet drops
instead of at least one (the case of a single layer of MTU
discovery). Consider a case where an IPv6 host is connected to an
IPv4/IPv6 router, which is connected to a network where an ICMPv4
error about too big packet size is generated. First, the router
needs to learn the tunnel (IPv4) MTU that causes at least one packet
loss, and then the host needs to learn the (IPv6) MTU from the router
that causes at least one packet loss. Still, in all cases there can
be more than one packet loss if there are multiple large packets in
flight at the same time.
3.5. IPv4 Header Construction
When encapsulating an IPv6 packet in an IPv4 datagram, the IPv4
header fields are set as follows:
Version:
4
IP Header Length in 32-bit words:
5 (There are no IPv4 options in the encapsulating header.)
Type of Service:
0 unless otherwise specified. (See [RFC2983] and [RFC3168]
Section 9.1 for issues relating to the Type-of-Service byte and
tunneling.)
Total Length:
Payload length from IPv6 header plus length of IPv6 and IPv4
headers (i.e., IPv6 payload length plus a constant 60 bytes).
Identification:
Generated uniquely as for any IPv4 packet transmitted by the
system.
Flags:
Set the Don’t Fragment (DF) flag as specified in Section 3.2.
Set the More Fragments (MF) bit as necessary if fragmenting.
Fragment Offset:
Set as necessary if fragmenting.
Time to Live:
Set in an implementation-specific manner, as described in
Section 3.3.
Protocol:
41 (Assigned payload type number for IPv6).
Header Checksum:
Calculate the checksum of the IPv4 header [RFC791].
Source Address:
An IPv4 address of the encapsulator: either configured by the
administrator or an address of the outgoing interface.
Destination Address:
IPv4 address of the tunnel endpoint.
When encapsulating the packets, the node must ensure that it will use
the correct source address so that the packets are acceptable to the
decapsulator as described in Section 3.6. Configuring the source
address is appropriate particularly in cases in which automatic
selection of source address may produce different results in a
certain period of time. This is often the case with multiple
addresses, and multiple interfaces, or when routes may change
frequently. Therefore, it SHOULD be possible to administratively
specify the source address of a tunnel.
3.6. Decapsulation
When an IPv6/IPv4 host or a router receives an IPv4 datagram that is
addressed to one of its own IPv4 addresses or a joined multicast
group address, and the value of the protocol field is 41, the packet
is potentially a tunnel packet and needs to be verified to belong to
one of the configured tunnel interfaces (by checking
source/destination addresses), reassembled (if fragmented at the IPv4
level), and have the IPv4 header removed and the resulting IPv6
datagram be submitted to the IPv6 layer code on the node.
The decapsulator MUST verify that the tunnel source address is
correct before further processing packets, to mitigate the problems
with address spoofing (see Section 4). This check also applies to
packets that are delivered to transport protocols on the
decapsulator. This is done by verifying that the source address is
the IPv4 address of the encapsulator, as configured on the
decapsulator. Packets for which the IPv4 source address does not
match MUST be discarded and an ICMP message SHOULD NOT be generated;
however, if the implementation normally sends an ICMP message when
receiving an unknown protocol packet, such an error message MAY be
sent (e.g., ICMPv4 Protocol 41 Unreachable).
A side effect of this address verification is that the node will
silently discard packets with a wrong source address and packets that
were received by the node but not directly addressed to it (e.g.,
broadcast addresses).
Independent of any other forms of IPv4 ingress filtering the
administrator of the node may have configured, the implementation MAY
perform ingress filtering, i.e., check that the packet is arriving
from the interface in the direction of the route toward the tunnel
end-point, similar to a Strict Reverse Path Forwarding (RPF) check
[RFC3704]. As this may cause problems on tunnels that are routed
through multiple links, it is RECOMMENDED that this check, if done,
is disabled by default. The packets caught by this check SHOULD be
discarded; an ICMP message SHOULD NOT be generated by default.
The decapsulator MUST be capable of having, on the tunnel interfaces,
an IPv6 MRU of at least the maximum of 1500 bytes and the largest
(IPv6) interface MTU on the decapsulator.
The decapsulator MUST be capable of reassembling an IPv4 packet that
is (after the reassembly) the maximum of 1500 bytes and the largest
(IPv4) interface MTU on the decapsulator. The 1500-byte number is a
result of encapsulators that use the static MTU scheme in Section
3.2.1, while encapsulators that use the dynamic scheme in Section
3.2.2 can cause up to the largest interface MTU on the decapsulator
to be received. (Note that it is strictly the interface MTU on the
last IPv4 router *before* the decapsulator that matters, but for most
links the MTU is the same between all neighbors.)
This reassembly limit allows dynamic tunnel MTU determination by the
encapsulator to take advantage of larger IPv4 path MTUs. An
implementation MAY have a configuration knob that can be used to set
a larger value of the tunnel reassembly buffers than the above
number, but it MUST NOT be set below the above number.
The decapsulation is shown below:
+-------------+
| IPv4 |
| Header |
+-------------+ +-------------+
| IPv6 | | IPv6 |
| Header | | Header |
+-------------+ +-------------+
| Transport | | Transport |
| Layer | ===> | Layer |
| Header | | Header |
+-------------+ +-------------+
| | | |
~ Data ~ ~ Data ~
| | | |
+-------------+ +-------------+
Decapsulating IPv6 from IPv4
The decapsulator performs IPv4 reassembly before decapsulating the
IPv6 packet.
When decapsulating the packet, the IPv6 header is not modified.
(However, see [RFC2983] and [RFC3168] section 9.1 for issues relating
to the Type of Service byte and tunneling.) If the packet is
subsequently forwarded, its hop limit is decremented by one.
The encapsulating IPv4 header is discarded, and the resulting packet
is checked for validity when submitted to the IPv6 layer. When
reconstructing the IPv6 packet, the length MUST be determined from
the IPv6 payload length since the IPv4 packet might be padded (thus
have a length that is larger than the IPv6 packet plus the IPv4
header being removed).
After the decapsulation, the node MUST silently discard a packet with
an invalid IPv6 source address. The list of invalid source addresses
SHOULD include at least:
- all multicast addresses (FF00::/8)
- the loopback address (::1)
- all the IPv4-compatible IPv6 addresses [RFC3513] (::/96),
excluding the unspecified address for Duplicate Address Detection
(::/128)
- all the IPv4-mapped IPv6 addresses (::ffff:0:0/96)
In addition, the node should be configured to perform ingress
filtering [RFC2827][RFC3704] on the IPv6 source address, similar to
on any of its interfaces, e.g.:
1) if the tunnel is toward the Internet, the node should be
configured to check that the site’s IPv6 prefixes are not used as
the source addresses, or
2) if the tunnel is toward an edge network, the node should be
configured to check that the source address belongs to that edge
network.
The prefix lists in the former typically need to be manually
configured; the latter could be verified automatically, e.g., by
using a strict unicast RPF check, as long as an interface can be
designated to be toward an edge.
It is RECOMMENDED that the implementations provide a single knob to
make it easier to for the administrators to enable strict ingress
filtering toward edge networks.
3.7. Link-Local Addresses
The configured tunnels are IPv6 interfaces (over the IPv4 "link
layer") and thus MUST have link-local addresses. The link-local
addresses are used by, e.g., routing protocols operating over the
tunnels.
The interface identifier [RFC3513] for such an interface may be based
on the 32-bit IPv4 address of an underlying interface, or formed
using some other means, as long as it is unique from the other tunnel
endpoint with a reasonably high probability.
Note that it may be desirable to form the link-local address in a
fashion that minimizes the probability and the effect of having to
renumber the link-local address in the event of a topology or
hardware change.
If an IPv4 address is used for forming the IPv6 link-local address,
the interface identifier is the IPv4 address, prepended by zeros.
Note that the "Universal/Local" bit is zero, indicating that the
interface identifier is not globally unique. The link-local address
is formed by appending the interface identifier to the prefix
FE80::/64.
When the host has more than one IPv4 address in use on the physical
interface concerned, a choice of one of these IPv4 addresses is made
by the administrator or the implementation when forming the link-
local address.
+-------+-------+-------+-------+-------+-------+------+------+
| FE 80 00 00 00 00 00 00 |
+-------+-------+-------+-------+-------+-------+------+------+
| 00 00 00 00 | IPv4 Address |
+-------+-------+-------+-------+-------+-------+------+------+
3.8. Neighbor Discovery over Tunnels
Configured tunnel implementations MUST at least accept and respond to
the probe packets used by Neighbor Unreachability Detection (NUD)
[RFC2461]. The implementations SHOULD also send NUD probe packets to
detect when the configured tunnel fails at which point the
implementation can use an alternate path to reach the destination.
Note that Neighbor Discovery allows that the sending of NUD probes be
omitted for router-to-router links if the routing protocol tracks
bidirectional reachability.
For the purposes of Neighbor Discovery, the configured tunnels
specified in this document are assumed to NOT have a link-layer
address, even though the link-layer (IPv4) does have an address.
This means that:
- the sender of Neighbor Discovery packets SHOULD NOT include Source
Link Layer Address options or Target Link Layer Address options on
the tunnel link.
- the receiver MUST, while otherwise processing the Neighbor
Discovery packet, silently ignore the content of any Source Link
Layer Address options or Target Link Layer Address options
received on the tunnel link.
Not using link-layer address options is consistent with how Neighbor
Discovery is used on other point-to-point links.
4. Threat Related to Source Address Spoofing
The specification above contains rules that apply tunnel source
address verification in particular and ingress filtering
[RFC2827][RFC3704] in general to packets before they are
decapsulated. When IP-in-IP tunneling (independent of IP versions)
is used, it is important that this not be used to bypass any ingress
filtering in use for non-tunneled packets. Thus, the rules in this
document are derived based on should ingress filtering be used for
IPv4 and IPv6, the use of tunneling should not provide an easy way to
circumvent the filtering.
In this case, without specific ingress filtering checks in the
decapsulator, it would be possible for an attacker to inject a packet
with:
- Outer IPv4 source: real IPv4 address of attacker
- Outer IPv4 destination: IPv4 address of decapsulator
- Inner IPv6 source: Alice, which is either the decapsulator or a
node close to it
- Inner IPv6 destination: Bob
Even if all IPv4 routers between the attacker and the decapsulator
implement IPv4 ingress filtering, and all IPv6 routers between the
decapsulator and Bob implement IPv6 ingress filtering, the above
spoofed packets will not be filtered out. As a result, Bob will
receive a packet that looks like it was sent from Alice even though
the sender was some unrelated node.
The solution to this is to have the decapsulator accept only
encapsulated packets from the explicitly configured source address
(i.e., the other end of the tunnel) as specified in Section 3.6.
While this does not provide complete protection in the case ingress
filtering has not been deployed, it does provide a significant
increase in security. The issue and the remainder threats are
discussed at more length in Security Considerations.
5. Security Considerations
Generic security considerations of using IPv6 are discussed in a
separate document [V6SEC].
An implementation of tunneling needs to be aware that although a
tunnel is a link (as defined in [RFC2460]), the threat model for a
tunnel might be rather different than for other links, since the
tunnel potentially includes all of the Internet.
Several mechanisms (e.g., Neighbor Discovery) depend on Hop Count
being 255 and/or the addresses being link local for ensuring that a
packet originated on-link, in a semi-trusted environment. Tunnels
are more vulnerable to a breach of this assumption than physical
links, as an attacker anywhere in the Internet can send an IPv6-in-
IPv4 packet to the tunnel decapsulator, causing injection of an
encapsulted IPv6 packet to the configured tunnel interface unless the
decapsulation checks are able to discard packets injected in such a
manner.
Therefore, this memo specifies that the decapsulators make these
steps (as described in Section 3.6) to mitigate this threat:
- IPv4 source address of the packet MUST be the same as configured
for the tunnel end-point;
- Independent of any IPv4 ingress filtering the administrator may
have configured, the implementation MAY perform IPv4 ingress
filtering to check that the IPv4 packets are received from an
expected interface (but as this may cause some problems, it may be
disabled by default);
- IPv6 packets with several, obviously invalid IPv6 source addresses
received from the tunnel MUST be discarded (see Section 3.6 for
details); and
- IPv6 ingress filtering should be performed (typically requiring
configuration from the operator), to check that the tunneled IPv6
packets are received from an expected interface.
Especially the first verification is vital: to avoid this check, the
attacker must be able to know the source of the tunnel (ranging from
difficult to predictable) and be able to spoof it (easier).
If the remainder threats of tunnel source verification are considered
to be significant, a tunneling scheme with authentication should be
used instead, e.g., IPsec [RFC2401] (preferable) or Generic Routing
Encapsulation with a pre-configured secret key [RFC2890]. As the
configured tunnels are set up more or less manually, setting up the
keying material is probably not a problem. However, setting up
secure IPsec IPv6-in-IPv4 tunnels is described in another document
[V64IPSEC].
If the tunneling is done inside an administrative domain, proper
ingress filtering at the edge of the domain can also eliminate the
threat from outside of the domain. Therefore, shorter tunnels are
preferable to longer ones, possibly spanning the whole Internet.
In addition, an implementation MUST treat interfaces to different
links as separate, e.g., to ensure that Neighbor Discovery packets
arriving on one link do not affect other links. This is especially
important for tunnel links.
When dropping packets due to failing to match the allowed IPv4 source
addresses for a tunnel the node should not "acknowledge" the
existence of a tunnel, otherwise this could be used to probe the
acceptable tunnel endpoint addresses. For that reason, the
specification says that such packets MUST be discarded, and an ICMP
error message SHOULD NOT be generated, unless the implementation
normally sends ICMP destination unreachable messages for unknown
protocols; in such a case, the same code MAY be sent. As should be
obvious, not returning the same ICMP code if an error is returned for
other protocols may hint that the IPv6 stack (or the protocol 41
tunneling processing) has been enabled -- the behaviour should be
consistent on how the implementation otherwise behaves to be
transparent to probing.
6. Acknowledgements
We would like to thank the members of the IPv6 working group, the
Next Generation Transition (ngtrans) working group, and the v6ops
working group for their many contributions and extensive review of
this document. Special thanks are due to (in alphabetical order) Jim
Bound, Ross Callon, Tim Chown, Alex Conta, Bob Hinden, Bill Manning,
John Moy, Mohan Parthasarathy, Chirayu Patel, Pekka Savola, and Fred
Templin for many helpful suggestions. Pekka Savola helped in editing
the final revisions of the specification.
7. References
7.1. Normative References
[RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791, September
1981.
[RFC1191] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191,
November 1990.
[RFC1981] McCann, J., Deering, S., and J. Mogul, "Path MTU Discovery
for IP version 6", RFC 1981, August 1996.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
(IPv6) Specification", RFC 2460, December 1998.
[RFC2463] Conta, A. and S. Deering, "Internet Control Message
Protocol (ICMPv6) for the Internet Protocol Version 6
(IPv6) Specification", RFC 2463, December 1998.
7.2. Informative References
[ASSIGNED] IANA, "Assigned numbers online database",
http://www.iana.org/numbers.html
[DNSOPV6] Durand, A., Ihren, J., and Savola P., "Operational