You are on page 1of 90

c 

  



 
  
! Introduction to TCP IP
1. TCP/IP architectural model

! Application Layer
1. Client and Server
2. Overview of HTTP

! Transport Layer
1.Connection less Transport : UDP
2. Connection oriented Transport : TCP
3. TCP Connection Management

! Network Layer
1. Network Service model
2. Routing Principles
3. Internet Protocol
! Data link Layer
1.Types of data link layer
2. Ethernet Data Link Layer
! Physical Layer
1. Physical Layer Functions
2. Examples of physical layer

Note :
c      
  does not apply specifically to TCP/IP
!  "  #c $%!%it is still important
To understand its significance and role  
c c $  
TCP/IP architectural
model
! cc $ " 
&&


  
c 
   'c (   
'(

! cc $)"& &" *



"

" ! + c $


 &"*&
%%
 %" !# 
c & &  &&&  
&

"  * 


"  !
&
+&
  
c $#  *! #&"* 
  ,   
c  - 
.+$  - 
- +- 
 - / c  &
 
c#
  
 !"
    # "
 
,    

c   


 0 


.+  

 +1 

,    


 &  
Application Layer
,   2      &
+ 
c    "
 

"  


    
 

c

"    &   

c3#!3 ")c%
4c%))%cc%   
  "%     & 

5 c &
#6 #% # %7"

#   
#8

5 c 6&!"
# %  %&
 
# & 8

5 c
 &&%  %
  #&
 &
  &8

5 c"&
  #    

#   
#
  )!
, +      
33%  !    
 !!  && 


"  #! +


c&#""+

"  *


 

" !  


w)! ,  
- .9
c    &!&
  
 
 
0 : 
 c
 #

5 Data Loss : )
  %" 
%
& &%
%w*"
 
 &% &    7"&" 
* &
  "%&&% &  
  % !! # 7" 
Õand width : )
  
"**
 
 *  *
3&&!3 
&
" &*  !*%
    && ' 
