12网络软件设计computer network programming slide int协议介绍_第1页
12网络软件设计computer network programming slide int协议介绍_第2页
12网络软件设计computer network programming slide int协议介绍_第3页
12网络软件设计computer network programming slide int协议介绍_第4页
12网络软件设计computer network programming slide int协议介绍_第5页
已阅读5页,还剩46页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Internet协议介绍TCP/IP Protocol Suite - LayeringlinknetworkapplicationARPRARPHardware InterfaceICMPIGMPIPmediatransportTCPUDPUserprocessUserprocessUserprocessUserprocessFigure 1.4 Various protocols at the different layers in the TCP/IP protocol suiteICMP:Internet Control Message ProtocolIGMP:Internet Gr

2、oupManagement ProtocolIP:Internet ProtocolARP:Address Resolution ProtocolRARP:Reverse Address Resolution ProtocolTCP:Transmission Control ProtocolUDP:User Datagram ProtocolFigure 2.1 IEEE 802.2/802.3 encapsulation(RFC 1042) and Ethernet encapsulation(RFC894) 6destinationaddr.6sourceaddr.2lengthDSAPA

3、A1SSAPAA1cntl1org code 003type2data38 - 1492CRC4type08002IP datagram38 - 1492type08062ARP request/reply28PAD10type80352RARP request/reply28PAD106destinationaddr.6sourceaddr.2typedata46 - 1500CRC4type08002IP datagram46 - 1500type08062ARP request/reply28PAD18type80352RARP request/reply28PAD1846 - 1500

4、IEEE 802.2/802.3 encapsulation(RFC 1042):Ethernet encapsulation(RFC894) : 802.3 MAC802.2 LLC802.2 SNAP ARP Cache maintains the recent mappings from Internet addresses to hardware addresses The normal expiration time of an entry in the cache is 20 minutes from the time the entry was createdresolverFT

5、P(1)hostnameIP addr.TCPIPARPEthernetdriverEthernetdriverEthernetdriverARPARPIPTCP(2) establish connection with IP address(3)send IP datagram to IP address(4)(5)ARP request (Ethernet broadcast) (6)(7)(8) (9)hostnameFigure 4.2 Operation of ARP when user types “ftp hostname” The special Ethernet destin

6、ation address of all one bits means the broadcast address.Ethernetdestination addrEthernetsource addrframe typehard typeprot typeopsenderIP addrtargetIP addrSenderEthernetaddrtargetEthernet addrEthernet header28 bytes ARP request/reply662221 126464prot sizehard sizeFigure 4.3 Format of ARP request o

7、r reply packet when used on an Ethernet = 0 x0806=1: for Ethernet= 0 x0800: for IP address=1: ARP request; =2: ARP reply (2); =3: RARP request; =4: RARP replyIP AddressesIP address formats.IP Addresses (2)Special IP addresses.number of 32-bit words in the header3-bit precedence field; 4 TOS bits, an

8、d an unused bit set to 0 total length of the IP datagram in bytesuniquely identifies each datagram sentupper limit on the number of routers through which a datagram can passcalculated over IP header onlyA variable-length list of optional informationOptions defined: security and handling restrictions

9、, record route, timestamp, loose source routing, strict source routingThese options are rarely used and not all hosts and routers support all the optionsdont fragmentation.contains the offset of this fragment from the beginning of the original datagram.turned on for each fragment comprising a datagr

10、am except the final fragment.IP Header4-bitversion4-bit headerlength4-bit type of service(TOS)16-bit total length (in bytes)16-bit identification0DFMF13-bit fragment offset8-bit time to live(TTL)8-bit protocol16-bit header checksum32-bit source IP address32-bit destination IP addressoption (if any)d

11、ata20 bytesIP headerUDPheaderUDP data (1473 bytes)IP datagram20 bytes8 bytesIP headerUDPheader20 bytes8 bytesIP header20 bytespacketpacket1472 bytes1 byteFigure 11.8 Example of UDP fragmentationRARP, BOOTP, and DHCP RARP(Reverse Address Resolution Protocol ) : for the diskless system to ask for IP a

