Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Computer Networks Primer

Lipyeow
September 24, 2016

Computer Networks Primer

Crash course on computer networks

Lipyeow

September 24, 2016
Tweet

More Decks by Lipyeow

Other Decks in Education

Transcript

  1. ICS  321  Data  Storage  &  Retrieval   Computer  Networks  Primer

      Informa>on  &  Computer  Science  Department   University  of  Hawaii  at  Manoa   1   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa  
  2. Modern  Computer  Networks   •  Signaling  technology  can  transmit  complex

     sequences  of   bits  -­‐  packets   •  Each  host  or  router  obeys  a  set  of  rules  for  how  to  handle   incoming/outgoing  messages  –  communica>on  protocols   •  Communica>ons  can  be  mul>-­‐way   •  Bandwidth:  the  number  of  bits  that  can  be  transferred  per   second  (bps)   •  Latency:  the  >me  it  takes  for  a  message  to  reach  the   des>na>on  aRer  leaving  the  source   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   2   Host computer Host computer Router Router Router Fibre  op>c   cables   Ethernet  or   WiFi   Host computer Local area network
  3. Local  Area  Networks   •  Wired  (UTP  Cat5)  or  Wireless

     802.11   •  Connects  hosts  within  a  limited  spa>al  region  together   to  form  a  network   •  All  hosts  within  the  network  can  “talk”  to  each  other   •  The  network  is  oRen  a  shared  medium:  only  one  host   can  talk  at  one  >me  and  the  rest  listens.   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   3  
  4. Data  Packet   •  How  messages  are  packaged  for  

    delivery  on  the  network  –  like   postal  mail.   •  Source  and  des>na>on  addresses   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   4  
  5. Network  Abstrac>ons   •  Network   communica>ons  are   conceived

     as  layers  of   abstrac>ons.   •  Each  layer  plays  a  specific   role  and  is  rela>vely   independent  of  other   layers   •  Each  layer  has  its  own   packet  format   •  Packets  from  higher   layers  are  embedded  in   packets  of  lower  layers  –   “encapsula>on”   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   5   Network   Applica>on   Transport   Internet   Link   Applica>on   Transport   Internet   Link   Applica>on   Transport   Internet   Link   Physical  Network  
  6. TCP/IP  Four  Layer  Model   Lipyeow  Lim  -­‐-­‐  University  of

     Hawaii  at  Manoa   6   Applica>on   Transport   Internet   Link   •   Process  to  process:  communicates  data  to  other   processes/applica>ons  on  the  same  host  or  on  other  hosts   •   Eg.  SMTP,  FTP,  SSH,  HTTP   •   Host  to  host:  communicates  data  to  other  host  on  the   same  network  on  on  other  networks   •   Hides  the  topology  of  the  network   •   Flow  control,  error  correc>on,  connec>on  control   •   Eg.  TCP,  UDP   •   Inter-­‐network:  communicates  data  to  other  networks   •   Deals  with  addressing  and  rou>ng  of  datagrams  to  next   network   •   Eg.  IPv4,  IPv6   •   Transmit  data  to  other  network  interfaces  on  the  local  network   •     Eg.  Ethernet,  WiFi  802.11  
  7. Link  Layer   Data  packet  arrives  from  upper  layer  (Internet

     layer)   •  If  packet  is  too  big,  break  packet  into  smaller  fragments  (`frames’)   •  Embed  data  packet  in  a  link  layer  packet  with  link  layer  header,   sequence  number,  error  correc>on  code  etc.   •  Link  layer  packets  gets  transmiced  on  physical  link   •  Link  layer  protocol  governs  how  transmission  over  physical  link  is   done.  Eg.  Carrier  sense  mul>ple  access   Bocom-­‐up  process  is  similar  on  the  receiving  host   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   7   Applica>on   Transport   Internet   Link   Applica>on   Transport   Internet   Link   Physical  Network   •  Eg.  Ethernet,  WiFi  802.11   •  A  host  can  have  mul>ple  network  interface   cards  (eg.  Laptops  typically  have  an   ethernet  interface  and  a  WiFi  interface)   •  Each  interface  has  a  48-­‐bit  physical  address   that  is  hardwired  to  the  hardware  
  8. Internet  Layer   Data  packet  arrives  from  Transport  layer  

    •  Embed  data  packet  in  an  IPv4    packet  with  IP  header  etc.   •  Pass  packet  to  Link  layer   Data  packet  arrives  from  Link  layer   •  Check  IP  header  if  packet  des>na>on  is  for  this  host.  If  yes,  strip   header  and  pass  to  Transport  layer   •  Otherwise  forward  packet  (rou>ng)   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   8   Applica>on   Transport   Internet   Link   Applica>on   Transport   Internet   Link   Physical  Network   •  Eg.  IPv4   •  Connects  mul>ple  networks  together.   •  Each  network  interface  of  a  host  is   associated  with  an  32-­‐bit  IPv4  address   •  IP  address  is  not  hardwired,  but  assigned  in   the  soRware  
  9. IPv4  Addresses  &  Domain  Name  Service   •  IP  addresses

     are  32  bit  numbers  oRen  wricen  in  4   octets:  128.171.10.13   •  Each  address  is  also  split  into  two  parts   –  Prefix  is  the  network  address   –  Suffix  is  the  host  address  within  that  network   •  Domain  Name  Servers  provide  a  service  that  translates   more  meaningful  names  to  IP  addresses   –  Uhunix.hawaii.edu  =  128.171.24.197   –  www2.hawaii.edu  =  128.171.224.150   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   9   128   171   10   13   Network Address Host Address 0 31 16
  10. IPv4  &  Inter-­‐network  Rou>ng   For  routers   •  Examine

     des>na>on  IP  address   •  Look  up  rou>ng  tables  to  determine  outgoing  network   •  Pass  packet  to  link  layer  of  that  outgoing  network   •  Best  effort  delivery  –  no  guarantees!   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   10   Applica>on   Transport   Internet   Link   Internet   Link   Ethernet  Network   Internet   Link   Applica>on   Transport   Internet   Link   Ethernet  Network   Fibre  Network   host host Router Router
  11. Transport  Layer   TCP  provides  a  reliable  communica>on  channel  between

     two  host   applica>ons  by  addressing  several  issues   •  Data  packets  arriving  out  of  order   •  Data  packets  are  corrupted   •  Same  packets  arriving  more  than  once   •  Some  packets  are  lost/discarded   •  Traffic  conges>on  control   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   11   Applica>on   Transport   Internet   Link   Applica>on   Transport   Internet   Link   Physical  Network   •  Eg.  TCP  (connec>on-­‐oriented),  UDP   •  End-­‐to-­‐end  message  transfer  between   hosts  applica>ons   •  Each  applica>on  on  a  host  is  associated   with  a  port  number   •  IP  address  +  port  number  will  iden>fy  an   applica>on  end-­‐point  
  12. Applica>ons:  Email   •  Your  email  client  program  downloads  incoming

     emails  from   mail  server  (imap.gmail.com  pop.gmail.com)   •  Outgoing  emails  are  sent  to  mail  server  (smtp.gmail.com)   •  Mail  servers  handle  the  rou>ng  of  emails  using  SMTP   protocol  which  operates  on  port  25  or  587   –  Lookup  IP  address  of  des>na>on  hostname  in  the  email  address   using  DNS   –  Relaying  email  as  packets  to  that  IP  address       Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   12   POP/IMAP/SMTP   Transport:  TCP   Internet:  IPv4   Link   POP/IMAP/SMTP   Transport:  TCP   Internet:  IPv4   Link   Network   Mail Server Mail Server Network   Internet   POP/IMAP/SMTP   Transport:  TCP   Internet:  IPv4   Link   POP/IMAP/SMTP   Transport:  TCP   Internet:  IPv4   Link   Mail Client Mail Client
  13. Sample  Email  Header   Delivered-­‐To:  [email protected]   Received:  by  10.58.145.6

     with  SMTP  id  sq6csp687725veb;  Mon,  3   Sep  2012   20:39:01  -­‐0700  (PDT)   Received:  by  10.68.129.38  with  SMTP  id  nt6mr43102232pbb. 76.1346729940698;  Mon,   03  Sep  2012  20:39:00  -­‐0700  (PDT)   Return-­‐Path:  <[email protected]>   Received:  from  mta11.its.hawaii.edu  (mta11.its.hawaii.edu.   [128.171.224.147])   by  mx.google.com  with  ESMTPS  id  px6si25354378pbc. 214.2012.09.03.20.38.53   (version=TLSv1/SSLv3  cipher=RC4-­‐MD5);  Mon,  03  Sep  2012   20:39:00  -­‐0700  (PDT)   Received-­‐SPF:  pass  (google.com:  domain   of  [email protected]   designates  128.171.224.58  as  permiced  sender)  client-­‐ ip=128.171.224.58;   Authen>ca>on-­‐Results:  mx.google.com;  spf=pass  (google.com:   domain  of   [email protected]  designates  128.171.224.58  as   permiced  sender)   [email protected]   MIME-­‐version:  1.0   Content-­‐type:  mul>part/mixed;   boundary="Boundary_(ID_3RY8N2VbJHb4tH5siR1eww)"   Received:   from  pmx11.its.hawaii.edu  (pmx11.its.hawaii.edu   [128.171.224.58])  by   mta11.its.hawaii.edu  (Sun  Java(tm)  System  Messaging  Server   6.3-­‐11.01  (built   Feb  12  2010;  32bit))  with  ESMTP  id   <[email protected]>;   Mon,  03  Sep  2012  17:38:45  -­‐1000  (HST)   Received:   from  kuhi.its.hawaii.edu  (kuhi.its.hawaii.edu  [128.171.25.223] )  by   pmx11.its.hawaii.edu  (Posxix)  with  ESMTP  id  E587118C023;  Mon,   03  Sep  2012   17:38:42  -­‐1000  (HST)   Received:   from  sak24.its.hawaii.edu  (sak24.its.hawaii.edu  [128.171.225. 199])   by  kuhi.its.hawaii.edu  (8.12.10/8.12.6)  with  ESMTP  id   q843ccvH023430;  Mon,  03   Sep  2012  17:38:38  -­‐1000  (HST)   Date:  Mon,  03  Sep  2012  17:38:33  -­‐1000  (HST)   From:  Dennis  Streveler  <[email protected]>   Cc:  "[email protected]"  <[email protected]>   Message-­‐id:   < [email protected] awaii.edu>   Subject:  ICS  101  Help:  Tuesday  lecture  -­‐-­‐  Everything  you  THOUGHT   you  knew   about  NETWORKS  and  then  some   X-­‐Mailer:  sakai-­‐mailsender   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   13  
  14. Applica>ons:  HTTP   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at

     Manoa   14   HTTP   Transport:  TCP   Internet:  IPv4   Link   HTTP Server Internet   HTTP   Transport:  TCP   Internet:  IPv4   Link   HTTP Client •  Hyper-­‐Text  Transfer  Protocol   (port  80)   •  Request-­‐response  protocol   •  When   hcp://www2.hawaii.edu/ ~lipyeow/index.html  is  entered   into  a  web  browser  (hcp  client)   HTTP/1.1 200 OK Date: Sun, 02 Sep 2012 00:35:40 GMT Server: Apache Last-Modified: Tue, 21 Aug 2012 01:27:18 GMT ETag: "7d3e8-2950-4c7bc86e86980" Accept-Ranges: bytes Content-Length: 10576 Content-Type: text/html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> ... GET /~lipyeow/index.html HTTP/1.1 host: www2.hawaii.edu  
  15. Internet  Security   •  All  data  transmiced  on  the  network

     using  the   protocols  described  thus  far  are  in  plaintext   Lipyeow  Lim  -­‐-­‐  University  of  Hawaii  at  Manoa   15   •  Anyone  with  access  to  the   physical  network  link  can  snoop   on  the  bit  sequences  and  decode   according  to  the  protocol  stack!   •  Anyone  can  read  your  emails  if   he/she  has  access  to  a  link  on   which  your  email  packets  are   transmiced   •  Use  encrypted                             connec>ons  eg.  SSL/TLS