473,378 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Convert IPv4 to IPv6

Hi,

is there a straight forward way of converting IPv4 to IPv6?

I thought that it was just a matter of converting 32 bits to 128 bits, (by
adding 96 leading 0s), but that does not seem right in some/most cases.

For example, 127.0.0.1, (IPv4 localhost), does not convert ::1, (IPv6
localhost)

so, is there a function/script/technique to convert IPv4 to IPv6?

Thanks

Simon

Aug 13 '08 #1
14 9213
I don't know the math as I don't deal with networking anymore. You
could try splitting IP4 into it's octets and apply the math like that
then reassemble.

Aug 13 '08 #2
..oO(Simon)
>is there a straight forward way of converting IPv4 to IPv6?
Have a look at the IPv6 RFC and/or its Wikipedia entry. IIRC there's an
address range reserved for mapping the old IPv4 addresses.
>I thought that it was just a matter of converting 32 bits to 128 bits, (by
adding 96 leading 0s), but that does not seem right in some/most cases.
It's a totally different numbering system.

Micha
Aug 13 '08 #3
>
>>is there a straight forward way of converting IPv4 to IPv6?

Have a look at the IPv6 RFC and/or its Wikipedia entry. IIRC there's an
address range reserved for mapping the old IPv4 addresses.
Yes, I had a look at it, and my impression was that IPv6 was the successor
of IPv4 so 32bits had been reserved to allow for backward compatibilities.
>
>>I thought that it was just a matter of converting 32 bits to 128 bits, (by
adding 96 leading 0s), but that does not seem right in some/most cases.

It's a totally different numbering system.
I wouldn't go as far as asying 'totally'.

127.0.0.1 -01111111.00000000.00000000.00000001 ->
0111111100000000:0000000000000001 - 7f00:0001
Micha
Simon

Aug 13 '08 #4
>I don't know the math as I don't deal with networking anymore. You
could try splitting IP4 into it's octets and apply the math like that
then reassemble.
That was my first impression.
But given that the range 127.0.0.0/8 is reserved for loopback and ::1 does
fall within the range 127.0.0.0/8.
it makes me think that the conversion is not as straight forward as I would
have thought, (as 127.0.0.1 is ::7f00:1)

Simon

Aug 13 '08 #5
..oO(Simon)
>>>is there a straight forward way of converting IPv4 to IPv6?

Have a look at the IPv6 RFC and/or its Wikipedia entry. IIRC there's an
address range reserved for mapping the old IPv4 addresses.

Yes, I had a look at it, and my impression was that IPv6 was the successor
of IPv4 so 32bits had been reserved to allow for backward compatibilities.
Reserving 32 bits would drastically reduce the address space. But the
range ::ffff:0:0/96 seems to be reserved for the old IPv4 addresses. It
shouldn't be too difficult to do the mapping.

http://en.wikipedia.org/wiki/IPv4_mapped_address
>>>I thought that it was just a matter of converting 32 bits to 128 bits, (by
adding 96 leading 0s), but that does not seem right in some/most cases.

It's a totally different numbering system.

I wouldn't go as far as asying 'totally'.

127.0.0.1 -01111111.00000000.00000000.00000001 ->
0111111100000000:0000000000000001 - 7f00:0001
Sure, but in IPv6 the loopback device is ::1, which has nothing to do
with 127.0.0.1 or 7f00:0001 (which is not even valid IPv6, BTW). The
same applies to the old local addresses like 192.168.x.y for example.

Micha
Aug 13 '08 #6
On Wed, 13 Aug 2008 22:00:28 +0200, Michael Fesser wrote:
.oO(Simon)
>>>>is there a straight forward way of converting IPv4 to IPv6?

Have a look at the IPv6 RFC and/or its Wikipedia entry. IIRC there's
an address range reserved for mapping the old IPv4 addresses.

Yes, I had a look at it, and my impression was that IPv6 was the
successor of IPv4 so 32bits had been reserved to allow for backward
compatibilities.