12、ddress (in an RARP reply). uses a destination address of all 1s (limited broadcasting) to reach the RARP server, such broadcasts are not forwarded by routers, so a RARP server is needed on each network BOOTP: BOOTP uses UDP messages, which are forwarded over routers A serious problem with BOOTP is t

13、hat it requires manual configuration of tables mapping IP address to Ethernet address. DHCP(Dynamic Host Configuration Protocol ): DHCP allows both manual IP address assignment and automatic assignment. Dynamic Host Configuration ProtocolOperation of DHCP.Internet Control Message ProtocolThe princip

14、al ICMP message types.5-61IP headerICMP messageIP datagram20 bytesICMP messages encapsulated within an IP datagram(contents depends on type and code)8-byte type8-byte code16-byte checksum078151631ICMP messageExtracted from TCP/IP Illustrated, Volume 1, by W. Richard Stevens, typecodeDescriptionQuery

15、Error00echo reply(ping reply)*3destination unreachable:0network unreachable*1host unreachable*2protocol unreachable*3port unreachable*4fragmentation needed but dont-fragment bit set *5source route failed *6destination network unknown*7destination host unknown*8source host isolated (obsolete)*9destin

16、ation network administratively prohibited*10destination host administratively prohibited*11network unreachable for TOS*12host unreachable for TOS *13communication administratively prohibited by filtering *14host precedence violation*15precedence cutoff in effect *40Source quench(elementary flow cont

17、rol.)*ICMP message types (part 1)ICMP error message always contains the IP header and the first 8 bytes of the IP datagram that caused the ICMP error to be generatedThe ICMP host unreachable error message is sent by a router when it receives an IP datagram that it cannot deliver or forward.Extracted

18、 from TCP/IP Illustrated, Volume 1, by W. Richard Stevens, ICMP message types (part 2)typecodeDescriptionQueryError5redirect (Section 9.5): 0redirect for network *1redirect for host*2redirect for type-of-service and network *3redirect for type-of-service and host *80echo request (Ping request) *90ro

19、uter advertisement *100router solicitation*11time exceeded: 0time-to-live equals 0 during transit (Traceroute)*1time-to-live equals 0 during reassembly*12parameter problem:0IP header bad (catchall error)*1required option missing *130timestamp request *140timestamp reply*150information request (obsol

20、ete)*160information reply (obsolete) *170address mask request*180address mask reply *The ICMP timestamp request allows a system to query another for the current time.The ICMP address mask request is intended for a diskless system to obtain its subnet maskExtracted from TCP/IP Illustrated, Volume 1,

21、by W. Richard Stevens, routingdaemonUDPTCPICMProute commandnetstatcommandIP output:calculate next hoprouter (if necessary) our packet(one ofour IP addresses orbroadcast address)? process IP optionsIP input queueroutingtableIP layerNetwork interfacessource routingforward datagram(if forwarding enable

22、d)ICMPredirectsrouting table updates from adjacent routersnoyesFigure 9.1 Processing done at the IP layer3b1d3a1c2aAS3AS1AS21a2c2b1bIntra-ASRouting algorithmInter-ASRouting algorithmForwardingtable3cInterconnected ASes Forwarding table is configured by both intra- and inter-AS routing algorithm Intr

23、a-AS sets entries for internal dests Inter-AS & Intra-As sets entries for external dests Extracted from slides of Computer Networking course of Prof. J. Kurose BGP messages BGP messages exchanged using TCP. BGP messages: OPEN: opens TCP connection to peer and authenticates sender UPDATE: adverti

