Tcp_ip

34
Monika lagwal Cse (mits)

Transcript of Tcp_ip

Page 1: Tcp_ip

Monika lagwalCse (mits)

Page 2: Tcp_ip

7 Application 6 Presentation 5 Session 4 Transport 3 Network2 Data Link1 Physical

Lower Layer connects one node to another

Layer Function

Network Choosing the next node and the link to it

Data Link Controls the flow of messages on the chosen link

Physical Connecting to the physical medium that provides the link

Upper Layer directly assist the user

Layer FunctionApplication Provides services directly

to an application program

Presentation

Presentation of information to user in a format that the user will understand

Session Controls the user to user dialogue – its direction and synchronization

Transport Raises the quality of service provided by the network to the level required by user

Page 3: Tcp_ip
Page 4: Tcp_ip
Page 5: Tcp_ip
Page 6: Tcp_ip

This layer contains all the higher-level protocols FTP – File Transfer Protocol – basic file

transfer between hosts (computers) SMTP – Simple Mail Transfer Protocol (for

email) HTTP – Hyper Text Transfer Protocol (for web

browsing) Data unit created at this layer is called a

message

Page 7: Tcp_ip

TCP/IP protocol suite encapsulates data units at various layers of the model

At the Application layer, the data unit created is called a message.

The Transport layer adds a header to form either a segment with TCP.

The Network (or Internet) layer adds another header to form a datagram

Page 8: Tcp_ip

Datagram – A self-contained message unit which contains sufficient information to allow it to be routed from the source to the destination

The protocol used at the data link layer encapsulates the datagram into a frame and this is transmitted across the transmission medium.

Page 9: Tcp_ip

This layer is represented by two protocols – TCP and UDP◦ TCP – Transmission Control Protocol◦ UDP – User Datagram Protocol

UDP is simpler but is used when reliability and security are less important than size and speed – such as speech, video

Since security and reliability are essential for most applications, TCP is used more often

Page 10: Tcp_ip

TCP is a reliable connection-oriented protocol

Allows error-free transmission Incoming byte stream is fragmented into a

number of shorter messages and these are passed on to the next layer

At the receiving end the TCP reassembles the messages into an output stream

TCP also handles flow control – to control data transfer rate

Page 11: Tcp_ip

A connection must be established between the sender and the receiver before transmission begins

TCP creates a circuit between sender and receiver for the duration of the transmission

TCP begins each transmission by alerting the receiver that segments are on their way (connection establishment).

Each transmission is ended with connection termination Each segment created by TCP includes

◦ A sequencing number for re-ordering after receipt. ◦ An acknowledgement ID number ◦ Source address◦ Destination address◦ Checksum – for error detection◦ Data◦ And other fields

Page 12: Tcp_ip

This layer is also known as Internet layer. The main purpose of this layer is to organize or handle the movement of data on network.

By movement of data, we generally mean routing of data over the network. The main protocol used at this layer is IP. While ICMP(used by popular ‘ping’ command) and IGMP are also used at this layer.

Page 13: Tcp_ip

This layer is also known as network interface layer This layer normally consists of device drivers in

the OS and the network interface card attached to the system.

Both the device drivers and the network interface card take care of the communication details with the media being used to transfer the data over the network.

In most of the cases, this media is in the form of cables.

Some of the famous protocols that are used at this layer include ARP(Address resolution protocol), PPP(Point to point protocol) etc.

Page 14: Tcp_ip

TCP/IP allows networks of different types to interconnect

Page 15: Tcp_ip

The Internet Protocol Suite (commonly known as TCP/IP) is the set of communications protocols used for the Internet and other similar networks. It is named from two of the most important protocols in it:

•the Transmission Control Protocol (TCP) and•the Internet Protocol (IP), which were the first two networking protocols defined in this standard.

Page 16: Tcp_ip
Page 17: Tcp_ip

IP is a connectionless protocol◦ No concept of a job or a session (each packet is

treated as an entity in itself)