Reserving 32 bits would drastically reduce the address space. But the
range ::ffff:0:0/96 seems to be reserved for the old IPv4 addresses. It
shouldn't be too difficult to do the mapping.

http://en.wikipedia.org/wiki/IPv4_mapped_address
>>>>I thought that it was just a matter of converting 32 bits to 128 bits,
(by adding 96 leading 0s), but that does not seem right in some/most
cases.

It's a totally different numbering system.

I wouldn't go as far as asying 'totally'.

127.0.0.1 -01111111.00000000.00000000.00000001 ->
0111111100000000:0000000000000001 - 7f00:0001

Sure, but in IPv6 the loopback device is ::1, which has nothing to do
with 127.0.0.1 or 7f00:0001 (which is not even valid IPv6, BTW). The
same applies to the old local addresses like 192.168.x.y for example.
Things that are different aren't the same.

--
I told you this was going to happen.

Aug 13 '08 #7
>>
>Sure, but in IPv6 the loopback device is ::1, which has nothing to do
with 127.0.0.1 or 7f00:0001 (which is not even valid IPv6, BTW). The
same applies to the old local addresses like 192.168.x.y for example.

Things that are different aren't the same.
???

Simon
Aug 13 '08 #8
>>>>is there a straight forward way of converting IPv4 to IPv6?
>>>
Have a look at the IPv6 RFC and/or its Wikipedia entry. IIRC there's an
address range reserved for mapping the old IPv4 addresses.

Yes, I had a look at it, and my impression was that IPv6 was the successor
of IPv4 so 32bits had been reserved to allow for backward compatibilities.

Reserving 32 bits would drastically reduce the address space. But the
range ::ffff:0:0/96 seems to be reserved for the old IPv4 addresses. It
shouldn't be too difficult to do the mapping.

http://en.wikipedia.org/wiki/IPv4_mapped_address
yeah, but some source say that the notation has been deprecated.
in fact my Vista picks up ping ::7f00:1 as ping 127.0.0.1
but it does the same for ping ::ffff:7f00:1
>>
127.0.0.1 -01111111.00000000.00000000.00000001 ->
0111111100000000:0000000000000001 - 7f00:0001

Sure, but in IPv6 the loopback device is ::1, which has nothing to do
with 127.0.0.1 or 7f00:0001 (which is not even valid IPv6, BTW). The
same applies to the old local addresses like 192.168.x.y for example.
Si was converting as an example from decimal to binary and so forth, and
there were only 32 bits in my example not 128,
So the whole thing was not really going to be valid IPv6.
Micha
Simon

Aug 13 '08 #9
..oO(Simon)
>Reserving 32 bits would drastically reduce the address space. But the
range ::ffff:0:0/96 seems to be reserved for the old IPv4 addresses. It
shouldn't be too difficult to do the mapping.

http://en.wikipedia.org/wiki/IPv4_mapped_address

yeah, but some source say that the notation has been deprecated.
in fact my Vista picks up ping ::7f00:1 as ping 127.0.0.1
but it does the same for ping ::ffff:7f00:1
According to RFC 4291 the first version is deprecated.

http://tools.ietf.org/html/rfc4291#section-2.5.5

Micha
Aug 13 '08 #10
On Wed, 13 Aug 2008 23:23:23 +0200, Simon wrote:

>>Sure, but in IPv6 the loopback device is ::1, which has nothing to do
with 127.0.0.1 or 7f00:0001 (which is not even valid IPv6, BTW). The
same applies to the old local addresses like 192.168.x.y for example.

Things that are different aren't the same.

???

Simon
There is no correlation between the special addresses or ranges in IPv4
and IPv6 so I'm not sure how there could be a meaningful mathematical
conversion.
--
I told you this was going to happen.

Aug 13 '08 #11
>>
>???

Simon

There is no correlation between the special addresses or ranges in Ivy
and Ivy so I'm not sure how there could be a meaningful mathematical
conversion.
You are mistaken, room was made for Ivy in Ivy, they are not poles apart.
Look at some of the links given in this thread.

