You are on page 1of 33

Objectives

•Understand the TCP/IP reference model.


•Understand basic TCP/IP concepts (such as TCP, UDP, IP, ICMP, and ARP protocols)
TCP/IP Reference Model

Application layer

Presentation Application layer


layer

Session layer

Transport layer Host-to-host layer

Network layer Internet layer

Data link layer Data link layer

Physical layer Physical layer

OSI model TCP/IP peer model


TCP/IP Protocol Suite

• Established by United States Department of Defense (DOD), the Transmission Control Protocol/Internet
Protocol (TCP/IP) suite ensures data integrity and maintains communications in destructive wars.

• A protocol suit is composed of many protocols with various functions provided.

• TCP/IP is the base of the existing data networks.


TCP/IP Reference Model

Provides users with various services or system application


Application layer interfaces.
eg. FTP, Telnet, DNS, SMTP, etc.

Establishes, maintains, and cancels an E2E data transmission


Host-to-host layer process, controls transmission rate, and adjusts the data
sequence.

Defines IP addresses; is responsible for routing and addressing;


Internet layer forwards data from a source to a destination.

Encapsulates data packets into frames. Implements P2P or P2MP


Data link layer communications on data links. Performs error detection.

Transmits bit streams on media. Provides mechanical and


Physical layer
electrical specifications.
TCP/IP Reference Model

Application layer Telnet FTP TFTP SNMP


HTTP SMTP NFS DHCP

Host-to-host layer TCP UDP

ICMP Routing Protocol


Internet layer
IP

ARP
Data link layer Ethernet Fast Eth

Physical layer
Application Layer

• HTTP 80
The Hypertext Transfer Protocol provides web page browsing
Application layer services.
• Telnet 23
The remote login protocol provides remote management
services.
Host-to-host layer • FTP 20 and 21
The File Transfer Protocol provides shared network file
resource services.
Internet layer • SMTP 25
The Simple Mail Transfer Protocol provides Internet e-mail
services.
Data link layer
• POP3 110
The Post Office Protocol provides Internet e-mail services.
Physical layer • TFTP 69 (UDP)
The Trivial File Transfer Protocol transfers simple text files.
Application Layer

Application layer

• Transmission Control Protocol (TCP) is a


Host-to-host layer
connection-oriented network protocol.
• User Datagram Protocol (UDP) is a connectionless
Internet layer
network protocol.

Data link layer

Physical layer
Host-to-Host Layer

• TCP and UDP

TCP UDP
Connection-oriented Connectionless
Reliable transmission Best-effort transmission
Flow control and sliding window mechanism None
TCP-based applications: web browser and UDP-based applications: Domain Name
File Transfer Protocol (FTP) System (DNS)
Host-to-Host Layer

• TCP packet header

Source port (16) Destination port (16)

Sequence number (32)


20
Acknowledgement number (32) bytes
Header Reserved Control bits
length (4) (6) (6) Window (16)

Checksum (16) Urgent (16)

Options (0 or 32 if any)

Data (varies)
Host-to-Host Layer

• UDP packet format

Source port (16) Destination port (16) 8


bytes
Length (16) Checksum (16)

Data (if any)

Unlike the TCP packet header, a UDP packet header does not contain
the Sequence number and Acknowledgement number fields.
TCP Connection Establishment (Three-way Handshake)

Host A Host B

Seq=0 Ctl=SYN
1 Sends an SYN Receives an SYN message.
message.

Seq=0 Ack=1 Ctl=SYN, Ack


Receives an Sends the SYN and 2
SYN message. Ack message.

Seq=1 Ack=1 Ctl=Ack


3 A connection is
established
TCP Connection Termination (Four-way Handshake)

Host A Host B

Seq=100

Seq=300 Ack=101

1 Sends a FIN
request to Seq=101 Ack=301 Ctl=FIN, Ack
Receives a FIN message.
terminate the
connection. Seq=301 Ack=102 Ctl=Ack Sends an Ack
2
message.
Seq=301 Ack=102 Ctl=FIN, Ack
Sends a FIN request to
3
terminate the connection.
4 Sends an Ack Seq=102 Ack=302 Ctl=Ack
message.
Host-to-Host Layer TCP Sliding Window Mechanism

Host A Host B
Seq=100 Win=3 Ctl=SYN Buffer on the receive end
1
Seq=200 Ack=101 Win=3 Ctl=SYN, Ack
Three-way
handshake Seq=101 Ack=201 Win=3 Ctl=SYN, Ack

Seq=101 Win=3
2
Seq=102 Win=3
Sends data.
Seq=103 Win=3
3
Ack=104 Win=1 Ctl=Ack
4
5 Seq=104 Win=3
Window size determines the maximum
of bytes that can be sent before an Ack
message is received.
Internet Layer

Application layer

• Also called the Internet layer.


• Sends packets from a source to a destination.
Host-to-host layer
• Network layer functions
• Provides logical addresses to network devices.
Internet layer
• Is responsible for routing and forwarding for
data packets.
Data link layer

Physical layer
Internet Layer

• IP packet format

Version Header Priority & Type


(4) Length (4) of Service (8) Total Length (16)
Flags
Identification (16) (3) Fragment offset (13)

Time to Live (8) Protocol (8) Header checksum (16)

Source IP Address (32) 20


bytes
Destination IP Address (32)