IP is an unreliable protocol ◦ It is unconcerned with whether a packet reaches its

eventual destination, or whether they arrive in the original order

◦ IP cannot tell if packets were lost or whether they were received out of order

IP packets are not identified as a part of a sequence or belonging to a particular job.

Page 18: Tcp_ip

Application

Transport

Network

Link

Physical Fiber

Telnet DNS

UDPTCP

IP

Ethernet Wi-Fi

Co-ax

HTTP

Radio

Page 19: Tcp_ip

Version Header length Service type Total lengthIdentification Flags Fragment

OffsetTime to live Protocol Header checksum

Source addressDestination address

IP Options Padding• The protocol field in the header information identifies which higher level TCP/IP protocol sent the data. When data arrives at its destination this field tells IP which protocol module to pass it on to.•The time-to-live (TTL) field, specifies how long the packet is allowed to reamin in the internet delivery system and is decremented by by every router that the packet passes through. When it reaches zero the packet is discarded and the sender. This prevents packets from traveling the Internet forever.•The checksum is an error detection checksum covering only the fields of the header.

Page 20: Tcp_ip

• Network layer protocol whose job is to send packets or datagrams to send packets from one point to another

• Each destination is specified by an IP address – IPv4: Each address has 4 8 bit numbers – Represented in dotted decimal places– A 8 bit number can represent 0-255 in decimal place – A typical number therefore looks like 209.176.20.9– IPv6 allows a larger number of addresses (among other

advantages)

• IP Addresses: Static or Dynamic – Static useful on infrastructure situations– Dynamic addresses changes everytime a machine logs on – Dynamic addresses are most often assigned by Dynamic Host

Configuration Protocol (DHCP)

Page 21: Tcp_ip

Address Resolution Protocol (ARP) finds out the physical address corresponding to an IP address◦ When an IP Packet is received, an ARP request is

brodcasted on the network. When a host recognizes an ARP request containing its own IP address, it sends an ARP reply containing its hardware address. This address is cached.

◦ There is also a Reverse ARP (RARP) protocol. This is used by a host to find out its own IP address if it has no way of doing this except via the network.

Internet Control Message Protocol:◦ Defines the format of control messages that are sent

to the sender indicating that a problem has occurred

Page 22: Tcp_ip

• TCP is a connection-oriented protocol– The client & the server must establish a connection

before any data can be transferred between them.

• TCP provides reliability– TCP knows that data it sends is received at the other

end, and that it is received correctly. – TCP uses checksums on both headers and data.

• TCP ensure Data which arrives out of sequence is put back into order

• TCP also implements flow control, so a sender cannot overwhelm a receiver with data.

Page 23: Tcp_ip

Source Port Destination PortSequence Number

Acknowledgement NumberHeader Length Code Bits Window

Checksum Urgent pointerOptions Padding

