Home > Archive > Unix Programming > December 2007 > How to get an IPv4 host to connect to an IPv6 listening socket
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to get an IPv4 host to connect to an IPv6 listening socket
|
|
| Andrew Falanga 2007-12-10, 7:09 pm |
| Hi all,
Can this be done? I seem to recall something about embedding IPv4
addresses in the final two "sets" of an IPv6 address. Is this what
I'm looking for? I guess, back to the original question, is it
possible for an IPv4 host to make a connection to an IPv6 listening
socket?
I've done both IPv4 and IPv6 work, but never had to mix the two. From
what I know of IPv6 and IPv4, my first guess is that, no, it's not
possible. IPv6 is entirely different, but then there's that RFC I
recall seeing many years about placing IPv4 hosts into IPv6
addresses. I don't recall the RFC number or I'd start by looking that
up.
Any help is appreciated.
Thanks,
Andy
| |
| Gordon Burditt 2007-12-10, 10:13 pm |
|
As far as I know, you can't get a IPv4-only host to connect to
an IPv6 socket unless you've got something like a default route
that goes through a translator.
>Can this be done? I seem to recall something about embedding IPv4
>addresses in the final two "sets" of an IPv6 address. Is this what
>I'm looking for? I guess, back to the original question, is it
There is a mapping from the IPv4 addresses xxx.xxx.xxx.xxx to
0000:0000:0000:0000:0000:ffff:XXXX:XXXX . This means, with a
suitable gateway, an IPv6 host could reach out and connect to an
IPv4 host.
>possible for an IPv4 host to make a connection to an IPv6 listening
>socket?
In general, NO, there's not nearly enough bits in the address to specify
an IPv6 host.
>I've done both IPv4 and IPv6 work, but never had to mix the two. From
>what I know of IPv6 and IPv4, my first guess is that, no, it's not
>possible. IPv6 is entirely different, but then there's that RFC I
>recall seeing many years about placing IPv4 hosts into IPv6
>addresses. I don't recall the RFC number or I'd start by looking that
>up.
| |
| Andrew Falanga 2007-12-11, 7:13 pm |
| On Dec 10, 8:17 pm, gordonb.s3...@burditt.org (Gordon Burditt) wrote:
> As far as I know, you can't get a IPv4-only host to connect to
> an IPv6 socket unless you've got something like a default route
> that goes through a translator.
>
>
> There is a mapping from the IPv4 addresses xxx.xxx.xxx.xxx to
> 0000:0000:0000:0000:0000:ffff:XXXX:XXXX . This means, with a
> suitable gateway, an IPv6 host could reach out and connect to an
> IPv4 host.
>
>
> In general, NO, there's not nearly enough bits in the address to specify
> an IPv6 host.
>
I didn't think so. It sounds like, and my brief research yesterday
attests to this, mechanisms were put in place for IPv6 hosts to
communicate back through to IPv4 hosts, but not exactly the other way
around. The addressing structures are just too different. And
wouldn't the kernel decide over which transport to send the packets
based upon the address family? Further, if the address family were
set to AF_INET and the address field contained an IPv6 address, the
address wouldn't be translated correctly across the wire because the
kernel left out 12 octets. Am I right?
Andy
| |
| Christof Meerwald 2007-12-11, 7:13 pm |
| On Mon, 10 Dec 2007 15:13:49 -0800 (PST), Andrew Falanga wrote:
> Can this be done? I seem to recall something about embedding IPv4
> addresses in the final two "sets" of an IPv6 address. Is this what
> I'm looking for? I guess, back to the original question, is it
> possible for an IPv4 host to make a connection to an IPv6 listening
> socket?
If the IPv6 socket is listening on an IPv4 address, then you can connect to
that socket from an IPv4 host. Have a look at
http://en.wikipedia.org/wiki/IPv4_mapped_address (but, of course, you are
only using the IPv6 socket API in that case - everything else is plain
IPv4).
Christof
--
http://cmeerw.org sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org xmpp:cmeerw at cmeerw.org
| |
| Gordon Burditt 2007-12-12, 4:24 am |
| >> There is a mapping from the IPv4 addresses xxx.xxx.xxx.xxx to
>
>I didn't think so. It sounds like, and my brief research yesterday
>attests to this, mechanisms were put in place for IPv6 hosts to
>communicate back through to IPv4 hosts, but not exactly the other way
>around. The addressing structures are just too different. And
They can be translated, though, with suitable translations, and not
necessarily on the host itself, but perhaps at a router.
>wouldn't the kernel decide over which transport to send the packets
>based upon the address family?
Yes, but speaking IPv4 over the local wire won't do much good if
nobody else is willing to speak it. You can have all sorts of situations:
(a) IPv6-capable host with only IPv4 connectivity (or the IPv6
connectivity is isolated to a local LAN). There's a lot of these
as I don't know of any ISPs offering consumer IPv6 connectivity.
A possible way around this is to use tunnels over IPv4.
(b) Isolated IPv4 host with only IPv6 connectivity. If there are
facilities to translate the addresses to IPv6 in one of its neighbors,
and a gateway to global IPv4 somewhere, it can still talk.
>Further, if the address family were
>set to AF_INET and the address field contained an IPv6 address, the
>address wouldn't be translated correctly across the wire because the
>kernel left out 12 octets. Am I right?
No, you can't just take a random packet type and cram the wrong-size
address into it.
|
|
|
|
|