Volume sixteen chapters: IP

Before the chapter:
the TCP / the IP network layer stack located between the transport layer and network interface layer, which includes a main protocols: IP, ARP, RARP, ICMP , IGMP and the like. Where IP is the TCP / IP protocol stack of the core, he specifies how data is encapsulated, the method identifies a network node, the network end to end data transfer for

 

TCP / IP protocol at the network layer are defined:
". 1" the IP: network layer is responsible for addressing, routing, segmentation and reassembly of the packet.
"2" ARP, responsible for IP address resolution into a physical address. In the actual communication, the physical network used is a physical address, IP address can not be identified by the physical network. For Ethernet, when IP packets over Ethernet, Ethernet MAC address of the device is transmitting data, the ARP is to resolve IP addresses into MAC addresses.
"3" RARP: responsible for the physical address to an IP address.
"4" ICMP: network layer defines the control and message transfer functions, IP packets can be transmitted error reporting, and other failures that occur during the message, providing a diagnosis;
". 5" the IGMP: manages the IP multicast group. Support for multicast transmission of data between hosts and routers. It allows all routers on a single physical network know the current network in which the host needs to multicast. Multicast routers need this information in order to know the multicast packet should be forwarded to which interfaces.

 

 

The following will explain each protocol refinement:

IP:
(1) the definition: IP protocol is defined by RCF791, IP is a best effort network protocol. IP does not care about the contents of the packet can not guarantee whether it can successfully reach the destination. Reliability of the connection-oriented TCP protocol upper layer is achieved.
(2) effect:
"1" identifies nodes and links; each link is not assigned a globally unique network number, assigns a globally unique 32-bit IP address of the node;
"2" and the forwarding address; The router the master routing information, network location determining node is located, and to determine the position of the node is located, and select the appropriate path forwarding.
"3" to adapt to a variety of data-link: to work on a variety of media and a link, the IP link must have a function to adapt to, for example, fragmentation and reassembly in accordance with the link MTU;

 

(3) IP packet header structure :( screenshot)

 

 

 (4)IP地址格式及表示方法:
在计算机内部,IP地址为二进制32位bit:
11000000 10101000 00000101 01111011
通常我们把它使用十进制并以8个二进制为一段分成4段,就变成:
192.168.5.123

分类:
A类地址:网络位从第一个八位段以0开始,顺序1-8bit(共占7bit)。而主机位为后三个八段位(24bit),所以A类地址的范围为1.0.0.0----126.255.255.255,每个A类网络有2的24次方A类地址

B类地址:网络位从第一个八位段以10开始,顺序3-16bit(共占14bit)。而主机位为后两个八段位(16bit),所以B类地址的范围为从A类最大地址+特殊A类环回测试(127.0.0.0/8)128.0.0.0----191.255.255.255,每个B类网络有2的16次方B类地址;、

C类地址:网络位从第一个八位段以110开始,顺序4-24bit(共占21bit)。而主机位为后一个八段位(8bit),所以C类地址的范围从B类地址最大地址(191.255.255.255)192.0.0.0----223.255.255.255,每个C类网络有2的8次方C类地址

D类地址:网络位从第一个八位段以1110开始,因此范围为224-239,通常为组播地址

 

 

IP地址划分------而衍生出子网掩码的需求
IP地址分为网络号和主机号,为了划分子网,借用主机号几位来表示子网号,剩下的仍为主机号。于是两级的IP地址就变为三级的IP地址。这样就可以划分若干个子网。

 

 

 (5)计算子网的计算
《1》已知掩码,求到可用主机数;(不需要考虑子网号)
公式:2的N次方-2=可用主机数
例如192.168.1.0/24:
块大小 32-24(网络位)=8;
2的8次方再减二=256-2=254

《2》已经要求分配主机数量,求子网数目:(需要考虑子网号)
公式:2的N次方=可分配子网数量
例如168.195.0.0  要求划分主机数量700个以上的网络
计算主机号:2的N次方=700+2(2位主机和广播地址),N约为10
计算子网位:168.195位B类地址,那么第八位段中子网号位为8-2(10-2)=6;
所以2的6次方=64,可以分出64个子网,每个子网为168.195.0.0,168.195.4.0…………

《3》已知子网个数,求主机数量:(需要考虑子网号)
公式:同上一样,2的M次方=分配子网数量
例如168.195.0.0,要求划分27个子网,尽可能分更多的主机
求主机号:2的M次方=27,M=5,接着由于168.196是B类地址,求得主机号N=32-16-5=11
所以主机数量2的11次方=2046,可分得2的5次方=32个子网,取其中27个即可;

 


(6)VLSM和CIDR
VLSM:variable length subnet mask,可变长子网掩码,即允许对一个网络可以使用不同大小的子网掩码,通过对二级划分网络进行再划分,以提高地址利用率。原理就是通过向主机位借位的方式,实现地址的精确编址以及提高网络的灵活性与可用性。
注意VLSM使用在路由协议上,要求协议必须支持VLSM;

CIDR:classless inter-Domain Routing,无类别域间路由,简单来说就是取消IP地址的分类结构,将多个地址块聚合成一个更大的网路,通过支持路由聚合,使得路由表项变少。
CIDR是基于VLSM来进行任意长度的前缀的分配的。

区别:(我的理解)VLSM是将1个子网再细化成多个子网;而CIDR将多个子网聚合成1个子网。

Guess you like

Origin www.cnblogs.com/key-network/p/12419771.html