网络的经济基础篇-之二-IPv4、IPv6
来源:互联网 发布:dvd光盘复制软件 编辑:程序博客网 时间:2024/05/13 10:23
1 IPv4
Header Length
4-byte (32 bit), minimum = 5 (20 bytes),maximum = 15 (60 bytes)
TOS (Type of Service)
D:0 = NormalDelay 1 = Minimize Delay
T:0 = NormalThroughput 1 = Maximize Throughput
R:0 = NormalReliability 1 = Maximize Reliability
C:0 = NormalCost 1 = Minimize Cost
Total Length
byte(8 bit), including header and data,maximum = 65,535.
Identification
An identifying value generated by thesender to aid in assembling the fragments of a datagram.
DF
0 = Can Fragment 1 = Don’t Fragment
MF
0 = Last Fragment 1 = More Fragments
Fragment Offset
8-byte (64 bit), it indicates where thefragment belongs. The first fragment has offset zero.
Protocol
It indicates the next level protocol usedin the data portion of the datagram.
HeaderChecksum
checksum on the header only. For computingthe checksum, the checksum field is set to zero. Since some header fieldschange (e.g., TTL), the checksum field is recomputed and verified at each pointwhere the header is processed.
Padding
The padding is used to ensure that the headerends on a 32 bit boundary.
2 IPv4 Address
Host Address is divided into Subnet ID andHost ID. Subnet Mask is used todistinguish them.
A
10.0.0.0 ~ 10.255.255.255
B
172.16.0.0 ~ 172.31.255.255
C
192.168.0.0 ~ 192.168.255.255
Private IPv4 Address
Network Address
Host Addresss
Source
Destination
Subnet ID
Host ID
0
0
0
hostid
O
X
host on the network
specific host on the network
127
*
O
O
loop-back address
-1
netaddr
netaddr
netaddr
subnetid
-1
-1
-1
-1
-1
X
O
limited broadcast address
broadcast to network
broadcast to subnet
broadcast to all subnets
0: all bits setto 0
-1: all bits set to 1
*: any value
Subnet ID = null: Subnet is not deployed.
Limited broadcast address: Router must notforward, limited to the original network.
3 IPv6
PayloadLength
byte(8 bit). Note that any extensionheaders present are considered as part of the payload.
NextHeader
Identify the type of header immediatelyfollowing the IPv6 header, is same as IPv4 Protocol field.
Payload
Note that IPv6 Extension Headers are alsocontained in Payload.
3.1 IPv6 Extension Header
It is recommended that headers appear inthe following order:
1. IPv6 header
2. Hop-by-Hop Options header
3. Destination Options header: options to beprocessed by the first destination that appears in the IPv6 Destination Addressfield plus subsequent destinations listed in the Routing header.
4. Routing header
5. Fragment header
6. Authentication header / Encapsulating SecurityPayload header: recommendation regarding the relative order is given in RFC 2406“IP Encapsulating Security Payload (ESP)”.
7. Destination Options header: options to beprocessed only by the final destination of the packet.
8. Upper-layer header
Each extension header should occur at mostonce, except for the Destination Options header which should occur at mosttwice.
IPv6 nodes must accept and attempt toprocess Extension Headers in any order and occurring any times, except forHop-by-Hop Options header which is restricted to appear immediately after IPv6header.
Alignment requirements for the ExtensionHeader MUST be aligned on an 8-octet boundary.
3.1.1 Option (used in Hop-by-HopOptions header and Destination Options header)
The sequence of options within Extension Headermust be processed strictly in the order they appear in the header; a IPv6 nodemust not, for example, scan through the header looking for a particular kind ofoption and process that option prior to processing all preceding ones.
OptionData Length
byte(8 bit)
OptionType (highest-order two bits)
00 - skip over this option and continueprocessing the header.
01 - discard the packet.
10 - discard the packet and send an ICMPParameter Problem, Code 2, message to the packet’s Source Address, pointing tothe unrecognized Option Type.
11 - discard the packet and, only if thepacket’s Destination Address was not a multicast address, send an ICMPParameter Problem, Code 2, message to the packet’s Source Address, pointing tothe unrecognized Option Type.
OptionType (the third-highest-order bit)
0 - Option Data does not change en-route
1 - Option Data may change en-route
When an Authentication header is present inthe packet, for any option whose data may change en-route, its entire OptionData field must be treated as zero when computing or verifying the packet’sauthenticating value.
Pad1 Option
Note that Pad1 option does not have lengthand data fields.
PadN Option
3.1.2 Hop-by-Hop Options Header (Next Header = 0 )
The Hop-by-Hop Options header is used tocarry optional information that must be examined by each node along thedelivery path.
HdrExt Len
8-byte (64 bit), not including the first 8bytes.
3.1.3 Routing Header ( Next Header = 43)
The Routing header is used by an IPv6source to list one or more intermediate nodes to be visited on the way to the destination.
HdrExt Len
8-byte (64 bit), not including the first 8bytes.
SegmentsLeft
Number of route segments remaining, i.e.,number of explicitly listed intermediate nodes still to be visited beforereaching the final destination.
If encountering Routing header with anunrecognized Routing Type, the behavior of node depends on the value of theSegments Left field, as follows:
If Segments Left is zero, the node mustignore the Routing header and proceed to process the next header in the packet.
If Segments Left is non-zero, the node mustdiscard the packet and send an ICMP Parameter Problem, Code 0, message to thepacket’s Source Address, pointing to the unrecognized Routing Type.
3.1.4 Fragment Header ( Next Header =44 )
The Fragment header is used by an IPv6source to send a packet larger than the path MTU to its destination. (Note:unlike IPv4, fragmentation in IPv6 is performed only by source nodes, not by routersalong a packet’s delivery path.)
HdrExt Len
8-byte (64 bit), not including the first 8bytes.
FragmentOffset
8-byte (64 bit), the offset relative to thestart of the Fragmentable Part of the original packet.
M
1 = more fragments;
0 = last fragment.
Identification
An identifying value generated by thesender to aid in assembling the fragments of a datagram.
3.1.5 Destination Options Header (Next Header = 60 )
The Destination Options header is used tocarry optional information that need be examined only by the destinationnode(s).
HdrExt Len
8-byte (64 bit), not including the first 8bytes.
3.1.6 No Next Header ( Next Header =59 )
The value 59 in the Next Header field of anIPv6 header or any Extension Header indicates that there is nothing followingthat header.
4 IPv6 Address
1. The preferred form is x:x:x:x:x:x:x:x.
2. An alternative form is x:x:x:x:x:x:d.d.d.d.
3. "::" indicates one or moregroups of 16 bits of zeros. "::" can only appear once in an address.The "::" can also be used to compress leading or trailing zeros in anaddress.
Unspecified Address 0:0:0:0:0:0:0:0 = ::/128
Loop-back Address 0:0:0:0:0:0:0:1 = ::1/128
Multicast Address FF00::/8
Link-local Unicast FE80::/10
Global Unicast everything else
4.1 Unspecified Address ( ::/128 )
The unspecified address must never beassigned to any node. One example of its use is in the Source Address field of anyIPv6 packets sent by an initializing host before it has learned its ownaddress.
The unspecified address must not be used asthe destination address of IPv6 packets or in IPv6 Routing headers. An IPv6packet with a source address of unspecified must never be forwarded by an IPv6 router.
4.2 Loop-back Address ( ::1/128 )
The loop-back address is used by a node tosend an IPv6 packet to itself. It must not be assigned to any physicalinterface. It is treated as having Link-Local scope, and may be thought of asthe Link-Local unicast address of a virtual interface (typically called the"loop-back interface").
The loop-back address must not be used asthe source address in IPv6 packets that are sent outside of node. An IPv6packet with a destination address of loop-back address must never be sentoutside of node and must never be forwarded by an IPv6 router. A packet receivedon an interface with a destination address of loop-back address must bedropped.
4.3 Link-local Unicast ( FE80::/10)
Link-Local addresses are designed to beused for addressing on a single link for purposes such as automatic addressconfiguration, neighbor discovery, or when no routers are present.
Routers must not forward any packets withLink-Local source or destination addresses to other links.
4.4 Global Unicast
Not start with binary 000 64-bit interface ID field (i.e., n + m =64).
4.5 Anycast Addresses
Anycast address is an address that isassigned to more than one interface (typically belong to different nodes), withthe property that a packet sent to an anycast address is routed to the "nearest"interface having that address, according to the routing protocol measure ofdistance.
Anycast address is syntactically same as unicastaddress. When a unicast address is assigned to more than one interface, thusturning it into an anycast address, the nodes to which the address is assignedmust be explicitly configured to know that it is an anycast address.
Anycast address must not be used as thesource address in IPv6 packets.
Anycast address must not be assigned toIPv6 host, only can be assigned to IPv6 router.
4.6 Multicast Addresses ( FF00::/8)
Multicast address is an identifier for agroup of interfaces (typically on different nodes). An interface may belong toany number of multicast groups.
T = 0 permanently-assigned("well-known") multicast address, assigned by IANA.
T = 1 non-permanently-assigned("transient" or "dynamically" assigned) multicast address
P definition and usage can be found in RFC3306 “Unicast-Prefix-based IPv6 Multicast Addresses”.
R definition and usage can be found in RFC3956 “Embedding the Rendezvous Point (RP) Address in an IPv6 Multicast Address”.
scop is used to limit the scope of themulticast group:
1 Interface-Localscope
2 Link-Localscope
4 Admin-Localscope
5 Site-Localscope
8 Organization-Localscope
E Globalscope
Multicast address must not be used as the sourceaddress of IPv6 packets or in IPv6 Routing headers
4.7 Map IPv4 Address to IPv6Address
4.7.1 IPv4-Compatible IPv6 Address
The "IPv4-Compatible IPv6address" is deprecated; the IPv4 address used must be a globally-uniqueIPv4 unicast address.
4.7.2 IPv4-Mapped IPv6 Address
5 Interface ID with EUI-6 Format
For all unicast addresses, except startingwith the binary value 000, Interface IDs are required to be 64 bits long and tobe constructed in EUI-64 format.
First three bytes of EUI-64 format
c companyid
u universal/local bit
0 local scope
1 universalscope
g individual/groupbit
0 individual
1 group
6 IPv4 vs IPv6
1. IPv6 header is constant length, 40 bytes.
2. IPv4 TTL defines the lifetime of the packetin seconds, while IPv6 Hop Limit is decremented by 1 by each node that forwardsthe packet.
3. IPv6 replace Protocol field of IPv4 with NextHeader field.
4. IPv6 discard the Checksum field because theupper-layer protocol can handle the checksum.
5. IPv6 replace Optional field of IPv4 withExtension Header.
- 网络的经济基础篇-之二-IPv4、IPv6
- 网络的经济基础篇-之三-AH、ESP
- 网络的经济基础篇-之一-TCP、UDP
- IPv4 和 IPv6 的网络接口操作
- IPv4 和 IPv6 的网络接口操作
- 网络层学习之二(IPv4及IPv6地址及相关协议)
- iOS测试:IPV4下搭建IPV6网络 测试app在IPV4和IPV6下的兼容性
- Unix网络编程学习笔记之第12章 IPv4与IPv6的互操作性
- ipv4和ipv6对应的二层MAC地址之---------单播、组播
- ipv6 ipv4的不同
- Beej的网络编程入门教程 第五篇 从IPv4到IPv6
- 网络大过渡 IPv4过渡到IPv6的十个技巧
- IPv4嵌入到IPv6的网络中的路由(RFC6992)
- 客户端底层 Socket 实现IPV4 IPV6网络环境的兼容
- TCP/IP协议 之IPV4与IPV6的区别
- IPv6下网络编程socket, TCP和UDP例子,以及兼容IPV4和IPV6的类
- IPv6下网络编程socket, TCP和UDP例子,以及兼容IPV4和IPV6的类
- 升级支持ipv4/ipv6后的Socket处理(cocos2dx项目苹果审核支持ipv6处理二)
- 基金投资的8大误区
- 那些年,我们一起追的女孩(简单介绍)
- Python基础知识(五)--数据类型
- 不要因傲慢与偏见而拒绝基金
- 设计模式随笔系列:开篇-模式和原则 [转]
- 网络的经济基础篇-之二-IPv4、IPv6
- 黄祖斌:不买基金就是和钱过不去
- Python基础知识(六)--字符串
- GATEWAY获取与设置(Linux C)
- 验证码的破解
- 本轮下跌基金科汇净值只下跌了0.22%
- 对中国所有散户的建议
- Activity跳转:android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- 设计模式随笔系列:鸭子-策略模式(Strategy)[转]