网络工程师-3-IP地址.ppt
Chapter 3 IP 地址划分,概述,IP 地址分类子网划分 规划IP地址 在WIN2000中指定IP地址CIDR,基础,运算二进制与十进制转换二进制与十六进制,八进制转换,(help),Boolean algebra review,Boolean operators:AND.OR.NOT.,AND operator,1 AND 1=11 AND 0=00 AND 1=00 AND 0=0,OR operator,1 OR 1=11 OR 0=10 OR 1=10 OR 0=0,NOT operator,NOT 1=0NOT 0=1,Boolean algebra examples,1010 AND 0110=00101010 OR 0110=1110,IP地址,什么是IP地址它是一种协议地址,别的协议可能会有自己的地址,不叫IP地址,这种地址是此协议用来定位计算机时用的IP地址的分类(A.B.C.D.E)A类(1-126)即:1.B类(128-191)即:128.0.y.z-191.255.y.z C类(192-223)即:192.0.0.,IP地址的分类,A类地址:头一位是0(w.x.y.z)B类地址:头两位是10(w.x.y.z)C类地址:头三位是110(w.x.y.z)网络ID和主机ID的作用(根据子网掩码来分的)地址分配原则:网络ID不能为127,主机ID不能全为0或者全为255,主机ID对于每个网络ID是唯一的。网络ID(192.168.0)主机ID(1),子网掩码(subnet mask),IP 地址内的网络 ID 和主机 ID 用子网掩码区分。每个子网掩码都是一个 32 位数,使用连续的都是 1 的位组标识网络 ID,都是 0 的位组标识 IP 地址的主机 ID。例如,IP 地址 131.107.16.200 通常使用子网掩码是以下 32 位二进制数:11111111 11111111 00000000 00000000 该子网掩码是 16 个都是 1 的位,后跟 16 个都是 0 的位,表示 IP 地址的网络 ID 和主机 ID 长度上都是 16 位。通常,该子网掩码显示成带点的十进制符号 255.255.0.0。A 类11111111 00000000 00000000 00000000B 类11111111 11111111 00000000 00000000C 类11111111 11111111 11111111 00000000,地址类别小结,类别 十进制表示前8位 网络标识的数 主机标识 A 1-126 8 24 B 128-191 16 16C 192-223 24 8,Example:,is Class B addressNetwork portion:172.16Host portion:20.200Network address:Broadcast address:,SMIPLE,C,137,A,123,B,150.127,221.244,C,199,B,175.12,239.244,Default subnet mask:Example,192.168.2.100/255.255.255.0.11000000.10101000.00000010.01100100.11111111.11111111.11111111.00000000.11000000.10101000.00000010.01100100.Class C network:24 bits for network portion.0 bits for subnet portion.8 bits for host portion.Subnet address:192.168.2.0.,Subnet mask:Example,172.16.65.100/255.255.240.0.10101100.00010000.01000001.01100100.11111111.11111111.11110000.00000000.10101100.00010000.01000001.01100100.Class B network:16 bits for network portion.4 bits for subnet portion.12 bits for host portion.Subnet address:172.16.64.0.,TCP/IP 工作原理,将IP地址与子网掩码相互操作,得出网络IP若相同,表示在同一子网,直接通信,若不同,表示在不同子网,找路由器,路由再发出广播.,Routing table,Router function,Router function,Router function(cont.1),Strips off the data link header,carried by the frame.(The data link header contains the MAC addresses of the source and destination.),Router function(cont.2),Examines the network layer address to determine the destination network.,Router function(cont.3),Consults its routing tables to determine which of its interfaces it will use to send the data,in order for it to reach its destination network.,Router function(cont.4),Send the data out interface B1,the router would encapsulate the data in the appropriate data link frame.,子网,为什么要子网?(子网是TCP/IP环境中的一个物理段,划分子网可以克服当前技术的局限,例如超过每一段主机的最大数目。你可以重新定向网络流和减少广播,降低网络的拥挤程度。)子网掩码如何计算?1.确定子网掩码 2.将子网(主机)数量转换成二进制 3.计算所使用的位数 4.通过计算可得子网掩码(举例)确定主机数量和子网数量(举例)计算子网地址(举例)计算主机地址(举例),(举例),192.168.10.0,需要13个子网来取代相互独立的网络,需要什么样的子网掩码呢?192.168.15.0,划分31个不同的子网.如果是B类地址呢?,TCP/IP 地址测试,PING PING IP 地址-TCP/IP 协议初始化正确PING 本机地址-网卡NDIS 绑定正确PING 同一子网地址-本子网网络已通PING 缺省网关-路由器配置正确PING对方不同子网地址-这一段网络已通,IP 地址,192.168.1.100,192.168.2.101,192.168.2.100,192.168.3.100,Host ID,Network ID,IP 地址分类-1,w,x,y,z,Class A,Network ID,Host ID,Class B,Network ID,Host ID,Class C,Network ID,Host ID,Class A:Class B:Class C:Class D:Multicast Class E:Research,IP 地址分类-2,8 bits,8 bits,8 bits,8 bits,IP 地址分类3,1,A:,0NNNNNNN,Host,Host,Host,8,9,16,17,24,25,32,Range(1-126),1,B:,10NNNNNN,Network,Host,Host,8,9,16,17,24,25,32,Range(128-191),1,C:,110NNNNN,Network,Network,Host,8,9,16,17,24,25,32,Range(192-223),1,D:,1110MMMM,Multicast Group,Multicast Group,Multicast Group,8,9,16,17,24,25,32,Range(224-239),Address,Class,Network,Host,Nonexistent,IP 地址分类练习,子网划分,子网子网掩码判断本地主机、远程主机,子网,一个子网是一个广播域,子网掩码,判断本地主机、远程主机,比较:源 NetID 目的 NetID 相等:Local 不相等:Remote,规划IP地址,一般原则 指定 NetIDs 指定 Host IDs,一般原则,The Host ID 不能 全 0,The Host ID 不能全 255,Network ID 第一个字节不能是 127,本网络内 Host ID 必须唯一,特殊IP地址,类型Host ID例子,指定 NetIDs,1,2,3,10.0.0.0,192.168.2.0,172.16.0.0,指定 Host IDs,1,2,172.16.0.12,172.16.0.11,172.16.0.10,10,10,10,.11,.10,192.168.2.1,10.,172.16.0.1,3,10.0.0.0,192.168.2.0,172.16.0.0,在WIN2000中指定IP地址,静态IP地址 动态获得IP地址查看IP地址配置用 Ipconfig 查看TCP/IP配置,静态IP地址,动态获得IP地址,查看IP地址配置,用 Ipconfig 查看TCP/IP配置,CIDR 概述,Classless Inter-Domain Routing(CIDR)二进制IP地址 二进制子网掩码 用 CIDR 划分IP地址,Classless Inter-Domain Routing(CIDR),传统A、B、C类IP地址的划分的缺点 CIDR 无类的IP地址划分,传统A、B、C类IP地址的划分的缺点,CIDR,二进制IP地址,点分十进制二进制Converting to Binary Format Using a Calculator,十进制二进制,Converting to Binary Format Using a Calculator,二进制子网掩码,子网掩码位CIDR 表示掩码计算 Net ID判断本地主机、远程主机,子网掩码位,CIDR 表示掩码,计算 Net ID,IPAddress,Subnet Mask,NetworkID,Network ID in CIDR Notation,255.255.240.0,11111111 11111111 11110000 00000000,10.217.123.7,00001010 11011001 01111011 00000111,00001010 11011001 01110000 00000000,判断本地主机、远程主机,可用的 Host Ids,16,172,2,160,10101100,00010000,10100000,00000010,Host,Mask,Subnet,Broadcast,Last,First,4,1,IP地址练习,10101100,11111111,00010000,11111111,11111111,10100000,11000000,00000010,Host,Mask,Subnet,Broadcast,Last,First,1,2,16,172,2,160,IP地址练习,10101100,11111111,00010000,11111111,11111111,10100000,11000000,00000010,Host,Mask,Subnet,Broadcast,Last,First,1,2,3,7,16,172,2,160,IP地址练习,10101100,11111111,00010000,11111111,11111111,10100000,11000000,10000000,00000010,Host,Mask,Subnet,Broadcast,Last,First,1,2,3,4,16,172,2,160,IP地址练习,10101100,11111111,00010000,11111111,11111111,10100000,11000000,10000000,00000010,10111111,Host,Mask,Subnet,Broadcast,Last,First,1,2,3,4,5,6,16,172,2,160,IP地址练习,10101100,11111111,00010000,11111111,11111111,10100000,11000000,10000000,00000010,10111111,10000001,Host,Mask,Subnet,Broadcast,Last,First,1,2,3,4,5,6,16,172,2,160,IP地址练习,10101100,11111111,00010000,11111111,11111111,10100000,11000000,10000000,00000010,10111111,10000001,10111110,Host,Mask,Subnet,Broadcast,Last,First,1,2,3,4,5,6,7,16,172,2,160,IP地址练习,10101100,11111111,10101100,00010000,11111111,00010000,11111111,00000010,10100000,11000000,10000000,00000010,10101100,00010000,00000010,10111111,10101100,00010000,00000010,10000001,10101100,00010000,00000010,10111110,Host,Mask,Subnet,Broadcast,Last,First,1,2,3,4,5,6,7,8,16,172,2,160,IP地址练习,10101100,11111111,10101100,00010000,11111111,00010000,11111111,00000010,10100000,11000000,10000000,00000010,10101100,00010000,00000010,10111111,10101100,00010000,00000010,10000001,10101100,00010000,00000010,10111110,Host,Mask,Subnet,Broadcast,Last,First,1,2,3,4,5,6,7,8,9,16,172,2,160,IP地址练习,Address,Class,Subnet,Broadcast,201.222.10.60,Subnet Mask,15.16.193.6,128.16.32.13,153.50.6.27,IP地址练习-计算广播地址,