Options (0 or 32 if any)

Data (variable if any)


Internet Layer

• On an Ethernet network, a data transmit end fills in fields of IP (Layer 3) and Ethernet (Layer 2)
headers when constructing data, in which the destination IP address and destination MAC
address are key information.

• The Address Resolution Protocol (ARP) provides the following basic functions:

− Resolves the MAC address from the destination IP address field.

− Maintains cached ARP mapping between IP and MAC addresses.


ARP Entry Construction

SW
Source MAC
address Layer 2 Ethernet
G0/0/1 G0/0/2
Destination header
MAC address
Sender's IP
address
Sender's MAC ARP packet
address
Destination IP PC2
address PC1

Destination
MAC address
ARP Spoofing

SW R1

Internet

PC2 192.168.1.254

192.168.1.1

PC1
Internet Layer Tool

• Ping (ICMP)
• Ping is a command used on network devices, Windows OS, Unix OS, and Linux OS. It is a small and useful
application based on the Internet Control Messages Protocol (ICMP).

• Ping is commonly used to detect network reachability to a destination node.

C:\Users\mypc>ping 10.1.10.93
Pinging 10.1.10.93 with 32 bytes of data:
Reply from 10.1.10.93 : Bytes=32 Time=7ms TTL=58
Reply from 10.1.10.93 : Bytes=32 Time=8ms TTL=58
Reply from 10.1.10.93 : Bytes=32 Time=8ms TTL=58
Reply from 10.1.10.93 : Bytes=32 Time=8ms TTL=58

Ping statistics for 10.1.10.93 :


Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 7ms, Maximum = 8ms, Average = 7ms
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

IP Address and
Device Interface MAC Address
Mask
PC NIC 192.168.1.1/24 8C70-AAAA-0001
R1 GE0/0/0 192.168.1.254/24 0018-0011-0001
R1 GE0/0/1 192.168.12.1/24 0018-0011-0002
R2 GE0/0/0 192.168.12.2/24 0018-0022-0001
R2 GE0/0/1 192.168.2.254/24 0018-0022-0002
Server NIC 192.168.2.1/24 8C70-AAAA-0002
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

Application layer Application layer

Host-to-host Host-to-host
layer layer
Internet layer Internet layer Internet layer Internet layer
Data link layer Data link layer Data link layer Data link layer
Physical layer Physical layer Physical layer Physical layer
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server
1

Data

Data
(HTTP application data)
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

TCP header Data

Layer4 TCP header

Source port 1025 Data


Destination port 80 (HTTP application data
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

IP header TCP header Data

Layer3 IP header
SIP 192.168.1.1
Source port 1025 Data
DIP 192.168.2.1
Destination port 80 (HTTP application data)
Protocol number 6
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

Eth header IP header TCP header Data

Layer 2 Ethernet header


SMAC 8070-AAAA-0001 SIP 192.168.1.1
Source port 1025 Data
DMAC 0018-0011-0001 DIP 192.168.2.1
Destination port 80 (HTTP application data)
Type 0x0800 Protocol number 6

Ethernet header IP header TCP header Valid payload


TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

Eth header IP header TCP header Data


TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

Eth header IP header TCP header Data

SMAC 8070-AAAA-0001 SIP 192.168.1.1


Source port 1025 Data
DMAC 0018-0011-0001 DIP 192.168.2.1
Destination port 80 (HTTP application data)
Type 0x0800 Protocol number 6
Ethernet header IP header TCP header Valid payload
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

IP header TCP header Data

SIP 192.168.1.1
Source port 1025 Data
DIP 192.168.2.1
Destination port 80 (HTTP application data)
Protocol number 6
IP header TCP header Valid payload
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

8
Eth header IP header TCP header Data

SMAC 0018-0011-0002 SIP 192.168.1.1


Source port 1025 Data
DMAC 0018-0022-0001 DIP 192.168.2.1
Destination port 80 (HTTP application data)
Type 0x0800 Protocol number 6
New Ethernet header IP header TCP header Valid payload
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

Eth header IP header TCP header Data

SMAC 0018-0011-0002 SIP 192.168.1.1


Source port 1025 Data
DMAC 0018-0022-0001 DIP 192.168.2.1
Destination port 80 (HTTP application data)
Type 0x0800 Protocol number 6
Ethernet header IP header TCP header Valid payload
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

10

IP header TCP header Data

SIP 192.168.1.1
Source port 1025 Data
DIP 192.168.2.1
Destination port 80 (HTTP application data)
Protocol number 6
IP header TCP header Valid payload
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

11

Eth header IP header TCP header Data

SMAC 0018-0022-0002 SIP 192.168.1.1


Source port 1025 Data
DMAC 8C70-AAAA-0002 DIP 192.168.2.1
Destination port 80 (HTTP application data)
Type 0x0800 Protocol number 6
NEW Ethernet header IP header TCP header Valid payload
TCP/IP Reference Model

GE0/0/0 GE0/0/1 GE0/0/0 GE0/0/1

PC R1 R2 Server

12

Eth header IP header TCP header Data

SMAC 0018-0022-0002 SIP 192.168.1.1


Source port 1025 Data
DMAC 8C70-AAAA-0002 DIP 192.168.2.1
Destination port 80 (HTTP application data)
Type 0x0800 Protocol number 6
NEW Ethernet header IP header TCP header Valid payload

You might also like