You are on page 1of 25

TCP/IP

TCP/IP

Protocol Headers
Data Link Header IP Header TCP Header
Trailer

Pre DA SA 0800h version H L


Ether Type

6 TCP Header Data FCS


1: Internet Control Message Protocol (ICMP) 2: Internet Group Management Protocol (IGMP) 6: Transmission Control Protocol (TCP) 17: User Datagram Protocol (UDP) 89: Open Shortest Path First (OSPF)

Protocol

0x0800 Internet Protocol, Version 4 (IPv4) 0x0806 Address Resolution Protocol (ARP) 0x8100 IEEE 802.1Q-tagged frame 0x86DD Internet Protocol, Version 6 (IPv6) 0x8847 MPLS unicast 0x8848 MPLS multicast

IPv4 Header

IPv4 Header

IPv4 Header

IPv4 Header

TCP/IP Protocols

Protocol Headers
Data Link Header IP Header TCP Header
Trailer

Pre DA SA 0800h version H L


Ether Type

6 TCP Header Data FCS


1: Internet Control Message Protocol (ICMP) 2: Internet Group Management Protocol (IGMP) 6: Transmission Control Protocol (TCP) 17: User Datagram Protocol (UDP) 89: Open Shortest Path First (OSPF)

Protocol

0x0800 Internet Protocol, Version 4 (IPv4) 0x0806 Address Resolution Protocol (ARP) 0x8100 IEEE 802.1Q-tagged frame 0x86DD Internet Protocol, Version 6 (IPv6) 0x8847 MPLS unicast 0x8848 MPLS multicast

Internet Control Message Protocol (ICMP)

The Internet Control Message Protocol (ICMP) allows for testing and troubleshooting of the TCP/IP internet layer by defining messages that can be used to determine whether the network can currently deliver packets ICMP is a required component of every IP implementation Excerpt from RFC 792:

Occasionally a gateway or destination host will communicate with a source host, for example, to report an error in datagram processing. For such purposes this protocol, the Internet Control Message Protocol (ICMP), is used. ICMP uses the basic support of IP as if it were a higher level protocol; however, ICMP is actually an integral part of IP, and must be implemented by every IP module

ICMP

ICMP Header

ICMP
Type
0 3 3 3 4 5 8 11

Code
0 0 1 3 0 0 0 0

Meaning
echo reply network is unreachable host is unreachable port is unreachable source quench redirect echo request time exceed

ICMP Type 3: Destination Unreachable

ICMP Type 3: Destination Unreachable

Transmission Control Protocol

Transmission Control Protocol

Transmission Control Protocol

TCP Connections and Port Numbers


Two host applications using TCP must establish a TCP connection before data can flow Each connection exists between a pair of TCP sockets, with a socket being defined as an IP address of the host, the port number used, and the transport layer protocol (TCP in this case) The connection establishment process essentially initializes the sockets, including the source and destination ports, as well as the Sequence and Acknowledgement fields In the connection establishment phase, the two hosts select port numbers, select the Sequence and Acknowledgement fields, and use TCP code bits to identify the messages in the three-way handshake for connection establishment

Transmission Control Protocol

TCP Connections and Port Numbers

First, for port numbers, the server must already be listening for connection requests from clients, with those requests being to a particular well-known portin this case, HTTP port 80. (Wellknown ports are listed at http://www.iana.org) The client picks a currently unused port number to use as the source port, typically a value of 1024 or greater The TCP header includes several 1-bit fields, called code bits or flags, that are used for a variety of purposes The SYN and ACK flags identify segments as either the first or second in a new TCP connection: a segment with just the SYN flag set is the first segment in a new connection, and a segment with both SYN and ACK set is the second segment in a new connection Flags allow hosts to easily recognize new connection requests.

TCP Connections and Port Numbers

The initial sequence numbers can be set to any valid value, and often are not set to 0 Using these fields, happens independently in both directions So, the first segment in the three-way handshake of Figure sets the left-to-right sequence number; the second segment sets the right-to-left sequence number and also acknowledges the first segment; and the third segment acknowledges the rightto-left sequence number Connection termination can be accomplished in one of several ways In most benign cases a four-segment flow, as shown in the bottom half of Figure, with the ACK and FIN flags being used

TCP/IP Application Layer Protocols

TCP/IP Application Layer Protocols

Transmission Control Protocol