! "#* " &&  #
("#!" ! #&& 
* & ""* 2 !
, 

Timing : c& !7"


 &
 #
 !2
  %"  
  %!" !
 % &  #% 

"  #
7"#
 #   
!  *3&&! & # *
+ #    #  &

 !
 ' # %&
     &
 22   (
+  &
3 3
)!!*   
c  
c  ' 
#  c $ +(

+!*     %

 %

;';#
(  

c 'c 
   (
& &&&& !

 !+ #  

5 TCP Services : cc !


 "
  2 ! * &
! w     !+c &  
%  !*&!
&
c 
Connection-oriented service: c   
!6 #  2   &
 
[    2!
#*# 
& c2 + # " 
 !% #
  &  "#&
+ 
,& + # %c   
6* +&  c
  &"2" 6   
  
#!
  

 w   
&   #
#%
" 
  
c!&3  2 3!
 3  3!*"
  ! 
 
5 Reliable transport service: c

"  #
   c !
# 
"     w  &
   
&*  +%
 "  c !

&
c! #+% 
 #" * 

c  " #  


 
%
!&# &&  
 &* &&

"  # 


cc  #  
 
 
' !(  + #
Overview of HTTP
5 c 6c &'cc(%w*<
  2  

5 cc

   #
 
#
 ! #
c  #
 
! #
%6" # &&   
%+
* 6 # #cc
# 

5 cc& ""&
# 
  !6 #
#
HTTP & w* '*(7"w*
#&
!'  %w*!( !
 &w* # 

w "7"w* #' # %+ 


  +(%* cc7"
#&
*=  #! c!!
7"   cc  
#
  *=
cc#4

ccc & & cc
#&
 
c &cc
#%
5 7"
# 
5   
#

7"
#c
# *  
!7" # * #
#

c&
&7"
#   6
A typical HTTP request message:
 c$
$ # 
cc$ 
  
;2# >$1 
, 6$
%
#$#&%
#$= #
, 2 #"#&
'6#" % &(

General format of a request message :


c& &cc7"
#
request line8
line
"*7"  header
header lines

c7" &
 c
&%
0 c;-&% 
 ccc! & 

c
& + !&& !"%
 " # c%?)c%  , 

c c
" *7" *=%
7"*= & ;-&  
6
%*7" #*=
$
$ # 
 'c* <! &
 
 ;-& c   
  '!(!
7"& (
   
   c %*
 #! < "
   8 !
  &  #7"*=
c"*# 7"
#


 cc$ *" < *
    

c;# 
c;# c  &"
# %  %* 
+ #
7"! "# c
 c6c &>$1 %. 
* c "&"*"!
 "  && ! &

?*=&&  &"# 
c,  c ! &
*=*     %
    c-6%4
#
@ 
# 
&&$
$ # 
  @! ' 
  <A(% !" < &%
 *   *= 

, 2 #"# c "


, 2
&!4 ! &*=%&"
?*=6 !8%!"
 &"!
c# &
&  

#
cc$ 0?B
  
c"%C,"#DDE0Fc
)!, $  '; 6(
-2& %00@" DDED001c
  2- #CE0
  2c 6$

p  p  p  p  p  

 
#&
 
 status line
0 header lines%  ntity body
5 )" c" &
 c ! &
0 ,"%
 ,   #"
# 
 6
%"  !
" #cc$  !  #?B'  %
!&" %   #%7"*=(

5 c  c!"


     
# #c   &  #

#
c)! c  
#
# *  , w*!
c   2- #c   "
*
&*  *=* #  

c   2
  2c c  
c 
*=   * c-6 'c*= 
&&  *    2c   * 
&6  (

 &
&  
#
Transport Layer
c  - *    
+ %    &
  +" 
& ! #

"  !


 ,  "  # && 


c      *c $



&"  &  % ? 
) 
   '?)(
&# 
.+ # 
c  % 
#  c $ +%
+
!*   2  
    

? & UDP ';#


(%
 ! " *%  !
 !+ #  
c & TCP
'c 
  (% !*%
  2 ! !+ # 
Connectionless Transport: UDP
cUser Datagram Protocol 'UDP( &


*&  )"%&
+ "&   

w;%
"    
#% 
&#
% 
  '( +"7" # 


"  "   


  
 ;"
 
 

"
 2+ ##"&#"  #
* % #% # 

c"%; ! " *! #




 !"&%;"
+ #
      &
 
  %! #!&"  #
 + &!
+""&;
5 ; !! 
 &*   
- * ,  - *!

5 ; ! #" "   &



#!  ;    ;

#  

;    
" 6 # +"

 #&
    & + &* &
 &
  
 %
"*

 
"  
c +""&;  
c; &  1& )"  
+"
  
5 )" 
/ c& &  #  

  #&" "*"
* 
  &  & "% "*
>
5    
/ c& &    
7"
5 - #
/ ,C2*& & # * &
 #
  c

 
"
 #E*  < #&
 c&>
&
CF%FF* 'E* GCFF0H* &
(&;#
c # "
;%
 
"
>&;
#
E'E*  ( c

& #

* "   #!1 CF%FH* 
5 +"

/ cC2*+"
&"&2+ #
& p 
+"
C2* <

 & <


 "
& "& &
 &

%;% % 


> '&  (
+
" &
 
Connection-Oriented Transport:
TCP
c  c  -      
c 2 c 
   

c  
 &"   #    " #
 % 
 %"
"!
+ #
 %
 &&7"  
+ #
  "
* 
,c    !&full duplex  &

c%  2! * & *


 * 2 &c  
*  ,    :  
%   2! &&
,:
)

  2!&&
:, 

c    point-to-point%  %*


, #   #! )
3
" #3 &&&

  
 !  # 
  22   *c  
   *
  c 
5   !"#
-"   #&
&
  ! 

5 c   


&"#
+?  "#%
  &c "  #   %

5 c   <send buffer%


 &*"&&" #
 2  + 4


%c 
3#*3" +&&
 *"&& 

5 c
6
"

" & *#** 
 #
 
* Maximum Segment
Size (MSS).
5 c   "" +& c 
%* &
 #TCP segments

! c#
    +
 %     "
+2 #
 

! c#
    + w 
c !#
  %#
 <
  c   <receive buffer.
c  
&&

*"&&  &    *"&&
  !*"&& 
c #
 )""
!"#
""&c #
  
,;% "source and destination
port numbers%"&

" 6 #$


" 6 #&
$"  
,  

5 c02*sequence number field% 02*


acknowledgment number field "* c 
  ! 

  #*
 &!

5 cC2*window size &"& " &


& "  "
*&* 
! # 

5 c12*length field  & #&c 


 02* cc  *&!*
 #"c   &%"*
5 c   !* #options field "
   ! #
6
"

#
 >'))(  #&&"
 #2  + 

5 cflag field   C* cACK bit "


 !" + #
 &
!
cRST%SYN  FIN *"&  "
  %" &
w PSH *%   
!" "  


 4  %URG *" 


 #
   #2" 
   
+II"#  <<c &
* &"#  * C2*
"#    c 
" &
! #2
"     "# 6  
  &"#  
c    #
 
  "  #    
       

c  #  client


host server host c
    & &
 c 
 *    !

  #
* " #

 

)+ )+J )+'3 