• TCP sends data using IP, in blocks which are called segments.•The Port number identifies a particular user within a machine (which is identified by the IP address• The sequence number identifies the position in the data stream•The acknowledgement number is used to convey back to the sender that data has been received correctly. •The window size gives the number of bytes the receiver can accept.•The checksum covers both header and data•The urgent pointer identifies the start of data in the stream that must be processed urgently.

Page 24: Tcp_ip

A port number is a way to identify a specific process to which an Internet or other network message is to be forwarded when it arrives at a server. For the Transmission Control Protocol and the User Datagram Protocol, a port number is a 16-bit integer that is put in the header appended to a message unit. This port number is passed logically between client and server transport layers and physically between the transport layer and the Internet Protocol layer and forwarded on.

Multiple applications or upper layer protocols may use TCP simultaneously – Ports are used to map TP data to a specific process– The combination of an IP address and a port number is called a socket– Sockets can be full duplex (data transmitted in both directions) or half

duplex • Typical Port numbers:– 20/21 FTP– 23 Telnet– 25 Simple Mail Transfer Protocol – 37 Time– 53 Domain Name System– 80 HTTP– 110 POP3– 443 HTTPS

Page 25: Tcp_ip

• A connection must be established before any data is sent• Segments are only sent between client and server if there is

data to flow. • No status polling takes place.

• To Start:– The server listens out for connection requests. – The client requests a connection by sending specifying its own port

number and the port that it wants to connect to .– The SYN (synchronize sequence numbers) flag is set and the client’s

initial data sequence number is specified.• Next:– The server responds with a segment in which the header contains its

own initial data sequence number. • To complete the connection :– the client acknowledges the server’s data sequence number by sending

back a segment with the ACK flag set and the acknowledgement field containing the server’s data sequence number plus one.

Page 26: Tcp_ip

TCP is a sliding window protocol, and does not wait for acknowledgement

To prevent overflow of receiver buffer:◦ An acknowledgement is sent containing the with the window

size set to zero. ◦ Later a windows update is sent, specifying the new window size.

For efficiency:◦ TCP can specify an acknowledgement delay in the hope that

within that time some data will need to be sent the other way, and the two can ride together

◦ The Nagle algorithm allows a TCP segment containing less data than the receiver’s advertised window size can only be sent if the previous segment has been acknowledged. This allows aggregation of small amounts of data

Page 27: Tcp_ip

• In error situations TCP can:– detect whether data has been successfully received at the other end – take steps to rectify the situation. – inform the sending application of the problem and failure, if all else fails,

• Data lost or corrupted. – TCP keeps track of the acknowledgements for the data it sends. – If an acknowledgement is not received within an specified time data is

resent– Time interval TCP will wait before depends on the connection speed (The

protocol monitors the time it normally takes to receive an acknowledgement)

– Data is resent repeatedly, at ever-increasing intervals, until either a response is received or an application timeout value is exceeded

• Deadlock of flow– a receiver stops the data flow by setting its window size to zero and the

window update segment that is meant to start data flowing again is lost. – To prevent deadlock from occurring, TCP sends out window probe

messages at regular intervals to query the receiver about its window size.

Page 28: Tcp_ip

Each direction of data flow must be closed down separately.

Steps:◦ One end of the connection sends a segment in

which the FIN (finished sending data) flag is set. ◦ The receipt of this segment is acknowledged, ◦ The receiving end notifies its application that the

other end has closed that half of the connection.

Page 29: Tcp_ip

UDP is a simple protocol

UDP is unreliable and connectionless◦ A connection with a host is not necessary before

exchanging data ◦ No mechanism for ensuring that data sent is received

Main function is to specify the upper layer protocols

Useful for broadcasting since it does not require a connection

Page 30: Tcp_ip

Source Port Destination PortMessage length Checksum

•Two different application one using UDP and another using TCP may use the same port number. The two data streams are distinguished by the protocol field in the IP address header •The checksum is optional.

Page 31: Tcp_ip

UnicastOne sender – one receiver

BroadcastSends data to all possible receivers

MulticastSends data to interested receivers

Applications of IP Multicast: Pay TVFile Transfer Financial Information But is complex to implement

Page 32: Tcp_ip

Connection-oriented service modelled after the telephone system◦ To talk to someone, pick up a phone, dial the

number, talk and disconnect Similarly, in a network, the service user will

◦ Establish a connection◦ Use the connection◦ Release the connection◦ The sender, receiver and the network may

conduct a negotiation about data transfer speed, maximum message size, etc

Connection-oriented service is used when reliability is important◦ E.g., for file transfer, we want that all bits arrive

correctly and in the order they were sent

Page 33: Tcp_ip

Connectionless service modelled after the postal system◦ Each message (letter) carries the full destination

address◦ Each message is routed through the system

independent of all others◦ If two messages are sent to the same destination,

normally the first one to be sent should arrive first. But it is possible that the second message arrives first

Page 34: Tcp_ip