IPv4 and IPv6 Interoperability
Till the time, IPv6 is established all over the
world, there is a need for one to host dual stacks – that is both IPv4 and IPv6
are running concurrently as shown below:
While being so, the client can be on IPv4 or
IPv6 format and the server must be able to accept both application.. Here the
peculiarities that are involved when the client is on IPv4 and the server is on
IPv6 format and when the client is IPv6 and the server is in IPv4 format are
discussed.
IPv4
client and IPv6 server:
Following diagram shows the system when the
client is either IPv4 or IPv6
The system considered is on Ethernet for the
sake of simplicity. The server is running on dual host and the client can be of
either IPv4 or IPv6. The server has created an IPv6 listening TCP socket. It is
bound to the IPv6 wild card address and TCP port 8888.
To make
connection, the client sends the SYN segment to the server. In this case it
appears as Ethernet header (contains a type field 0x0800which identifies the
frame as IPv4 frame), followed by IPv4 header (destination IP address in IPv4
format) and the TCP header that contains destination port.
IN case
of IPv6 client connection, the clients sends SYN segment to the server. . In
this case it appears as Ethernet header (contains a type field 0x86dd which
identifies the frame as IPv6 frame), followed by IPv6 header (destination IP
address in IPv6 format) and the TCP header that contains destination port.
The
receiving datalink looks at the Ethernet type field and passes each frame to
the appropriate IP module. The IPv4 module in conjunction with TCP module
detects that the destination socket is an IPv6 socket and the source IPv4
address in the IPv4 header is converted into equivalent IPv4 mapped IPv6
address. That mapped address is returned to the IPv6 socket as the client‘s
IPv6 address when accept returns to the server with IPv4 client connection. All
remaining datagram for this connections are IPv4 datagram. When accept returns
to the server with the IPv6 client connection, the client‘s IPv6 address does
not change from whatever source address appears in the IPv6 header. All
remaining datagram for this connections are IPv6 datagram
Steps that allow an IPv4 TCP client to communicate with an IPv6 server:
•
The IPv6
server starts, creates an IPv6 listening socket, and we assume it binds the
wildcards address to the socket.
• The IPv4 client calls gethostbyname and finds an A record for the server. The server host will have both A record and AAAA record, since it supports both protocols but the IPv4 client asks for only an A record.
• The client calls connect and the client host sends an IPv4 SYN to the server.
• The server host receives the IPv4 SYN directed to the IPv6 to the listening socket, sets a flag indicating that this connection is using IPv4 mapped IPv6 addresses and responds with an IPv4 SYN/ACK. When the connection is established, the address returned to the server by accept is the IPv4 mapped IPv6 address.
•
All
communication between this client and the server tak place using IPv4 datagram
•
Both
client and server explicitly do not know that they are communicating with
different address schemes.
The scenario is similar for an IPv6 UDP server,
but the address format can change for each datagram. If anIPv6 server receives
a datagram from an IPv4 client, the address returned by recvfrom will be the
client‘s IPv4 mapped IPv6 address. The server responds to this clients requests
by calling sendto with the IPv4 mapped IPv6 address as the destination. This
address format tells the kernel to send IPv4 datagram to the client. But the
next datagram received to the server could be an IPv6 datagram, and recvfrom
will return the IPv6 address. IF the server responds, the kernel will generate
an IPv6 datagram.
Most dual stack hosts should use the following
rules in dealing with listening sockets:
• A listening IPv4 socket can accept incoming
connection from only IPv4 client.
• If server has a listening IPv6 socket that
has bound the wildcard address, that socket can accept incoming connections
from either IPv4 client or IPv6 client. For connection from IPv4 client the
server‘s local address for the connection will be the corresponding IPv4 mapped
IPv6 address.
• If a server has a listening IPv6 socket that
has bound an IPv6 address other than an IPv4 mapped IPv6 address, then the
socket can accept incoming connections from IPv6 clients only.
IPv6
client and IPV4 Server:
This scene is the swapping of the client and
server protocols used in the previous case. Consider the IPv6 TCP client
running on dual stack host.
• An IPv4 server starts on an IPv4 only host
and creates an IPv4 listening socket.
• The IPv6 client starts, calls gethostbyname()
asking for only IPv6 addresses. (It enables the RES_USE_INET6 option).Since the
IPv4 only server host has only A record, an IPv4 mapped IPv6 address is
returned to the client.
• The IPv6 client calls connect with IPv4 mapped
IPv6 address in the IPv6 socket address structure. The kernel detects the
mapped address and automatically sends an IPv4 SYN to the server
• The server responds with IPv4 SYN/ACK and the
connection is established using IPv4 datagrams.
The scenario can be summarized as given below:
• If an IPv4 TCP client calls connect specifying an IPv4 address, or If an IPv4 UDP client calls sendto specifying an IPV4 address, nothing special is done. Shown as IPv4 arrows in the figure.
•
IF an
IPv6 TCP client calls connect specifying an IPv6 address, or if an IPv6 UDP
client calls sendto specifying an IPv6 address, nothing special is done. These
are two arrows labeled IPv6 in the figure.
• IF an IPv6 TCP client specifies an IPv4 mapped IPv6 address to connect or if an IPv6 UDP client specifies an IPv4 mapped.IPv6 address to sendto, the kernel detects the mapped address and causes an IPv4 client cannot specified causes an IPv4 datagram to sent, instead of IPv6 datagram. These are the two dashed arrows in the figure.
• An IPv4 client cannot specify an IPv6 address to either connect or sendto because a 16 byte IPv6 address does not fit in the 4 byte in_addr structure within the IPv4 client to the IPv6 protocol box in the figure.
IN the previous section, ( an IPv4 datagram
arriving for an IPv6 server socket), the conversion of the received address to
the IPv4 mapped IPv6 address is done by the mernel and returned transparently
to the application by accept or recvfrom. IN this secion, (an IPv4 datagram
needing to be sent on an IPv6 socket) the conversion of the IPv4 address to the
IPv4 mapped IPv6 address is done by the resolver according to the rules. And
the mapped address is then passed transparently by the application to the
connect or sendto.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.