3%3  "
*3(8
cc     *c 
  c  ! & #

 

5 Step 1.
c 2c &  c #
 
!2c  c #
    
  2 
%!%! &&#* #
 <
2)K.*%
4 % #
 &SYN
segment   %   7" 
"
*'î     " "
* 7" 
"
*&& c )K.#
  c#
 
  "  #
   
  
5 Step 2.
? #
   #c )K.#
 
!!'"
 #!A(%
!6c )K.#
 &
#
%
c *"&& !*  %
    2# #
  c  

c  2# #


    
  2  !%  

  & &
  #
  
4%)K.* 
) %+ #
 &&c #
 
 
4  %!  7"  "
*
'!L (  "!" 7"  "
*
&&c #
  
c  # #
   #% &&%3
! ")K. +   "
 7"  "
*%î    
#*     7" 
"
* 
  3c   2# #
 


&SYNACK #
 
5 Step 3.
;  ! #  2# #
 % 
*"&& !*  c
   !  #
 8
#
 + #!<  2# 
#
 ' *  " #!"

  + #
 &&c 
#
 ( c)K.*% 
  *
Network Layer
c +      * &  "22
  '
"22
"  22(
! &  +% * 
"  +
' +( c +    "   + #
&
   & #   &   

c    !& +


 % !

"  !*


 
c& + " ! 

   +&
  #! # c
%
  + &"   *
 &
 
 
0 ) #


  c + 
"
 
" + *  + &&
 
! c#
" &
   

) # w  +! ""%


"
"
!  " " +
.+)!
c +!
& & 2
2   &*  3#3& +
 %  %*   # ! # 
 


c &! !*  + 


 
#
!

M"2"!

#
)"* 
 #


  
  
+%
 +&
    
%     + 
.+%+" +
  * 6
  # +<  %
 6 #" #*  % 
& # +  &  " #
" " #* *
& 
%
& + &
   
 

&&&  "# + 
 !"
&

c#
!  )!
M"2"!

,!"2" + +*!
"+
   +%"3"3 
3!""3 c &*  
!""
5 ËC setup: " #"  %  
+ % &!% 
& +" M c + 

  *   !%  %
)& + "# +&
M !%   !!"  #* 
& +   " #M " %
+ 
 !"' # %* (
 # &M
5 Data transfer. ? M * *%
 *# & #M
5 Ëirtual circuit teardown. c  
 '!( &
 + &
c
 M c +   
 &
  
 & +&

  % " * &
+   M  
 #6

  "       !!


  
 c  
#


"  #


  
&
  !  *&" 
*# &   !  ,"#
  
&  2 
  %  +

*!" ?  %!"2"
+ % + !! !"2"
" %  +&" &M 
 #"#
" #  
  & +&
  #
  % + 
"
 › 
   +& w +
  !#
!!""!
 + 
"  
  &
+ c=*& + routing protocol.

,& " # #


'
3" ##
3(
  & +
c0
  &" # 
 +#

 !#

- +),#
link-state routing protocol  &

 &" # "  +2
 +&
"

"  
c +#
  *+  
=+<#
%
5 
" &
  '"%
