TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer...

42
TCP/IP Basic Theory V1.2

Transcript of TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer...

Page 1: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

TCP/IP Basic Theory

V1.2

Page 2: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Course Outline

OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution Protocol

Page 3: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

N.Y. PekinTomJim

Post network

To Jim

Post code

Destination address

stamp

Post system

Page 4: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

TCP/IP

First used protocol suite Universal De-facto standard Internet standard communication

Host A

Internet

TCP/IP

Host B

Page 5: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Data layer

Transport

Data link

Network

Physical

OSI Model

Upper layer

session

Presentation

Application Layer7

Layer6

Layer5

Layer4

Layer3

Layer2

Layer1

Page 6: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

TelnetFTP

ASCIIEBCDICJPEG

Keep different applications independent Authentication

Example

Session

Upper Layer function

Network User InterfaceApplication

Presentation • Present data• Encryption, decryption

Page 7: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

TCPUDPSPX

802.3 / 802.2HDLC

EIA/TIA-232V.35

IPIPX

Example

Data layer function

Transport

Network

Data Link

Physical

• Reliable and Unreliable transfer• Use retransmission to ensure reliability

• Combine bit to byte and byte to frame• Access media by MAC address• Error detection without error correction

Provide logical address and path-finding method for the working of routers

• Transfer bit between devices• Define voltage, bit rate, physical connection

Page 8: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Upper Layer Data

Upper Layer DataTCP Header

IP Header

0101110101001000010

MAC+LLC Header

Segment

Packet

Bits

Frame

PDU

FCS

Data Encapsulation

Transport

Data Link

Physical

Network

Presentation

Application

Session

Upper Layer Data

Upper Layer Data

Page 9: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Upper Layer Data

MAC+LLC Header IP + TCP + Upper Layer Data

TCP+ Upper Layer Data

IP Header

Upper Layer Data

TCP Header

0101110101001000010

Transport

Data Link

Physical

Network

Presentation

Application

Session

Data Decapsulation

Page 10: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Course Outline

OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution Protocol

Page 11: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Application

Presentation

Session

Transport

Network

Data Link

Physical

Application

Transport

Internet

Data Link

TCP/IP model vs OSI model

Page 12: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Application

Data Link

TCP

FTP

TELNET

DNS

TFTP

SMTP

UDP

21 23 25 53 69 161

IP176

SNMP

Application

Transport

Internet

Data Link

ARP ICMP

Ethernet II (RFC 894 )

080008061

TCP/IP Protocol Suite

Page 13: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Course Outline

OSI Model and Layer Function TCP/IP Protocol Suite Transfer Control Protocol Internet Protocol Address Resolution Protocol

Page 14: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Transport Layer

Segment upper layer data Establish end to end connection Ensure the reliability of data transfer

Logical connection

Page 15: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

TCP Protocol

Source port (16) Destination port (16)

Sequence number (32)

Headerlength (4)

Acknowledgement number (32)

Reserved (6) Code bits (6) Window (16)

Checksum (16) Urgent (16)

Options (0 or 32 if any)

Data (varies)

20Bytes

Bit 0 Bit 15 Bit 16 Bit 31

Page 16: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

well-known port number :1-1023 common port number: 1024-65535

Port Number range

Application

TCP

FTP

TELNET

DNS

TFTP

SMTP

UDP

21 23 25 53 69 161

SNMP

Application

Transport

Application

Transport

Internet

Data Link

Page 17: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Source Port Number

Destination Port Number

client

1028 23

SP DP

Telnet ZProcess #1

Port Number function

Destination port = 23Send packet to my

Telnet application

server

1029 23

Telnet ZProcess #2

Port multiplexing

Page 18: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Sender Receiver

Send 2Send 1

Send 3Ack 4

Send 5Send 4

Send 6Retransfer 5

Send 5Ack 7

1 2 3 4 5 6 1 2 3 4 5 6

Sequence and Ack Number

Page 19: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Code Bits

URG: Urgent Pointer field significant ACK: Acknowledgment field significant PSH: Push function RST: Reset the connection SYN: Synchronize sequence numbers FIN: No more data from sender

U

R

G

P

S

H

R

S

T

S

Y

N

F

I

N

A

C

K

Page 20: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Window size = 1

Send 1 Receive 1Ack 2

Send 2 Receive 2

Ack 3

Send 1

Send 2

Receive 1

Receive 2

Window size = 3

Send 3 Receive 3

Ack 4

Send 4

Sender Receiver

Sender Receiver

Window control

Page 21: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Establish connection (synchronize)

Data transfer (Send Segments)

Sender Receiver

Connection-oriented session

Tear down connection

1

3

2

TCP connection

Page 22: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Send SYN (seq=100 ctl=SYN) SYN received

Send SYN, ACK (seq=300 ack=101 ctl=SYN,ACK)

Established(seq=101 ack=301 ctl=ACK)

Host A Host B

1

2

3

SYN received

Establish Connection

TCP Three Way Handshake/Open Connection

Established

Page 23: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

10281028 2323

Source Dest.

103103103103

Seq.

302302

Ack.

10281028 2323

Source Dest.

102102102102

Seq.

301301

Ack.

102810282323

Source Dest.

103103103103

Seq.

301301

Ack.

102810282323

Source Dest.

104104104104

Seq.

302302

Ack.

