TCPIP Basics 52 Pages
TCPIP Basics 52 Pages
Objectives
• Upon completion of this course, you will be
able to:
– Know about TCP/IP protocol suite
– Be familiar with commonly used IP network
devices
Contents
• OSI Model and Layer Function
• TCP/IP Protocol Suite
• Transfer Control Protocol
• Internet Protocol
• Address Resolution Protocol
• IP Network Equipment
Post System
Post network
To Jim
Destination address
TCP/IP
Host A Host B
Internet
TCP/IP
Layer4 Transport
Layer3 Network
Data layer
Layer2 Data link
Layer1 Physical
Upper Layer Function
Example
Transport
TCP Header Upper Layer Data Segment
Presentatio
Upper Layer
n Session
Data
Physical 0101110101001000010
Contents
• OSI model and layer function
• TCP/IP protocol suite
• Transfer Control Protocol
• Internet Protocol
• Address Resolution Protocol
• IP Network Equipment
TCP/IP Model vs OSI Model
Applicatio
n
Presentati
on Applicatio
Session
n
Transport Transport
Network Internet
Data Link
Data Link
Physical
TCP/IP Protocol Suite
F T S D T S
T E M N F N
P L T S T M
N P P P
E
T
Applicatio
n 21 23 25 53 69
Applicatio 161
TCP n UDP
Transport
6 17
ARP IP ICMP
Internet Data Link 1
0806 0800
Data Link
Ethernet II (RFC 894 )
Contents
• OSI model and layer function
• TCP/IP protocol suite
• Transfer Control Protocol
• Internet Protocol
• Address Resolution Protocol
• IP Network Equipment
Transport Layer
• Segment upper layer data
• Establish end to end connection
• Ensure the reliability of data transfer
Logical connection
TCP Protocol
Bit 0 Bit 15 Bit 16 Bit 31
Options (0 or 32 if any)
Data (varies)
Port Number Range
F T S D T S
T E M N F N
P L T S T M
N P P P
E
Applicatio
T
n
Applicatio 21 23 25 53 69
Applicatio 161
n n
Transport TCP UDP
Transport
Internet
well-known port number :1-1023
Data Link common port number: 1024-65535
Port Number Function
Source Port Destination Port
Number Number
Destination port = 23
Telnet Z Send packet to my
Process #1 client server Telnet
application
Telnet Z
Process #2
Port multiplexing
SP DP
1028 23
1029 23
Sequence and Ack Number
Sender Receiver
1 2 3 4 5 6 1 2 3 4 5 6
Send 1
Send 2
Send 3
Ack 4
Send 4
Send 5
Send 6
Retransfer 5
Send 5
Ack 7
Code Bits
U A P R S F
R C S S Y I
G K H T N N
Send 2 Receive 2
Sender Receiver
Ack 3
Window size = 3
Send 1 Receive 1
Send 2 Receive 2
Send 3 Receive 3
Sender Ack 4 Receiver
Send 4
Connection-oriented Session
TCP connection
Sender Receiver
Establish connection (synchronize)
1
Data transfer (Send Segments)
2
Host A Host B
Send SYN
(seq=100 ctl=SYN) 1 SYN received
Send SYN, ACK
SYN received 2 (seq=300 ack=101 ctl=SYN,ACK)
Established
(seq=101 ack=301 ctl=ACK) 3 Established
Data Transfer
SP DP Seq. # Ack. # Upper layer data
Host A Host B
SourceDest.
SourceDest. Seq.
Seq. Ack.
Ack.
1028 23 103
103 302 SourceDest. Seq. Ack.
ACK to FIN
2
FIN
3 Close application
ACK to FIN
4
UDP Protocol
Bit 0 Bit 15 Bit 16 Bit 31
TCP UDP
Connection oriented Connection connectionless
Or connectionless oriented
With traffic
Control Or not Traffic control No traffic control
Data Link
IP Packet Format
Bit
1 0 Bit 15 Bit 16 Bit 31
Version Header Type
(4) Length (4) of Service (8) Total Length (16)
Flags
Identification (16) (3) Fragment offset (13)
Options (0 or 32 if any)
0 3 7
precedence D T R 0 0
Fei_1/1 Fei_1/2
0 7 8 15 16 23 24 31
Dotted
Decimal Network Host
Binary 11111111111111111111111111111111
128
8
4
2
1
64
32
16
128
8
4
2
1
64
32
16
128
8
4
2
1
128
8
4
2
1
64
32
64
32
16
16
Internet Control Message Protocol
Applicatio
n
Transport
IP ICMP
Internet Data Link 1
Data Link
PING and Reachability
Hi B, Host A Host B I am here.
are you there?
ICMP echo reply
Is B reachable?
ICMP echo request
no yes
TTL=2
TTL=3
Contents
• OSI model and layer function
• TCP/IP protocol suite
• Transfer Control Protocol
• Internet Protocol
• Address Resolution Protocol
• IP Network Equipment
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
Applicatio • Error detection without error correction
n
Transport
ARP IP ICMP
Internet Data Link 1
0806 0800
Data Link
Ethernet II (RFC 894 )
MAC Address
Ethernet II frame (RFC 894)
Variable Length
# Bytes 8 6 6 2 46-1500 4
Preamble Dest. AddrSrc. Addr Type Data FCS
00.00.d0
xx.xx.xx
IEEE assign
to Sequence ID for NIC
Manufacture
rs
Address Resolution Protocol
172.16.3.1 172.16.3.2
Other hosts
IP: 172.16.3.2 = ???
IP: 172.16.3.2
Ethernet: 0800.0020.1111
• Map IP to MAC
• Local broadcast
Packet Process Procedure
FTP client FTP server
01010010100010101010101010100010110111000101001
Contents
• OSI model and layer function
• TCP/IP protocol suite
• Transfer Control Protocol
• Internet Protocol
• Address Resolution Protocol
• IP Network Equipment
Hub — Work in Physical Layer
Signal !!
- Forward signal to all ports
except receive port
- Interconnect hosts in same
network
0101101
0101101 0101101
More
people
So many people!
more slowly
But it does not
matter
Router — Work in Network Layer
NET OUT
1.0.0.0 fei_1/1
2.0.0.0 fei_1/2
- forward according to
fei_1/1 :1.1.1.254
fei_1/2 :2.2.2.254 destination IP address
MAC3
MAC3 - interconnect hosts in
different network
- collect routing information
MAC3 2.2.2.2 data MAC2 2.2.2.2 data
( OSPF 、 BGP )
1.1.1.1 2.2.2.2
G: 1.1.1.254 G:2.2.2.254
MAC1 MAC2
Routing Switch
Router
I’m a switch?
I’m a router?
Interface fei_1/1 RS
ip add 1.1.1.254 255.255.255.0
Interface vlan10
ip add 1.1.1.254
switch 255.255.255.0
Route table
Switch
ARP request
Fei_1/1 Fei_1/3
Dest MAC: ff:ff:ff:ff:ff:ff
Fei_1/2
Source MAC:00:20:af:00:00:01
A B C
Fei_1/1 Fei_1/3
Fei_1/2
ARP reply
Dest MAC:00:20:af:00:00:01
Source MAC:00:20:af:00:00:02
MAC Port
00:20:af:00:00:01 fei_1/1
Switch 00:20:af:00:00:02 fei_1/2
Fei_1/1 Fei_1/3
Dest MAC:00:20:af:00:00:02 Fei_1/2
Source MAC:00:20:af:00:00:01
A B C
fei_1/3:10.1.1.10/30
fei_1/1:10.1.1.2/30 MAC:00:20:AF:00:00:05
MAC:00:20:AF:00:00:04
Dest MAC:00:20:af:00:00:04 fei_1/2:10.1.1.6/30
MAC:00:20:AF:00:00:05
Source MAC:00:20:af:00:00:01
A B C
NO NO
Get peer MAC
Address by ARP Send data at
physical layer
YES YES
Is gateway Is the gateway MAC Data link layer
configured ? address in ARP? encapsulation
NO NO
End
Get gateway MAC
Send error message
address by ARP
Summary
• OSI reference model
• TCP protocol suite
• Transport layer
• Network layer
• Data link layer
• IP network equipment
Thank you.