w&,(   +
=+<#
!    &
+ &#
% 
+  +   % 
 # 
   %+ !+

 -"& & #  

5 '%=( +&
  = &  =
  % '%=(J & w"
&

 '%=(7"'=%(

5 '!(& &
"  
!"  '& &#
(


5 '!( !" ' #*&!( #" 


 &
"!

5 .&  &


"
& ! + 
"  + 4#" 
"
&
, *   

,*""

 &#
<
"  
c*  *#!!"&
#
!* & -" 
&&  
In the initialization step, "  +   
&
,  #*%:%   >
0%F  ! .  " 
F'! "#  
 6( &'  ( +&
,
 c  4 &     
  ,
In the first iteration, +
 #   
. &  &
 & !" c %
&% ". - 0&-)
#
  &
" '!(& !%
 #"    ' ( c*
1 02 c& :"  # c&
 'F & > (
"# &" !&1  
   <  #
 &
, )
 %
'"#(
"*0% *" 
 #
5 In the second iteration% :  &" !
 '0(% *+*
  ..   ,%%  c

  #    .%  % :%  4%
" ! 0&-)#
%  #
"   *!*

w -)#

 %!& %
 # &
" 
4 %!   

   "  &
"
  
5 ,! #

.  &


 *"   +
4 !# & #

5 ! #
 3+ 3 # A
=+<"  #
# #
4 # "
* 
  
cInternet Protocol 'IP( "4


"  # +2  +


" #  )"%&c $
 
     - &  
)" +&! # #"
#
' +(&
"
   *  4
"   &  #
 
""&#
  "
c +      
%


  %IP Protocol c


"  ! &  " 
 !1
0 !C
, #
0* #'7"!  %&"* ( #
    232

 3%* * &  

&
  *   46
%
c "*D 0 0C D cD

7"! &&E*&80

7"! & E*&%
 c"%D 0 0C D *    


c&#" ! 6
& #  & 
&#" "  -,. 4%
" &%*%0   &
" & 

  &  ) %&


 &-,.% " #" &%!
 &&
00   666 )
 %
 &-,.0 -,.!&
&
00  0 666 0   666% !  
% &  &
+8    & 
+
#
4

c+ & !1#
& #

! Ëersion Number: c1* &  


! &#
: + #!  "
*%
c"  
   
 
&#
&& ! &"&& 
#
&
 c#
&
&3" 
! &%!1%

