《原版CCNA教材第3章TCPIP协议栈.ppt》由会员分享,可在线阅读,更多相关《原版CCNA教材第3章TCPIP协议栈.ppt(84页珍藏版)》请在三一办公上搜索。
1、第三章TCP/IP协议栈,通过本章的学习,您应该掌握以下内容:了解TCP/IP协议栈,各个分层的主要功能、IP协议的应用 掌握IP地址分类,子网掩码的作用,识别网络标识号、主机标识号,子网的数目 理解OSI和TCP/IP模型的区别和联系掌握三次握手过程,本章目标,早期的协议族全球范围,TCP/IP介绍,主机,Internet,TCP/IP,主机,TCP/IP 协议族,5,4,3,2,5,4,3,2,应用层,表达层,会话层,传输层,网络层,数据链路层,物理层,1,应用层,传输层,Internet层,数据链路层,物理层,1,应用层概述,应用层,传输层,Internet层,数据链路层,物理层,文件传
2、输-TFTP 69-FTP 21/20-NFS 2049E-Mail-SMTP 25远程登陆-Telnet 23-rlogin 网络管理-SNMP 161名称管理-DNS 53,传输层概述,Transmission ControlProtocol(TCP)User Datagram Protocol(UDP),应用层,传输层,Internet层,数据链路层,物理层,面向连接非面向连接,TCP 数据格式,Source port(16),Destination port(16),Sequence number(32),Headerlength(4),Acknowledgement number(3
3、2),Reserved(6),Code bits(6),Window(16),Checksum(16),Urgent(16),Options(0 or 32 if any),Data(varies),20Bytes,Bit 0,Bit 15,Bit 16,Bit 31,端口号,TCP,端口号,FTP,传输层,TELNET,DNS,SNMP,TFTP,SMTP,UDP,应用层,21,23,25,53,69,161,RIP,520,TCP 端口号,源端口,目标端口,Host A,1028,23,SP,DP,Host Z,Telnet Z,目标端口=23.,发送 SYN(seq=100 ctl=SY
4、N),接收 SYN,Host A,Host B,TCP 三次握手,发送 SYN(seq=100 ctl=SYN),接收 SYN,发送 SYN+ACK(seq=300 ack=101 ctl=syn,ack),Host A,Host B,接收 SYN,TCP 三次握手,发送 SYN(seq=100 ctl=SYN),接收 SYN,发送 SYN+ACK(seq=300 ack=101 ctl=syn,ack),建立会话(seq=101 ack=301 ctl=ack),Host A,Host B,接收 SYN,TCP 三次握手,TCP 简单确认,滑动窗口=1,发送方,接收方,TCP 简单确认,滑动
5、窗口=1,发送方,接收方,发送 1,接收 1,TCP 简单确认,滑动窗口=1,发送方,接收方,发送 1,接收 1,接收 ACK 2,发送 ACK 2,TCP 简单确认,滑动窗口=1,发送方,接收方,发送 1,接收 1,接收 ACK 2,发送 ACK 2,发送 2,接收 2,TCP 简单确认,滑动窗口=1,发送方,接收方,发送 1,接收 1,接收 ACK 2,发送 ACK 2,发送 2,接收 2,接收 ACK 3,发送 ACK 3,TCP 简单确认,滑动窗口=1,发送方,接收方,发送 1,接收 1,接收 ACK 2,发送 ACK 2,发送 2,接收 2,接收 ACK 3,发送 ACK 3,发送
6、3,接收 3,滑动窗口=1,发送方,接收方,发送 1,接收 1,接收 ACK 2,发送 ACK 2,发送 2,接收 2,接收 ACK 3,发送 ACK 3,发送 3,接收 3,接收 ACK 4,发送 ACK 4,TCP 简单确认,TCP 顺序号和确认号,源端口,目标端口,顺序号#,确认号#,Source,Dest.,Seq.,Ack.,1028,23,10,1,我发送#10.,TCP 顺序号和确认号,我已收到#10,现在我需要#11.,源端口,目标端口,顺序号#,确认号#,1028,23,Source,Dest.,10,Seq.,1,Ack.,1028,23,Source,Dest.,11,S
7、eq.,1,Ack.,我发送#10.,TCP 顺序号和确认号,源端口,目标端口,顺序号#,确认号#,1028,23,Source,Dest.,11,Seq.,2,Ack.,1028,23,Source,Dest.,10,Seq.,1,Ack.,1028,23,Source,Dest.,11,Seq.,1,Ack.,我已收到#10,现在我需要#11.,我发送#10.,TCP 顺序号和确认号,源端口,目标端口,顺序号#,确认号#,1028,23,Source,Dest.,11,Seq.,2,Ack.,1028,23,Source,Dest.,10,Seq.,1,Ack.,1028,23,Sourc
8、e,Dest.,11,Seq.,1,Ack.,1028,23,Source,Dest.,12,Seq.,2,Ack.,我已收到#11,现在我需要#12.,我发送#11,TCP 窗 口,发送方,接收方,TCP 窗 口,Window size=3Send 2,发送方,接收方,Window size=3Send 1,Window size=3Send 3,Window size=3Send 2,TCP 窗 口,发送方,Window size=3Send 1,Window size=3Send 3,ACK 3Window size=2,数据 3 被丢弃,接收方,Window size=3Send 2,
9、TCP 窗 口,发送方,Window size=3Send 1,Window size=3Send 3,ACK 3Window size=2,数据 3 被丢弃,Window size=3Send 4,Window size=3Send 3,接收方,Window size=3Send 2,TCP 窗 口,发送方,Window size=3Send 1,Window size=3Send 3,ACK 3Window size=2,数据 3 被丢弃,Window size=3Send 4,Window size=3Send 3,ACK 5Window size=2,接收方,没有顺序号和确认号,UDP
10、 数据格式,Source port(16),Destination port(16),Length(16),Data(if any),1,Bit 0,Bit 15,Bit 16,Bit 31,Checksum(16),8Bytes,Internet 层概述,OSI 网络层对应的是TCP/IP的internet层,Internet Protocol(IP)Internet Control MessageProtocol(ICMP)Address ResolutionProtocol(ARP)Reverse AddressResolution Protocol(RARP),应用层,传输层,Inte
11、rnet层,数据链路层,物理层,IP 数据,Version(4),Destination IP Address(32),Options(0 or 32 if any),Data(varies if any),1,Bit 0,Bit 15,Bit 16,Bit 31,HeaderLength(4),Priority&Type of Service(8),Total Length(16),Identification(16),Flags(3),Fragment offset(13),Time to live(8),Protocol(8),Header checksum(16),Source IP
12、Address(32),20Bytes,决定上层协议,协议域,TransportLayer,InternetLayer,TCP,UDP,ProtocolNumbers,IP,17,6,ICMP协议,Application,Transport,Internet,Data Link,Physical,Destination UnreachableEcho(Ping)Other,ICMP,1,互联网控制消息协议ICMP,通过ICMP协议,主机和路由器可以报告错误并交换相关的状态信息。在下列情况中,通常自动发送ICMP消息:IP数据报无法访问目标。IP路由器(网关)无法按当前的传输速率转发数据报。IP
13、路由器将发送主机重定向为使用更好的到达目标的路。ICMP协议的结构如图2-26所示。,ICMP协议的结构,ICMP协议的头结构,ICMP头结构比较简单,如表2-9所示。,ICMP数据报分析,使用Ping命令发送ICMP回应请求消息,使用Ping命令,可以检测网络或主机通讯故障并解决常见的TCP/IP连接问题。分析Ping指令的数据报,如图2-27所示。,ARP协议,172.16.3.1,172.16.3.2,IP:172.16.3.2=?,我需要知道176.16.3.2的物理地址.,ARP协议,172.16.3.1,172.16.3.2,IP:172.16.3.2=?,ARP协议,172.16
14、.3.1,IP:172.16.3.2 Ethernet:0800.0020.1111,172.16.3.2,IP:172.16.3.2=?,ARP协议,映射 IP EthernetLocal ARP,172.16.3.1,IP:172.16.3.2 Ethernet:0800.0020.1111,172.16.3.2,IP:172.16.3.2=?,RARP协议,Ethernet:0800.0020.1111 IP=?,我的地址是多少?,RARP协议,Ethernet:0800.0020.1111 IP=?,我的地址是多少?,我听到了广播你的地址是 172.16.3.25.,RARP协议,Et
15、hernet:0800.0020.1111IP:172.16.3.25,Ethernet:0800.0020.1111 IP=?,我的地址是多少?,我听到了广播你的地址是 172.16.3.25.,RARP协议,映射 Ethernet IP,Ethernet:0800.0020.1111IP:172.16.3.25,Ethernet:0800.0020.1111 IP=?,我的地址是多少?,我听到了广播你的地址是 172.16.3.25.,断点连接需要确定的地址路径选择,TCP/IP地址介绍,172.18.0.2,172.18.0.1,172.17.0.2,172.17.0.1,172.16.
16、0.2,172.16.0.1,SA,DA,HDR,DATA,10.13.0.0,192.168.1.0,10.13.0.1,192.168.1.1,IP 地 址,255,255,255,255,DottedDecimal,Maximum,Network,Host,32 bits,IP 地 址,255,255,255,255,DottedDecimal,Maximum,Network,Host,1286432168421,11111111,11111111,11111111,11111111,Binary,32 bits,1,8,9,16,17,24,25,32,1286432168421,12
17、86432168421,1286432168421,IP 地 址,255,255,255,255,DottedDecimal,Maximum,Network,Host,1286432168421,11111111,11111111,11111111,11111111,10101100,00010000,01111010,11001100,Binary,32 bits,172,16,122,204,ExampleDecimal,ExampleBinary,1,8,9,16,17,24,25,32,1286432168421,1286432168421,1286432168421,Class A:
18、Class B:Class C:Class D:多址地址 Class E:科研用,IP 地址分类,8 bits,8 bits,8 bits,8 bits,IP 地址分类,1,Class A:,Bits:,0NNNNNNN,Host,Host,Host,8,9,16,17,24,25,32,Range(1-126),1,Class B:,Bits:,10NNNNNN,Network,Host,Host,8,9,16,17,24,25,32,Range(128-191),1,Class C:,Bits:,110NNNNN,Network,Network,Host,8,9,16,17,24,25,3
19、2,Range(192-223),1,Class D:,Bits:,1110MMMM,Multicast Group,Multicast Group,Multicast Group,8,9,16,17,24,25,32,Range(224-239),主机地址,172.16.2.1,172.16.3.10,172.16.12.12,10.1.1.1,10.250.8.11,10.180.30.118,E1,172.16,12,12,网络,主机,.,.,网络,端口,172.16.0.010.0.0.0,E0E1,路由表,172.16.2.1,10.6.24.2,E0,11111111,计算可用的主
20、机地址,172 16 0 0,10101100,00010000,00000000,00000000,16151413121110 9,87654321,网络,主机,00000000,00000001,11111111,11111111,11111111,11111110,.,.,00000000,00000011,11111101,1,2,3,65534,65535,65536,-,.,2,65534,N,2N-2=216-2=65534,IP地址分类练习,地址,类别,网络,主机,10.2.1.1,128.63.2.100,201.222.5.64,192.6.141.2,130.113.6
21、4.16,256.241.201.10,IP地址分类练习(答案),地址,类别,网络,主机,10.2.1.1,128.63.2.100,201.222.5.64,192.6.141.2,130.113.64.16,256.241.201.10,A,B,C,C,B,Nonexistent,10.0.0.0,128.63.0.0,201.222.5.0,192.6.141.0,130.113.0.0,0.2.1.1,0.0.2.100,0.0.0.64,0.0.0.2,0.0.64.16,网络 172.16.0.0,172.16.0.0,不设子网的地址,172.16.0.1,172.16.0.2,1
22、72.16.0.3,.,172.16.255.253,172.16.255.254,网络 172.16.0.0,设置子网的地址,172.16.1.0,172.16.2.0,172.16.3.0,172.16.4.0,子网地址,172.16.2.200,172.16.2.2,172.16.2.160,172.16.2.1,172.16.3.5,172.16.3.100,172.16.3.150,E0,172.16,网络,网络,端口,172.16.0.0172.16.0.0,E0E1,新路由表,2,160,主机,.,.,172.16.3.1,E1,子网地址,172.16.2.200,172.16.
23、2.2,172.16.2.160,172.16.2.1,172.16.3.5,172.16.3.100,172.16.3.150,172.16.3.1,E0,E1,172.16,2,160,网络,主机,.,.,网络,端口,172.16.2.0172.16.3.0,E0E1,新路由表,子网,子网掩码,255,255,0,0,IPAddress,DefaultSubnetMask,8-bitSubnetMask,Network,Host,Network,Host,Network,Subnet,Host,“/16”表示子网掩码有16位.,“/24”表示子网掩码有24位.,11111111,11111
24、111,00000000,00000000,十进制和二进制的转换,10000000=12811000000=19211100000=22411110000=24011111000=24811111100=25211111110=25411111111=255,128 6432168421,16,网络,主机,172,0,0,10101100,11111111,10101100,00010000,11111111,00010000,00000000,00000000,10100000,00000000,00000000,缺省情况下子网未划分,00000010,缺省情况下的子网掩码,172.16.2
25、.160,255.255.0.0,网络号,扩展了8位地址的网络,利用子网掩码划分子网,16,网络,主机,172.16.2.160,255.255.255.0,172,2,0,10101100,11111111,10101100,00010000,11111111,00010000,11111111,00000010,10100000,00000000,00000000,00000010,子网,网络号,128192224240248252254255,利用子网掩码划分子网,网络,主机,172.16.2.160,255.255.255.192,10101100,11111111,10101100,
26、00010000,11111111,00010000,11111111,00000010,10100000,11000000,10000000,00000010,子网,扩展了10位地址的网络,16,172,2,128,网络号,128192224240248252254255,128192224240248252254255,子网掩码练习,地址,子网掩码,类别,子网,172.16.2.10,10.6.24.20,10.30.36.12,255.255.255.0,255.255.240.0,255.255.255.0,子网掩码练习(答案),地址,子网掩码,类别,子网,172.16.2.10,10
27、.6.24.20,10.30.36.12,255.255.255.0,255.255.240.0,255.255.255.0,B,A,A,172.16.2.0,10.6.16.0,10.30.36.0,广播地址,172.16.1.0,172.16.2.0,172.16.3.0,172.16.4.0,172.16.3.255(Directed broadcast),255.255.255.255(Local network broadcast),X,172.16.255.255(All subnets broadcast),地址汇总示例,16,172,2,160,10101100,0001000
28、0,10100000,00000010,Host,Mask,Subnet,Broadcast,Last,First,172.16.2.160,255.255.255.192,4,1,地址汇总示例,10101100,11111111,00010000,11111111,11111111,10100000,11000000,00000010,Host,Mask,Subnet,Broadcast,Last,First,172.16.2.160,255.255.255.192,1,2,16,172,2,160,地址汇总示例,10101100,11111111,00010000,11111111,111
29、11111,10100000,11000000,00000010,Host,Mask,Subnet,Broadcast,Last,First,172.16.2.160,255.255.255.192,1,2,3,7,16,172,2,160,地址汇总示例,10101100,11111111,00010000,11111111,11111111,10100000,11000000,10000000,00000010,Host,Mask,Subnet,Broadcast,Last,First,172.16.2.160,255.255.255.192,1,2,3,4,16,172,2,160,地址汇
30、总示例,10101100,11111111,00010000,11111111,11111111,10100000,11000000,10000000,00000010,10111111,Host,Mask,Subnet,Broadcast,Last,First,172.16.2.160,255.255.255.192,1,2,3,4,5,6,16,172,2,160,地址汇总示例,10101100,11111111,00010000,11111111,11111111,10100000,11000000,10000000,00000010,10111111,10000001,Host,Mas
31、k,Subnet,Broadcast,Last,First,172.16.2.160,255.255.255.192,1,2,3,4,5,6,16,172,2,160,地址汇总示例,10101100,11111111,00010000,11111111,11111111,10100000,11000000,10000000,00000010,10111111,10000001,10111110,Host,Mask,Subnet,Broadcast,Last,First,172.16.2.160,255.255.255.192,1,2,3,4,5,6,7,16,172,2,160,地址汇总示例,
32、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,172.16.2.160,255.255.255.192,1,2,3,4,5,6,7,8,1
33、6,172,2,160,地址汇总示例,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,172.16.2.160,255.255.255.19
34、2,172.16.2.128,172.16.2.191,172.16.2.129,172.16.2.190,1,2,3,4,5,6,7,8,9,16,172,2,160,划分子网路由器转发分组算法,1、从收到的数据报的首部提取目的IP地址D2、先判断是否为直接交付。3、若路由表中有目的地址为D的特定主机路由,则将数据报传送给路由表中所指明的下一跳路由器4、对路由表中的每一行,将其中的子网掩码和D逐比特相“与”,5、若路由表中有一个默认路由,则将数据报传送给路由表中所指明的默认路由器;否则,执行(6)。6、报告转发分组出错。,IP Host Address:172.16.2.121Subnet
35、Mask:255.255.255.0,Subnet Address=172.16.2.0Host Addresses=172.16.2.1172.16.2.254Broadcast Address=172.16.2.255Eight bits of subnetting,Network,Subnet,Host,10101100,00010000,00000010,11111111,172.16.2.121:,255.255.255.0:,10101100,11111111,Subnet:,10101100,00010000,00010000,11111111,00000010,00000010
36、,11111111,01111001,00000000,00000000,B类地址子网规划,Broadcast:,Network,子网划分,Other subnets,192.168.5.16,192.168.5.32,192.168.5.48,20 子网5 主机/子网C类地址:192.168.5.0,11111000,IP Host Address:192.168.5.121Subnet Mask:255.255.255.248,Network,Subnet,Host,192.168.5.121:,11000000,11111111,Subnet:,11000000,10101000,101
37、01000,11111111,00000101,00000101,11111111,01111001,01111000,255.255.255.248:,C类地址子网规划,Subnet Address=192.168.5.120Host Addresses=192.168.5.121192.168.5.126Broadcast Address=192.168.5.127Five Bits of Subnetting,Broadcast:,Network,Network,11000000,10101000,00000101,01111111,广播地址练习,地址,类别,子网,广播地址,201.22
38、2.10.60,255.255.255.248,子网掩码,15.16.193.6,255.255.248.0,128.16.32.13,255.255.255.252,153.50.6.27,255.255.255.128,广播地址练习(答案),153.50.6.127,地址,类别,子网,广播地址,201.222.10.60,255.255.255.248,C,201.222.10.63,201.222.10.56,子网掩码,15.16.193.6,255.255.248.0,A,15.16.199.255,15.16.192.0,128.16.32.13,255.255.255.252,B,128.16.32.15,128.16.32.12,153.50.6.27,255.255.255.128,B,153.50.6.0,本章总结,完成本章的学习后,你应该能够掌握:了解TCP/IP协议族和各层的作用划分子网,识别IP地址的网络号和主机号,问题回顾,1.TCP协议和UDP协议有什么不同?2.和IP地址为:192.168.20.1 255.255.255.240,在同一网段的主机有哪些?3.OSI和TCP/IP层次模型的区别4.TCP/IP的优点5.ARP和RARP各用在什么场合,