Data transfer

SP DP Seq. # Ack. #

Host A Host B

Upper layer data

Page 24: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

ACK to FIN

ACK to FIN

FIN

FINClose application

Host A Host B

Close application

Tear down connection

TCP four way handshakes/connection terminating

1

2

3

4

Page 25: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

UDP Protocol

No sequence and acknowledgement Unreliable and connectionless Efficient and fast

Source port (16) Destination port (16)

Length (16)

Data (if any)

Bit 0 Bit 15 Bit 16 Bit 31

Checksum (16)

8Bytes

Page 26: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

TCP UDP

Connection oriented Or connectionless

Connection oriented

connectionless

Reliable or not Reliable unreliable

With traffic Control Or not Traffic control No traffic control

Transfer speed Slow Fast

overhead of protocol Big Small

TCP/UDP Comparison

Page 27: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Course Outline

OSI Model and Layer Function TCP/IP Protocol Suite Transfer Control Protocol Internet Protocol Address Resolution Protocol

Page 28: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Data Link

TCP UDP

IP176

Application

Transport

Internet

Data Link

ARP ICMP1

Internet/Network layer

Define logical address Provide path-finding method r

outers

Page 29: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

IP packet format

Version(4)

Destination IP Address (32)

Options (0 or 32 if any)

Upper layer data (varies if any)

1Bit 0 Bit 15 Bit 16 Bit 31

HeaderLength (4)

Type of Service (8) Total Length (16)

Identification (16)Flags

(3) Fragment offset (13)

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

Source IP Address (32)

20Bytes

Page 30: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Type of Service field

precedence D T R 0 0

Bits 0-2: PrecedenceBit 3: DelayBit 4: ThroughputBit 5: ReliabilityBits 6-7: Reserved for future use

0 3 7

Page 31: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

MTU and fragmentation

0 15 16 17 18

Identification (16) Fragment offset (13)

Flags(3)

D

F0

M

F

Bit 16: Reserved, must be zero

Bit 17: (DF)0=May fragment, 1=Don’t fragment

Bit 18: (MF)0=Last fragment, 1=More fragmentHost A Host B

Ethernet

MTU 1000

IP(1500) HDLC IP(750)

HDLC IP(750)

Ethernet IP(750)

Ethernet IP(750)

RA RB

Page 32: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

IP Address

Host A Host B

172.16.2.1 10.250.8.11172.16.2.1 10.6.24.2

Fei_1/1 Fei_1/2

255 255 255

DottedDecimal

Maximum

Network Host 255

128 64 32 16 8 4 2 1

11111111 11111111 11111111 11111111Binary

0 7 8 15 16 23 24 31

128 64 32 16 8 4 2 1

128 64 32 16 8 4 2 1

128 64 32 16 8 4 2 1

Page 33: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

ICMP

Data LinkIP

Application

Transport

Internet

Data Link

ICMP1

Page 34: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Host A I am here.

ICMP echo reply

Hi B, are you there?

Host B

ICMP echo request

PING and reachability

Host or port unreachable Network unreachable

Destination Unreachable

Is B reachable?

ICMP echo request

no yes

Page 35: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Time Exceeded and TTL

Host A Host B

A: Tracert 10.1.1.2

1: 172.16.1.1

2: 200.1.1.2

3: 10.1.1.2

10.1.1.2

10.1.1.1

200.1.1.1200.1.1.2

172.16.1.2

172.16.1.1

RA RB

TTL=1

TTL=2

TTL=3

Page 36: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Course Outline

OSI Model and Layer Function TCP/IP Protocol Suite Transfer Control Protocol Internet Protocol Address Resolution Protocol

Page 37: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Data link Layer

Combine bit to byte and byte to frame

Access media by physical address (MAC address)

SAP associated with upper layer protocols type

Error detection without error correction

Data LinkIP

Application

Transport

Internet

Data Link

ARP ICMP

Ethernet II (RFC 894 )

080008061

Page 38: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

DataSrc. Addr FCSTypeDest. Addr

Variable Length 46-1500266 4

00.d0.d0 xx.xx.xx

Sequence ID for NICIEEE assign toManufacturers

Ethernet II frame (RFC 894)

Preamble

8# Bytes

48-bits MAC Address

Page 39: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Address Resolution Protocol

Map IP to MAC Local broadcast

IP: 172.16.3.2 Ethernet: 0800.0020.1111 IP: 172.16.3.2 Ethernet: 0800.0020.1111

172.16.3.1 172.16.3.2

IP: 172.16.3.2 = ???IP: 172.16.3.2 = ???

I got the packet,I will reply with my MAC address.

I need the MAC address of IP 172.16.3.2

Host A Host B

Other hosts

Page 40: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Packet process procedure

FTP client

ftp://10.66.1.100:21 I wanna download a file

SP:1024 DP:21 Seq.100 Ack.200

FTP server

SIP:10.66.1.1 DIP:10.66.1.100,TTL=100, DF, Protocol=7

SA:01-00-39 DA:01-00-4A type=0800

01010010100010101010101010100010110111000101001

Page 41: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.

Summarization

OSI reference model TCP protocol suite Transport layer Network layer Data link layer

Page 42: TCP/IP Basic Theory V1.2. Course Outline OSI model and layer function TCP/IP protocol suite Transfer Control Protocol Internet Protocol Address Resolution.