! Header Length: :" !1#


   
!* "
*&  ' " !1
#
(1* 
 
 #
" *#  
#
      #

0* 

! Datagram Length: c #&


#
' "(
" *  ) 
&C* #%
6
"
>&
#
CF%FF*  !%#

 F* % & 
 >FHC
*  
! TOS: c &!'c?)(* " 
!1&& 3 3&#
*
 #"&
% "
*  "
* &&   
&! w 
+!%&6
%"*"&"*
* #" + #
&
#

  #' # %cc
#( "*"&"
c #"2
#
' # %"*  
c    (&
  22
&&' # %4c(

! Identifier, Flags, Fragmentation Offset: c


&!2&#
 

! Time-to-live: c
22!'cc-(& "
 "#
 "&!  +
c&
 *  
#

* " &cc-&%#

"* 
! Protocol: c&  "  #

&   c!"&& 


c  2    
  &#
*  46
%
,!"&C    c %
!"&H  ;

! Source and Destination IP Address: c&


0*&" &   &
#
c" 
 & 
 c"' #
"     "
*("
       
+
! Header Checksum: c+"
"
 #* !#
c
+"

"*  #0*  
 "
* "

 # "
*" #<


 
%<

 &"
%+ 
  +"
% +"
&
,"
"  +"
&!
#
    &+"

 #
 7"
"+"

"  #


& *
 .+"

"*
" 
"%cc-&%  *   
&%
  # 

5 Options: c    & 


*6    
 *"
  !!*   " #
 &
    & ! #

5 Data (payload): 4  %
% 


 &2   p  &#
 &
A 
"
 %&&
#
    2 #
 'c ;(
*!  !%&
  &%" 
#
IPv6
  DD<   #  #c+&*# 
&&! "!1  , 


! &&&> 02*


 *#  #*"" %  +
  * #  ' * #
" 7"(*+ # c  
 &# %  %!C%
!  c# &!C+ " 
c+ "#
  &!1%* 
"
"  6  !1
!C+4

c&
&!C +  4#"
c& # +&&  !C

! version. c&"*& &!  "


*
."  # %!C!"&3C3 & .
 " #313 & !!1
+

! priority. c&"*&
  c)&
 ! 1 !""#H*
"&  
 #&& #  '  %
&"*+&&  & # (%
!"E"#F"&  2 #
 &&%"  *2

&&

! flow label ,"*!%&"


 & 3&3& +
! payload length. cC2*!" 
; #  ##!  "
*&*  !C +
4 #&6 #%1*  +

! next header. c& & 


  '&(& +*!' # %
c ;( c&"
!"
& !1

! hop limit. c  &&


 * 
 * "& + & 

" >% +
! source and destination address. , !C
& #""

! data. c    &!C + w


 +  %  *
!
&
 +     &
 6&
Data link Layer
5 ! p  p 
î 
  î  + 

5 
 *&
  #"  
&
  

5  
 
 p

5 #"&&&


5 &
#  + 

 #
 
c
 +& + 

5 c &&
 + & 

  + & 

 
5  !*
&  
  #" &*'&
(

Network Network
Layer Layer
Data Link Data Link
Layer Layer
Physical Physical
Layer Layer
c & +
 + 
/ :.+,  #


"   


/  22 .+&'
"(  

Õroadcast Network Point-to-Point Network

c  % +'-,.(* 


 +'w,.(  22  
-,.+
5 - +'-,.( 
" 
*" #   +,
-,.*
.+c  #&-,.bus ring  star
w+  -,.   *"
 #

Õ s A Ri g A
, "* 
  * +% 
" "
     

 


"   c 


 
  
 * "

,  ', ( c,  




  , "* 
"* & + c#  &
 + & -#- +
 '-- (



 

Lo ical Link

@  
Control

 
Medium ccess
Control


    
 2 2- +- 
5 *"&""2 + 
5  '  E0 ( "
5 )" * ! &   

  

5 ) E0 %  'N(

5 ) * 2* 
5   "   &  
5 :F Thick Ethernet: * 6*
5 :0 Thin Ethernet: * 6*
5 :2c * c
5 :2cN * ! # F

5 :24N * !4*? 
5 :24N * !4*? 
5 :24N * !4*? '&
 +(
,   4

5 c 
*7" &  # "&
  >
5   "    +

 , #

 &+!      


 & 
&
 &'*(%&

)
 & * #

# > î 




sti ti S rc
r bl ATA R
A r ss A r ss
 E0) 
 E0&
 & &-,.%& 
--  !, "* 
Difference for our purposes:   E0 "
&& 
  " #

 22  +


5   +    22   +
/ 2 )- "
/ " * 
#2   22   +

5 % " * *

5  +  &  22   +



/    " &#

/ .
  

J





Dial-Up ccess
5 c&
&
&  &#"

5 + " 6"


5 ;"
6
"
&
>F
).+

)
 + # *"*"

 +%  #%" #%
 & #
 
 c +&
 +
, % +
 +  22
  ++* +
)
 +!
 "
Physical Layer
c      
  does not apply specifically to TCP/IP
!  "  #c $%!%it is still important
To understand its significance and role  
c c $  
 - 4"  
c& #
   *&  
 

5 Definition of Hardware Specifications: c&


  &*% % & 
!#  &"  &   

5 Encoding and Signaling: c     *


&!"  # #  #&"   &

&
* 
" 
! #  * ! + 

5 Data Transmission and Reception: ,&  #


   %   "  

% &"%! . 7"
  +%! &  #*
*  +A
6
&  - 
5 c 
5 6*
5 ? &*

cc " #   


  c#  

"#  #" &  
 
 c     *" #
   # 
26*" ! *#
&6" -,.
/ F2
*O** P
/ HF2
*O**  # ** P
 # %6* 

"  &#
&7"   
6* !
"#*  


‘  


      
 
   

? &*
, &6*
"
 *& " #
   ? &* &! &   &
#'("" *    &#' #(
# 2 *
&#'&"" #*
(
 
*   &
c  & " *"
#   ' 6&& (  #
, "  &* *+ *   #

" #




    




c