24、ses new path (or withdraws old) KEEPALIVE keeps connection alive in absence of UPDATES; also ACKs OPEN request NOTIFICATION: reports errors in previous msg; also used to close connectionExtracted from slides of Computer Networking course of Prof. J. Kurose Introduction to TCP TCP (Transmission Contr

25、ol Protocol) was specifically designed to provide a reliable end-to-end byte stream over an unreliable internetwork. connection-oriented: a TCP connection is established between two applications before they can exchange data Point-to-point: broadcasting and multicasting are not applicable to TCP A T

26、CP connection is a byte stream, not a message stream every byte on a TCP connection has its own 32-bit sequence number. TCP segment TCPs adaptive timeout and retransmission TCP also provides flow control: A receiving TCP only allows the other end to send as much data as the receiver has buffers for.

27、 TCP does not interpret the contents of the bytes at all TCP provides a full-duplex service to the application layer RFCs: 793, 1122, 1323, 2018, 2581contains the next sequence number that the sender of the acknowledgment expects to receivelength of the header in 32-bit wordsIts a notification from

28、the sender to the receiver for the receiver to pass all the data that it has to the receiving process.a reset is sent by TCP whenever a segment arrives that doesnt appear correct for the referenced connection.the number of bytes, starting with the one specified by the acknowledgment number field, th

29、at the receiver is willing to accepta positive offset that must be added to the sequence number field of the segment to yield the sequence number of the last byte of urgent data.The TCP Service ModelSome assigned ports.PortProtocolUse21FTPFile transfer23TelnetRemote login25SMTPE-mail69TFTPTrivial Fi

30、le Transfer Protocol79FingerLookup info about a user80HTTPWorld Wide Web110POP-3Remote e-mail access119NNTPUSENET newsTCP Port: is the TCP name for a TSAP.TCP Connection Establishment(a) TCP connection establishment in the normal case.(b) Call collision.6-31ClientServerSYN JSYN k, ack J+1ack k+1FIN

31、Mack M+1ack N+1FIN N(active open) SYN_SENTLISTEN (passive open)SYN_RCVDESTABLISHEDESTABLISHED(active close) FIN_WAIT_1CLOSE_WAIT (passive close)FIN_WAIT_2TIME_WAITLAST_ACKCLOSEDFigure 18.13 TCP states corresponding to normal connection establishment and terminationTCP Connection Management ModelingT

32、he states used in the TCP connection management finite state machine.TCP Connection Management Modeling (2)The heavy solid line is the normal path for a client. The heavy dashed line is the normal path for a server. The light lines are unusual events. Each transition is labeled by the event causing

33、it and the action resulting from it, separated by a slash.TCP connection management finite state machine.TCP Transmission PolicyWindow management in TCP.TCP Transmission Policy (2)Silly window syndrome.Clarks solution is to prevent the receiver from sending a window update for 1 byte. Instead it is

34、forced to wait until it has a decent amount of space available and advertise that instead. sun.1181bsdi.discardSYN 690560000:690560000(0)win 4096, SYN 2566353409: 2566353409(0)ack 690560001, win 4096, ack 1, win 4096PSH 1:1025(1024) ack 1, win 4096PSH 1025:2049(1024) ack 1, win 4096PSH 2049:3073(102

35、4) ack 1, win 4096PSH 3073:4097(1024) ack 1, win 4096ack 4097, win 0ack 4097, win 4096PSH 4097:5121(1024) ack 1, win 4096PSH 5121:6145(1024) ack 1, win 4096PSH 6145:7169(1024) ack 1, win 4096FIN, PSH 7169:8193(1024) ack 1, win 4096ack 8194, win 0ack 48194, win 4096FIN 1:1(0) ack 8194, win 4096ack 2,

36、 win 4096Fast SenderSlow ReceiverFigure 20.3 Sending 8192 bytes from a fast sender to a slow receiver TCP Congestion Control All the Internet TCP algorithms assume that timeouts are caused by congestion and monitor timeouts for signs of trouble. TCP ender maintains two windows: the window the receiv

