How to convert IPv4 to IPv6?

ipv6 has gradually application, now there are a lot of operators support ipv6, the day before yesterday we posted how to make computer use ipv6 address? There are a lot of friends ask? ipv6 what role, what is its representation, today we come to a Learn more about it at ipv6 related calculations and conversions.

How to convert IPv4 to IPv6? How to convert IPv4 to IPv6?

First, what is ipv6?

We now use the ipv4 address is 32, for example such, 59.123.123.123. The total number there are about 4.3 billion, the average score for each person on the planet not a, let alone each computer, and also minus the 192,170 private network addresses, and even less, up to now, more not enough. With the development of scientific and technological progress and the Internet of Things, ipv4 apparently has failed to meet the requirements, severely constrains the application and development of the Internet, so ipv6 came into being.

Ipv6 what is it?

IPv6 is the abbreviation for Internet Protocol Version 6, wherein the Internet Protocol translated as "Internet protocol." IPv6 is the replacement for the current version of the IP protocol (IPv4) is the next generation IP protocol, known as a URL to be compiled on every grain of sand around the world.

Compared with IPv4 uses 32-bit addresses, IPv6 uses 128-bit addresses:

According to the calculation method of the number of addresses, we can calculate the number of addresses IPv6 can provide are:

2 ^ 128-1 two (approximately 340 trillion)

IPV6 address is extremely rich, almost inexhaustible, known as every grain of sand on Earth can be assigned to their own address, not to mention each phone, computer, and even refrigerators, washing machines can have their own unique ip address, and suddenly tall on a lot.

Benefits two, ipv6 of

ipv6 what's the use, which is asking a lot of friends, in fact, the benefits of ipv6 is still a lot of.

1, with the number of ip addresses could not finish

128 has a large number of ipv6 ip address, provides enough IP addresses for future decades, a huge address space billions of new devices offer globally unique address, that is, people can also have a public network ip, in ipv4 period, due to the limited address, apply only to public companies, we are using a private network address, and ipv6, each device can have public network ip, then you have a public network capable Shane?

作用非常多,比如我们项目监控,可以直接用公网ip地址访问了,就能很好的解决监控中远程控制访问问题,异地监控集中控制也就不用那么麻烦了。

对于企业或个人也可以搭建服务器,使用唯一标识的ipv6地址就可以访问这个服务器了,共享文件极其简单。

2、多等级层次有助于路由聚合,提供了路由的效率和可扩展性

可以有更快的速度,这个呢,用专业的话讲,人类无法感受到的微小的速度提升,但毕竟还是快了。

3、能够更有效的处理移动性和安全机制

更加安全,以前大家会经常莫名其妙的中***或者病毒,这个在IPv6里会明显减少。

4、会让智能家居和物联网迎来最好的时代。

难以想象,手机、电脑、汽车、电视、空调、机器人、、、都分到了一个独一无二ip后,会是怎样的,物联网发展将会只受想象力的限制。

Linux书籍:https://www.linuxprobe.com/books

三、ipv6的表示方式

IPV6地址的表示采用16进制的表示方法。将128bit分为8组,每组16比特,用4个16进制数表示,各组之间用":"隔开,每组中最前面的0可以省略,但每组必须得有一个数。

1、冒分十六进制表示法

格式为 X:X:X:X:X:X:X:X,其中每个X代表16个bit,以十六进制显示,如下面这些:

ip一:ABCD:EF01:2345:6789:ABCD:EF01:2345:6789

ip二:FEDC:BA98:7654:3210:FEDC:BA98:7654:3210

ip三:1080:0:0:0:8:800:200C:417A

2、0位压缩表示法

在某些情况下,一个IPv6地址中问可能包含很长的一段0,可以把连续的一段0压缩为“::”。但为保证地址解析的唯一性,地址中”::”只能出现一次,例如:

1080:0:0:0:8:800:200C:417A =1080::8:800:200C:417A

FF01:0:0:0:0:0:0:101=FF01::101

FF01:0:0:0:0:0:0:1101 = FF01::1101

0:0:0:0:0:0:0:1 = ::1

0:0:0:0:0:0:0:0 = ::

3、内嵌IPv4地址表示法

为了实现IPv4-IPv6互通,IPv4地址会嵌入IPv6地址中,此时地址常表示为:X:X:X:X:X:X:d.d.d.d,

也就是前6组用冒分十六进制表示,后二组用十进制表示,而最后32bit地址则使用IPv4的点分十进制表示,例如::192.168.0.1与就是一个典型的例子 。

四、如何将ipv4转换为ipv6地址?

上面我们提到了,ipv4地址要与ipv6地址互通,需要将ipv4转换为ipv6地址。

举例:

如果IPv4的一个地址为135.75.43.52,现有32位地址,那么如何转换为ipv6呢?

1、非标准转换:

只需要在ip地址前面6组共96位补充0即可,即

0000:0000:0000:0000:0000:0000:135.75.43.52

也就是::135.75.43.52(内嵌IPv4表示法)

2、标准转换

135.75.43.52 按十六进制算出即87.4B.2B.34,

而87.4B.2B.34串地址一组还是8位,所以需要两组v4地址合成v6地址,

再把前96位补零,它可以被转化为

0000:0000:0000:0000:0000:0000:874B:2B34或者::874B:2B34。

补充下:十进制如何转化为16进制?

这里弱电君有必要补充下十进制如何转化为16进制,在ipv6时代,可能会经常需要用到。

方法是:十进制数除以16,反向取余数,除到不能除为止。当然大家听到这个方法可能是一头雾水,我们具体来看下举例计算过程。

例如10进制的ipv4地址:135.75.43.52 ,化成16进制的。

为了方便大家了解原理,具体计算过程可以看下图:
How to convert IPv4 to IPv6? How to convert IPv4 to IPv6?
16进制的10、11、12、13、14、15分别用A、B、C、D、E、F来表示。

So decimal 135.75.43.52 final results are hexadecimal 87.4B.2B.34, is transformed into ipv6 :: 874B: 2B34. Of course, it can be directly converted by the tool.


Guess you like

Origin blog.51cto.com/14414295/2430291