TCP/IP: An overview

Download Report

Transcript TCP/IP: An overview

TCP/IP: An overview

Yatindra Nath Singh EE/ACES, IIT Kanpur-208016 Email: [email protected]

web: http://home.iitk.ac.in/~ynsingh

Copyright 2001: YNS TCP/IP: Overview 1

Abstraction levels (layers)

• Computer Network - Interconnection of machines.

• Studied and designed at various level of abstractions – ease of study and design.

• Five levels of abstraction (Layers) – Physical layer – Data link layer – Network layer – Transport layer – Application layer • Each layer uses functionality of lower layer; provides functionality to higher layer.

Copyright 2001: YNS TCP/IP: Overview 2

Physical Layer (PL)

• Modulation formats • Bit rates • Phsical interface design • Examples - SDH, E1, E3, ISDN, ADSL

Data Link Control (DLC)

• HDLC • Reliable transport of frames in sequence • Sublayer – MAC for physical broadcast network Copyright 2001: YNS TCP/IP: Overview 3

Network layer and Transport layer.

• Problems faced in the network layer – Identification of destination.

– Reaching destination – Lost packets – Maximum packet size in various networks • Problems faced by transport layer – Data multiplexing and demultiplexing – Segmentation and reassembly – End to end flow control – Congestion Control Copyright 2001: YNS TCP/IP: Overview 4

Internetworking

• Interworking between networks (de-facto standard) • All networks need to used TCP/IP suite when communicating with each other.

• Within them- network can use any protocol of thier choice.  They need to convert between TCP/IP and protocol being used.

TCP  Transmission control protocol.

IP  Internet protocol • Can be used within the network also.

Internet – Network of networks

Copyright 2001: YNS TCP/IP: Overview 5

IP Address and functionality

In

Internet

- Each machine is identified by unique ID.

– Known as IP address.

In each machine, Network Layer (IP) • When packet received for itself, forward the payload to layer above it (IP passes payload to layer above).

• When multiple protocols can sit above network layer, payload passed to the one indicated in packet.

• When packet received destined for someone else.

– Routing table is looked into.

– Packet forwarded to appropriate node.

Copyright 2001: YNS TCP/IP: Overview 6

IP layer functionality (contd.)

– Packet is forward to appropriate node.

– Usual routing table entry destination network address, netmask, interface ID, next hop gateway.

Protocol running in IP Layer

• Protocols to generated mapping between IP address and MAC address.

arp, rarp, BOOTP • Protocols for topology discovery and tracking any change in it RIP-2,OSPF-2,BGP-4 • ICMP (Internet Control Message Protocol) for monitoring network.

Copyright 2001: YNS TCP/IP: Overview 7

IPv4 – Older version of Internet protocol and mostly used one Future- IPv6 (IP for next generation) IPv4 Addressing (32 bit or four Octets) Two parts Net work Host Copyright 2001: YNS TCP/IP: Overview 8

A Typical IP Header ( IPv4) 32 Bits Vers IHL Type of Serv Total length Identification Fragment Offset F M F Time to live Protocol Header Check Sum Source address Destination Address Option (0 or more words) Copyright 2001: YNS TCP/IP: Overview 9

Version (4 Bits)  Keep track, of protocol version e.g. Helps router in identifying IPv4 and IPv6 packets IHL (4Bits)  Due to options, header length variable – tells the length header (in 32 bits words - max header length 15 i.e., 60 bytes) – Minimum, value – five (5) header at least contain uptill destination address.

Copyright 2001: YNS TCP/IP: Overview 10

Type of service (8Bits)  Used by routers to provide quality of service (QoS) based routing • First 3 bits- precedence (max value 7, min 0) • Next 3 bits- (D) delay, (T) throughput, (R) Reliability • Used for choosing between multiple routes available for destination based on low delay, high throughput, high reliability bit values.

• Remaining 2 bits are unused.

Copyright 2001: YNS TCP/IP: Overview 11

Total length –Length of IP packet (including header and data) Max value – 65535 byte.

– In high speed networks (Gbps or more) large packet size is desirable . Network Fragmentation of IP packet payload.

Max packet size is limited. (Happens when links are low speed links) Fragments reassembled Destination TCP Copyright 2001: YNS TCP/IP: Overview 12

All these fragments belonging to same IP packet – identified by a Identification number One unused bits, DF, MF Dont fragment More fragment When fragmentation along the way is not desired, set to one Tells whether this is last fragment of the IP packet. Set to 0 for last fragment.

All routers, machine should accepts fragment of 576 bytes or less.

Copyright 2001: YNS TCP/IP: Overview 13

Fragment offset (13 bits)

• Tells the position of the fragment in the original IP packet.

• All fragments except last one-should be multiple of 8 bytes.

13 bits => 8192 fragments=> max data gram length 8192*8= 65536.

Time–to-Live(TTL) field

. (8bits) • Every time packet is forwarded, count is decreamented by ‘one’.

• When TTL is ‘zero’, packet is discarded and warning ICMP sent back to source.

Copyright 2001: YNS TCP/IP: Overview 14