Simon
Aug 13 '08 #12
>>Reserving 32 bits would drastically reduce the address space. But the
range ::ffff:0:0/96 seems to be reserved for the old IPv4 addresses. It
shouldn't be too difficult to do the mapping.

http://en.wikipedia.org/wiki/IPv4_mapped_address

yeah, but some source say that the notation has been deprecated.
in fact my Vista picks up ping ::7f00:1 as ping 127.0.0.1
but it does the same for ping ::ffff:7f00:1

According to RFC 4291 the first version is deprecated.

http://tools.ietf.org/html/rfc4291#section-2.5.5
Thanks for the links,
that should keep me going for now.
>
Micha
Simon
Aug 13 '08 #13
On Thu, 14 Aug 2008 00:58:04 +0200, Simon wrote:

>There is no correlation between the special addresses or ranges in Ivy
and Ivy so I'm not sure how there could be a meaningful mathematical
conversion.
You are mistaken, room was made for Ivy in Ivy, they are not poles
apart. Look at some of the links given in this thread.
Pardon... that should have said "If".

It seems odd that googling for the bitwise equation yields nothing of
value.

--
I told you this was going to happen.

Aug 14 '08 #14
>
>>There is no correlation between the special addresses or ranges in Ivy
and Ivy so I'm not sure how there could be a meaningful mathematical
conversion.
You are mistaken, room was made for Ivy in Ivy, they are not poles
apart. Look at some of the links given in this thread.

Pardon... that should have said "If".
'If' what?
What are you talking about?

You clearly don't know what you are talking about and you think that giving
some semi-cryptic replies will make me think you do.
So, as I said, have a look at some of the pages given in this thread and you
might learn something.
>
It seems odd that googling for the bitwise equation yields nothing of
value.
No it does not seem odd, you probably did something wrong, I am not also
going to teach you how to use Google as well.
Tell me what terms you used and I might be able to help you.

Otherwise I am tired of guessing what you are trying to say.

Simon

Aug 14 '08 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Agent | last post by:
I would like to invite you and your associates to attend the US IPv6 (Internet Protocol version 6) Summit, December 8-11, 2003 in Crystal City, VA, near the Pentagon. This major opportunity to...
7
by: Torsten Schmidt | last post by:
Hi, I'm trying to connect to a mysql-Server using PHP's mysql-function mysql_connect. The host on which the mysql-server is running is not the same as the host apache and php are running on. The...
2
by: PaulH | last post by:
I am attempting to write a functon that can perform IPv6 compliant pings. But, Icmp6SendEcho2 causes an access violation whenever it is called: First-chance exception at 0x76d641e8 in mping2.exe:...
0
by: Jason | last post by:
I've got a program that wil convert an IP address to decimal. Anyone give me any infor on how I would modify this program that I had converting regular IPs to decimal, hwo would I make it work...
65
by: kyle.tk | last post by:
I am trying to write a function to convert an ipv4 address that is held in the string char *ip to its long value equivalent. Here is what I have right now, but I can't seem to get it to work. ...
3
by: fusillo | last post by:
hi, i would like know about mysql's ipv6 support, i installed mysql 5.0.19 from a source dist and no configuration option is provided to enable ipv6. do you know some tips about? regards ...
2
by: Valerie Hough | last post by:
My app has so far only encountered IPv4 addresses and I use: Dns.GetHostByName( "someOtherComputer", portNumber ).AddressList. Can someone please point me to an example of how to turn this into...
2
by: Prabhu Gurumurthy | last post by:
Hello list, I would like to parse IPv6 addresses and subnet using re module in python. I am able to either parse the ipv6 address or ipv6 network but not both using single line. any help...
1
by: =?Utf-8?B?V2lsbGlhbSBSYW5kbGV0dA==?= | last post by:
The System.Uri class is not behaving as I expect when an IPv4 address is embedded within an IPv6 address. The following test works fine, using IPv6 only: public void...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.