37、er has granted and a second window, the congestion window. Each reflects the number of bytes the sender may transmit. The number of bytes that may be sent is the minimum of the two windows. TCP Congestion Control(a) A fast network feeding a low capacity receiver.(b) A slow network feeding a high-cap

38、acity receiver.TCP Congestion Control (2)An example of the Internet congestion algorithm.TCP Timer Management TCP uses multiple timers (at least conceptually) retransmission timer: is used when expecting an acknowledgment from the other end persistence timer: When the persistence timer goes off, the

39、 sender transmits a probe to the receiver. The response to the probe gives the window size. keepalive timer: When a connection has been idle for a long time, the keepalive timer may go off to cause one side to check whether the other side is still there. TCP Timer Management(a) Probability density o

40、f ACK arrival times in the data link layer. (b) Probability density of ACK arrival times for TCP.Round-Trip Time Measurement(1) Smoothed RTT estimator(called R): R R + (1-)M where is a smoothing factor with a recommended value of 0.9 Retransmission timeout value(RTO): RTO = R where is a delay varian

41、ce factor with a recommended value of 2Round-Trip Time Measurement(2) To keep track of the variance in the RTT measurements, in addition to the smoothed RTT estimator Err = M A A A + g Err D D + h ( Err - D ) RTO = A + 4 D Where: A is the smoothed RTT(an estimator of the average) D is the smoothed m

42、ean deviation. Err is the difference between the measured value just obtained and the current RTT estimator The gain g is for the average and is set to 1/8(0.125) The gain for the deviation is h and is set to 0.25. The larger gain for the deviation makes the RTO go up faster when the RTT changes.1:2

43、57(256) ack 1ack 257, win 7936slip.1024vangogh.discard12257:513(256) ack 1513:769(256) ack 134ack 749ack 5135769:1025(256) ack 11025:1281(256) ack 11281:1537(256) ack 1ack 1025ack 12811537:1793(256) ack 11793:2049(256) ack 167891012111513RTT #3(1.015ms)RTT #2(0.808ms)RTT #1(1.061ms)Figure 21.2 Packe

44、t exchange and RTT measurementExponential RTO Backoff Backoff process: a TCP source increase its RTO each time the same segment is retransmitted. This may give the internet time to clear the current congestion. A simple technique for implementing RTO back of is to multiply the RTO for a segment by a

45、 constant value for each retransmission: RTO = q * RTO The most commonly used value of q is 2.Karns Algorithm retransmission ambiguity problem Karns Algorithm: when a timeout and retransmission occur, we cannot update the RTT estimators when the acknowledgment for the retransmitted data finally arri

46、ves. This is because we dont know to which transmission the ACK corresponds. since the data was retransmitted, and the exponential backoff has been applied to the RTO, we reuse this backed off RTO for the next transmission. Dont calculate a new RTO until an acknowledgment is received for a segment t

47、hat was not retransmitted. Introduction to UDP The Internet protocol suite supports a connectionless transport protocol, UDP (User Datagram Protocol). UDP provides a way for applications to send encapsulated IP datagrams and send them without having to establish a connection. UDP does not do flow co

48、ntrol, error control, or retransmission upon receipt of a bad segment.The UDP header.identify the sending process and the receiving processthe length of the UDP header and the UDP data in bytesoptioanl, UDP checksum covers the UDP header and the UDP dataThe Real-Time Transport Protocol(a) The positi

49、on of RTP in the protocol stack. (b) Packet nesting.The basic function of RTP is to multiplex several real-time data streams onto a single stream of UDP packets. RTP has no flow control, no error control, no acknowledgements, and no mechanism to request retransmissions. The Real-Time Transport Proto

50、col (2)The RTP header.From “Internet Telephony : architecture and protocols - an IETF perspective”, H. Schulzrinne, et al., Computer Networks 31(1999)237255The X flag signals the presence of a header extension between the fixed header and the payload.If the P bit is set, the payload is padded to ensure proper alignment for encryption.Users within a multicast group are distinguished by a random 32-bit synchronization so

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论