Upon reception of all fragments, Network layer need to find “what to do with payload?” Protocol field – Identifies transport or other process to which payload to be given.

TCI, UDP, OSPF, ICMP are examples.

Header Checksum - To Detect Errors • All 16 bits half words added using 1’s complement arithmetic's.

• 1’s complement of result gives checksum • Changes with every hop.

Copyright 2001: YNS TCP/IP: Overview 15

Source and Destination address - 32 bits Contain Network number, Host-number 31 0 Network address Host address Option - All optional information can be transported using these.

For IPv4 – Five option Security, Strict source routing, Loose source routing, Record route, Time stamp.

Copyright 2001: YNS TCP/IP: Overview 16

IPAdderess 0 Network 10 Network 110 Network 1110 11110 32 bits Host Class A Host Class B Host Class C Multicast Address Reserved for future use Copyright 2001: YNS TCP/IP: Overview 17

Used only at boot time Network 127 All 0’s All 0’s All 1’s This host Host All 1’s A host on this network Broadcast on local network Broadcast on distant N/W (Anything) Loop back Copyright 2001: YNS TCP/IP: Overview 18

CIDR (Classless Inter Domain Routing) • All class ‘C’ IP addresses can be allocated in variable sizes.

• Netmask  11111…….11 0000……00000 When netmask ANDED with IP address Network address is found • Each router maintains network address and netmask for each entry.

Copyright 2001: YNS TCP/IP: Overview 19

Router handling of CIDR

• For each passing IP packet, destination IP address ANDED with netmask.

• output compared to network addresses in routing table entries.

When more than one entry matches the output • Routing table with longest string of 1’s is netmask chosen.

• Packet is forwarded to corresponding output port Copyright 2001: YNS TCP/IP: Overview 20

IP Version 6 • Due to shortage of address and to improve the performance of networks.

– has 16 bytes (128bits) source and destination address – Header is simple, packet processing in routers faster.

Copyright 2001: YNS TCP/IP: Overview 21

TCP (Transport Control Protocol) - Forwards end to end reliable byte stream.

- Accepts byte stream from processes – breaks them into 64KB or less size chunks - Each chunks mapped to separate datagram (which is further mapped to IP payload) - On reception of IP packet, the payload is given to TCP entity.

- Creates the byte stream back.

Copyright 2001: YNS TCP/IP: Overview 22

TCP Does.

• Flow control • Retramission (IP packet can be lost) • Reassembly of received datagrams.

Processes Transport layer Transport layer IP IP Layer Multiplexing and demultiplexing Copyright 2001: YNS TCP/IP: Overview 23

TSAP- Identification by 16 bit number called port no.

Port number below 256- well known ports reserved for standard Services (RFC 1700) FTP-21, Telnet-23 All TCP connections-Full duplex.

Point to point (exactly two end point) Multicasting / broadcasting not supported Every byte transmitted by TCP Has 32 bit sequence no in header Used for acknowledgement and window flow Control.

Copyright 2001: YNS TCP/IP: Overview 24

TCP  transmits bytes in segments Each segment has 20 byte header followed by zero or more data bytes Size of payload decided by (minimum of the two) Each segment including TCP header should fit in 65,535 byte IP packet For each network - defined MTU (Maximum Transfer Unit) A segment can be broken into smaller segments at intermediate router Each smaller segment provided with separate TCP and IP header.

This is different than IP fragmentation

Copyright 2001: YNS TCP/IP: Overview 25

Flow Control

TCP uses Sliding Window Protocol • Sends the segments • starts the timer • Receiving entity sends ack (sequence no of next expected byte) • If ack received before timer expiry transmission window moves ahead Else • retransmission of segments in transmission window is done Copyright 2001: YNS TCP/IP: Overview 26

32 Bits Source port Sequence no destination port Acknowledgement no TCP Header Length 6 bits 4Bits Unused U R G A C R P S H Check Sum R S T S Y N F I N Window Urgent pointer Option (0 or more 32 bits words) Copyright 2001: YNS Data (Optional) TCP/IP: Overview 27

URG  set to 1 if urgent pointer is used Byte offset from current sequence number to find urgent data (Used for sending interrupts) Acknowledgement  1 then acknowledgement no field is valid else ignore it .

Copyright 2001: YNS TCP/IP: Overview 28

RST - used to reset the connection SYN- used to setup the connection connection request SYN=1 ACK=0 connection response SYN=1, ACK=1 FIN - used to release the connection sender has no more data to send Window -Tells the transmitter How many bytes can be sent starting at acknowledge number Window=0 is legal Check sum for extreme reliability Copyright 2001: YNS TCP/IP: Overview 29

for checksum pseudo header is included with segment header 31 0 0000000000 source Destination Protocol TCP Segment (6) length Byte count for TCP segment including header Option  • Used for deciding segment sizes between two hosts • Extended window size Copyright 2001: YNS TCP/IP: Overview 30

Summary  IP and TCP protocols : Overview  Lot more is there to IP and TCP - This is just an introduction  Similar concepts are used in other network layers and transport layers implementations Copyright 2001: YNS TCP/IP: Overview 31