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

Post on 31-Dec-2015

233 views 8 download

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

TCP/IP Basic Theory

V1.2

Course Outline

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

N.Y. PekinTomJim

Post network

To Jim

Post code

Destination address

stamp

Post system

TCP/IP

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

Host A

Internet

TCP/IP

Host B

Data layer

Transport

Data link

Network

Physical

OSI Model

Upper layer

session

Presentation

Application Layer7

Layer6

Layer5

Layer4

Layer3

Layer2

Layer1

TelnetFTP

ASCIIEBCDICJPEG

Keep different applications independent Authentication

Example

Session

Upper Layer function

Network User InterfaceApplication

Presentation • Present data• Encryption, decryption

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

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

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

Course Outline

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

Application

Presentation

Session

Transport

Network

Data Link

Physical

Application

Transport

Internet

Data Link

TCP/IP model vs OSI model

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

Course Outline

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

Transport Layer

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

Logical connection

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

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

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

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

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

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

Establish connection (synchronize)

Data transfer (Send Segments)

Sender Receiver

Connection-oriented session

Tear down connection

1

3

2

TCP connection

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

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

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

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

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

Course Outline

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

Data Link

TCP UDP

IP176

Application

Transport

Internet

Data Link

ARP ICMP1

Internet/Network layer

Define logical address Provide path-finding method r

outers

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

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

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

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

ICMP

Data LinkIP

Application

Transport

Internet

Data Link

ICMP1

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

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

Course Outline

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

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

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

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

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

Summarization

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