exam 1 crib sheet, 1

2
1. A bit has the unit of b and a byte has the unit of B, a byte is 8 bits. 2. M in bandwidth means 10 6 . M in data size means 2 20 . Network requirements: TCP makes sure each message is received (ack sent back and forth) which gives us reliability and manages congestion control. A network is 2 or more linked devices capable of communication. Facebook, Comcast, Internet, cell networks, radio, and your brain are all examples of networks. Important network features may be: Connectivity: Pointtopoint link connection (PRO: security, dedicated (always available) CON: hard to scale (add device? Create a longer path)) box box Multiple access several nodes vying for a local access channel, see how it shares link (Ethernet) (PRO: store date in one place and everyone can access it, speed as its faster because everyone can intercept every message sent, scalable, low idle time) line on bottom and connected boxes above Scalability Sharing: Timesharing (STDM: Synchronous Time Division Multiplexing): The sending nodes share the link by taking turns via time. Time is broken into slices (.1 seconds each) so A gets to use the link between the switches for .1 seconds then the others, then A gets to use it again (PRO: fair and easy to implement) (CON: wasting time if no data is waiting to be sent from the node (inefficient), long wait times, scalability isn’t good) FDM: Frequency Division Multiplexing: The signal is split up into three different channels and each channel is sent at a different frequency over the switchtoswitch link. This is similar to how TV signals work (you get all 100 channels all the time even if you don’t tune into them) (PRO: all can talk at the same time, multiple senders, fair, good for real time data) (CON: sending lots of unnecessary data, inefficiently with idle nodes, scalability) Statistical Multiplexing: The data is broken into packets (with a fixed maximum size). Packets arrive at the switch and each is send along the switchtoswitch link. The switch needs to determine how to prioritize the packets. This could be done in a firstinfirstout manner or a round robin fashion where your turn gets skipped if you have no data. (PRO: uses the bandwidth well, efficient as long as someone has something to send the switch is working, scalability, Internet uses) (CON: wait times could increase a lot, less fair than other 2, more work for nodes and switches) Network architecture & layers OSI (7 layers): Application (whatever application requires), Presentation (encodes/decodes data, formatting), Session (management of streams), Transport (reliability, acks and congestion control), Network (route packets), Data Link (framing, encoding bits into signals), Physical (actually sends signal across the link) Internet (4 layers): 1 Application (Application, Presentation, Session) (EX: HTTP (web fetches), SMTP (email), FTP (files from one place to another)) 2 – Transport (Transport) (EX: TCT (reliable data, most used), UDP (video, no acks built in, good for high volume data)) 3 – Network (Network) (EX: IP) 4 – Link (Link, Physical) (EX: Ethernet, wireless, fiber, cell protocols, etc.) Network Components o Nodes (connection point), links, hosts (COMPUTERS that host information), switches (bridges), routers (gateways) Network Data o Frames(link layer), packets (network layer) messages (IP header, checksum, etc., ) (all the same – just different names on different layers) FDM, STDM, statistical multiplexing (protocols for multiplexing flows) Network Performance o Latency: Total time for a transfer, also called delay, L=P+T+Q where P is the propagation delay and the physical time to transfer, depends on the type of wire and what’s being carried through, depends on distance; T = time to transfer data, depended on bandwidth and total data size; Q = queuing delay or time at switches and routers Bandwidth: Theoretical Max, # of bits/seconds RTT: round trip time, 2 x P Delay x bandwidth = (RTT/2)x bandwidth Throughput: actual data carried over time, # of bits/seconds Problems: M = Mbps (throughput or bandwidth) 10^6 but Mb (data size, megabit/byte) is M = 2^20; Kbps the K = 10^3, Kb the K = 2^10 Example 1: Suppose you want to send a 1.5 MB file. RTT = 80 ms. Packet size = 1 KB. There is 2 x RTT of handshaking. What is the total time to transfer the 1.5 MB file in the following cases? a. bandwidth is 10 Mbps and packets are sent continuously ANSWER: total time = 2 x RTT + L = (2 x 80ms) + (40ms +(1.5MB/10Mbps) +0) = .16 sec + (.04 sec + (1.5x2^20x8(bits)/10x10^b (sits/sec)) = 1.458 seconds b. bandwidth is 10 Mbps, but after sending each packet, must wait one RTT before sending the next packet First, let’s see how many packets we need to send: ANSWER: # packets = 1.9 MB/1 KB = 1.5x2^20B/1x2^10B = 1536 packets; total time = 1.458 + (1535*.08sec) = 124.258 seconds c. bandwidth is infinite, up to 20 packets can be sent each RTT ANSWER From part (b), we know the # of packets is: 1538/20 = 76.8 = 77 transmits but 76.5 RTT; Total time= (2xRTT) + 76.5 RTT) = 78.5 RTTs = 78.5x.08sec = 6.28sec Example 3 (ex. 1.27): Calculate the bandwidth necessary for transmitting the following data in real time. a. HDTV (1920 x 1080 pixels, 24 bits/pixel, 30 frames/second) ANSWER: data/time = (1920x1080x24)bits X 30 frames/sec = 1.5 Gbps Example 4 (ex. 1.17): Calculate the latency (first bit sent to last bit received) for the following cases: a. 1Gbps link with a single store and forward switch in the path. Packet size is 5000 bits. Each link introduces a propagation delay of 10 us and that the switch begins retransmitting immediately after it has finished receiving the packet. A – X – B and one link is one line; For one link: Latency = P+T+Q = 10ms + (5KB/1Gbps) which is 5ms + 0 = 15 ms; For two links: 30 ms Physical Links Coaxial cable:used by Comcast, copper wire w/ 2 layers of insulation; 10 100 Mbps can go 200 m Twisted pair: like Ethernet has 4 twisted pairs, CenturyLink, 10 – 100 Mbps can go 100 m Fiber: made of glass and sends lights as signals; 100 Mbps – 10 Gbps can go 40 km Encoding Schemes – lots of transitions make the signals easy to decode o NRZ: 1 > high, 0 > low; PRO: simple to implement and simple to understand; CON: long repeated bits (leads to baseline wander) so that if you have a lot of zeros the signal will wander to the average and make it harder to decode. o NRZI: 1 > transition, 0 > no transition; PRO: long sequence of 1’s we are now okay; CON: still have baseline wander for zero’s o Manchester: 1 > high to low, 0 > low to high; PRO: lots of transitions; CON: has to read w signals for each bit so only running at 50% efficiency so we are loosing half the amount of data we could be sending o Differential Manchester the receiver does not need to know the polarity of the signal. The polarity can be figured from the line transitions. It does not matter whether a logical 1 or 0 is received, but only whether the polarity is the same or is different from the previous value. o 4B/5B – encode a 4 bit pattern into 5 bits so you can get rid of a lot of zeros in a row then apply NRZI; PRO: Transitions; CON: 80% efficiency Framing Protocols – group bits into messages o Byteoriented: give the size of the frame (bytes) put the number of bytes in the header then read that many bytes (don’t have to escape characters); Header – Payload Checksum o Bitoriented: these protocols beginning and ending bit pattern (if this pattern occurs somewhere else in your data it puts a zero in 6 th 1’s spot); good because its flexible in that you can send variable number of bits; EX: HDLC 01111110 where the 111111 is the escape pattern o Clockbased: use the clock, every frame is exactly the same size (fixed size frames); good because its easy but bad if you are sending small amounts of data because you are wasting lots of data room; EX: SONET (9 rows of 90 bytes) o Sentinels (byte boundary): use a control code at the beginning and end of the frame (means you need to escape the control code “/” for example; good example of this is a PPP (Flag – Header – Payload – Checksum – Flag) Error Detection ADD WORKSHEET o 2D parity: each row and col has an even number of face up and face down cards so you can compare like Sudoku to find the exact position; 1 bit knows exactly what bit is error; 2 bit can detect but 4 possible bits for 2 errors; 3 or 4 bits can detect some and not others o Checksum: IP uses that for each packet; PRO: no matter how long the message is you are always sending the same amount of data, which means scalability, is great. This could detect one flipped bit (cant recover it like you can in 2D) but you would know an error occurred. Cant detect an aligned set of bits with 2 switches because sum of that col would be the same. Formula for checksum: 1. Add up the words transmitted using ones complement arithmetic. 2. Use the sum as the checksum (represented in ones complement) Review of ones complement representation: Positive numbers: represented normal in binary Negative numbers: each bit is inverted Examples of ones complement: 7 = 00000111, 7 = 11111000 Assume data is the following: 00000010(2) 00000101(5) 00000011(3) 11111100(3) Then, when we add the numbers, we get: 00000010(2) 00000101(5) = 00000111 (7) + 00000011(3)= 00001010(10) + 11111100 (3) = 00000110 (plus a 1 in the carry bit, so this is added to the LSB)+1 = 00000111(7) So, 00000111 would be sent as the checksum for the data. o CRC: Pro: Low overhead (only going to add the number of bits in C(x) which is an advantage over checksum, its more unlikely that if you flip a couple of bits you will still get a correct remainder of 0. CONS: more work (for both sender and receiver) not a lot but a litter and there is no error recovery. Internets idea is to know if something went wrong but we don’t really care to fix it – just have sender resend data Background: Represent message M by a polynomial M(x) If M = 10010101, then M(x) = x7 + x4 + x2 + x0 Sender calculates P(x) from M(x) that is exactly divisible by C(x), where C(x) is an established agreed upon polynomial with degree k. Send P(x). Receiver divides P(x) by C(x). If remainder is not 0, an error occurred. M(x) is all but the last k bits and is used as the message To calculate P(x): Multiply M(x) by xk where C(x) has degree k. Let the result be T(x). Find remainder R(x) of T(x) / C(x); P(x) = T(x) – R(x) Example of finding P(x): M = 10101101; M(x) = x7 + x5 + x3 + x2 + x0; C(x) = x3 + x2 + 1; Since the degree of C(x) = 3, we multiply M(x) by x3. ; T(x) = x10 + x8 + x7 + x5 + x3 Now, find remainder R(x) when dividing T(x) by C(x) (division is done with subtraction as XOR): 11011011 R: 111 1101 10101101000 1101 1111 1101 0101 0000 1010 1101 1111 1101 0100 0000 1000 1101 1010 1101 111 P(x) = T(x) – R(x) 10101101000 111 ___________ 10101101111 (subtraction done via XOR) 10101101111 is sent to receiver Receiver calculates message: P(x) / C(x) 000 is remainder Thus, the data is “good” and the message is 10101101. (remove last 3 bits from what was sent) 11>0; 10 >1; 01>1; 00>1 Reliable Transmission: Data can get lost because of buffer overflow on the switches, corrupted bits, internal nodes goes down, sender node fails ARQ: Automatic Repeat Request (at the link layer); sender sends the frame, wait for ack, no ack received send the frame again, if ack arrives send next frame: If ack takes too long (more than 2 RTT) it might get sent again; we just toggle b/t frame 1 and frame 0 because with ARQ we can only have 2 things out at a time; PRO: simple and it gets you what you want > you know when someone gets your message; CON: sender waits a lot so not utilizing the bandwidth which makes it very slow Stop & Wait Sliding Window: PRO: not nearly as much wait time, utilizing bandwidth; CON: more complicated to code, more things to keep track of more things to process HANDOUT LANs MAC addresses (hardware addresses) Aloha – early version of using a shared resource: Hawaiian islands if you had data to send, you sent it and if you collided then you picked a random length of time and tried to send it again; P persistent wait a random amount of time Ethernet (802.3) CSMA/CD (Carrier Sense (a node can detect whether a line is idle or busy) Multiple Access (shared common resources) with Collision Detection (node listens while sending and can detect collisions)) Protocol for sending: 1. Send if you have data 2. If link is busy wait and then send; this is 1 Persistent or it sends ASAP and if there is a collision both have to wait Each frame has a min size so they’re are long enough to detect collisions (64 B) and a max size so the frame isn’t too big because then we allow one to hog and increase the chance of a waiting queue (1500 B) Coax can be 500 m away and a twisted pair/fiber can be 2500 m away but we can make this bigger by adding switches Frame Format: Preamble (8B, alternating 0’s and 1’s to sync reception) – Dest (6B) – Source (6B) – Type (2B what higher level protocols) – Data/Payload – CRC (4B, error detection)

Upload: jena-graham

Post on 13-Apr-2015

17 views

Category:

Documents


0 download

DESCRIPTION

Networks!

TRANSCRIPT

Page 1: Exam 1 Crib Sheet, 1

1. A  bit  has  the  unit  of  b  and  a  byte  has  the  unit  of  B,  a  byte  is  8  bits.  

2. M  in  bandwidth  means  106.  M  in  data  size  means  220.  

Network  requirements:    TCP  makes  sure  each  message  is  received  (ack  sent  back  and  forth)  which  gives  us  reliability  and  manages  congestion  control.    A  network  is  2  or  more  linked  devices  capable  of  communication.    Facebook,  Comcast,  Internet,  cell  networks,  radio,  and  your  brain  are  all  examples  of  networks.    Important  network  features  may  be:  Connectivity:  Point-­‐to-­‐point  link  connection  (PRO:  security,  dedicated  (always  available)  CON:  hard  to  scale  (add  device?  Create  a  longer  path))  box  -­‐  box  Multiple  access  several  nodes  vying  for  a  local  access  channel,  see  how  it  shares  link  (Ethernet)  (PRO:  store  date  in  one  place  and  everyone  can  access  it,  speed  as  its  faster  because  everyone  can  intercept  every  message  sent,  scalable,  low  idle  time)  line  on  bottom  and  connected  boxes  above  Scalability  Sharing:  Time-­‐sharing  (STDM:  Synchronous  Time  Division  Multiplexing):  The  sending  nodes  share  the  link  by  taking  turns  via  time.    Time  is  broken  into  slices  (.1  seconds  each)  so  A  gets  to  use  the  link  between  the  switches  for  .1  seconds  then  the  others,  then  A  gets  to  use  it  again  (PRO:    fair  and  easy  to  implement)  (CON:  wasting  time  if  no  data  is  waiting  to  be  sent  from  the  node  (inefficient),  long  wait  times,  scalability  isn’t  good)  FDM:    Frequency  Division  Multiplexing:    The  signal  is  split  up  into  three  different  channels  and  each  channel  is  sent  at  a  different  frequency  over  the  switch-­‐to-­‐switch  link.    This  is  similar  to  how  TV  signals  work  (you  get  all  100  channels  all  the  time  even  if  you  don’t  tune  into  them)  (PRO:  all  can  talk  at  the  same  time,  multiple  senders,  fair,  good  for  real  time  data)  (CON:  sending  lots  of  unnecessary  data,  inefficiently  with  idle  nodes,  scalability)  Statistical  Multiplexing:    The  data  is  broken  into  packets  (with  a  fixed  maximum  size).    Packets  arrive  at  the  switch  and  each  is  send  along  the  switch-­‐to-­‐switch  link.    The  switch  needs  to  determine  how  to  prioritize  the  packets.    This  could  be  done  in  a  first-­‐in-­‐first-­‐out  manner  or  a  round  robin  fashion  where  your  turn  gets  skipped  if  you  have  no  data.    (PRO:    uses  the  bandwidth  well,  efficient  as  long  as  someone  has  something  to  send  the  switch  is  working,  scalability,  Internet  uses)  (CON:    wait  times  could  increase  a  lot,  less  fair  than  other  2,  more  work  for  nodes  and  switches)  Network  architecture  &  layers  OSI  (7  layers):    Application  (whatever  application  requires),  Presentation  (encodes/decodes  data,  formatting),  Session  (management  of  streams),  Transport  (reliability,  acks  and  congestion  control),  Network  (route  packets),  Data  Link  (framing,  encoding  bits  into  signals),  Physical  (actually  sends  signal  across  the  link)  Internet  (4  layers):  1  -­‐  Application  (Application,  Presentation,  Session)  (EX:    HTTP  (web  fetches),  SMTP  (email),  FTP  (files  from  one  place  to  another))  2  –  Transport  (Transport)  (EX:    TCT  (reliable  data,  most  used),  UDP  (video,  no  acks  built  in,  good  for  high  volume  data))  3  –  Network  (Network)  (EX:  IP)  4  –  Link  (Link,  Physical)  (EX:  Ethernet,  wireless,  fiber,  cell  protocols,  etc.)    Network  Components  o Nodes  (connection  point),  links,  hosts  

(COMPUTERS  that  host  information),  switches  (bridges),  routers  (gateways)  

Network  Data  o Frames(link  layer),  packets  (network  layer)  

messages  (IP  header,  checksum,  etc.,  )  (all  the  same  –  just  different  names  on  different  layers)  

• FDM,  STDM,  statistical  multiplexing  (protocols  for  multiplexing  flows)  

Network  Performance  o  Latency:  Total  time  for  a  transfer,  also  

called  delay,  L  =  P  +  T  +  Q  where  P  is  the  propagation  delay  and  the  physical  time  to  transfer,  depends  on  the  type  of  wire  and  

what’s  being  carried  through,  depends  on  distance;  T  =  time  to  transfer  data,  depended  on  bandwidth  and  total  data  size;  Q  =  queuing  delay  or  time  at  switches  and  routers    

Bandwidth:    Theoretical  Max,  #  of  bits/seconds  RTT:  round  trip  time,  2  x  P  Delay  x  bandwidth  =  (RTT/2)x  bandwidth  Throughput:    actual  data  carried  over  time,  #  of  bits/seconds  Problems:    M  =  Mbps  (throughput  or  bandwidth)  10^6  but  Mb  (data  size,  megabit/byte)  is  M  =  2^20;  Kbps  the  K  =  10^3,  Kb  the  K  =  2^10  Example  1:  Suppose  you  want  to  send  a  1.5  MB  

file.  RTT  =  80  ms.  Packet  size  =  1  KB.    There  is  2  x  RTT  of  handshaking.  What  is  the  total  time  to  transfer  the  1.5  MB  file  in  the  following  cases?    a.  bandwidth  is  10  Mbps  and  packets  are  sent  continuously  ANSWER:  total  time  =  2  x  RTT  +  L  =  (2  x  80ms)  +  (40ms  +(1.5MB/10Mbps)  +0)  =  .16  sec  +  (.04  sec  +  (1.5x2^20x8(bits)/10x10^b  (sits/sec))  =  1.458  seconds    b.  bandwidth  is  10  Mbps,  but  after  sending  each  packet,  must  wait  one  RTT  before  sending  the  next  packet  First,  let’s  see  how  many  packets  we  need  to  send:  ANSWER:  #  packets  =  1.9  MB/1  KB  =  1.5x2^20B/1x2^10B  =  1536  packets;  total  time  =  1.458  +  (1535*.08sec)  =  124.258  seconds  c.  bandwidth  is  infinite,  up  to  20  packets  can  be  sent  each  RTT  ANSWER  From  part  (b),  we  know  the  #  of  packets  is:  1538/20  =  76.8  =  77  transmits  but  76.5  RTT;  Total  time=  (2xRTT)  +  76.5  RTT)  =  78.5  RTTs  =  78.5x.08sec  =  6.28sec    Example  3  (ex.  1.27):  Calculate  the  bandwidth  necessary  for  transmitting  the  following  data  in  real  time.  a.  HDTV  (1920  x  1080  pixels,  24  bits/pixel,  30  frames/second)  ANSWER:  data/time  =  (1920x1080x24)bits  X  30  frames/sec  =  1.5  Gbps  

  Example  4  (ex.  1.17):  Calculate  the  latency  (first  bit  sent  to  last  bit  received)  for  the  following  cases:  a.    1-­‐Gbps  link  with  a  single  store  and  forward  switch  in  the  path.  Packet  size  is  5000  bits.  Each  link  introduces  a  propagation  delay  of  10  us  and  that  the  switch  begins  retransmitting  immediately  after  it  has  finished  receiving  the  packet.  A  –  X  –  B  and  one  link  is  one  line;  For  one  link:  Latency  =  P+T+Q  =  10ms  +  (5KB/1Gbps)  which  is  5ms  +  0  =  15  ms;  For  two  links:  30  ms  

Physical  Links  Coaxial  cable:used  by  Comcast,  copper  wire  w/  2  layers  of  insulation;  10  -­‐100  Mbps  can  go  200  m  Twisted  pair:  like  Ethernet  has  4  twisted  pairs,  CenturyLink,  10  –  100  Mbps  can  go  100  m  Fiber:  made  of  glass  and  sends  lights  as  signals;  100  Mbps  –  10  Gbps  can  go  40  km  • Encoding  Schemes  –  lots  of  transitions  make  

the  signals  easy  to  decode  o NRZ:    1  -­‐>  high,  0  -­‐>  low;  PRO:  simple  to  

implement  and  simple  to  understand;  CON:  long  repeated  bits  (leads  to  baseline  wander)  so  that  if  you  have  a  lot  of  zeros  the  signal  will  wander  to  the  average  and  make  it  harder  to  decode.  

o NRZI:  1  -­‐>  transition,  0  -­‐>  no  transition;  PRO:  long  sequence  of  1’s  we  are  now  okay;  CON:  still  have  baseline  wander  for  zero’s  

o Manchester:  1  -­‐>  high  to  low,  0  -­‐>  low  to  high;  PRO:    lots  of  transitions;  CON:  has  to  read  w  signals  for  each  bit  so  only  running  at  50%  efficiency  so  we  are  loosing  half  the  amount  of  data  we  could  be  sending    

o Differential  Manchester  -­‐  the  receiver  does  not  need  to  know  the  polarity  of  the  signal.  The  polarity  can  be  figured  from  the  line  transitions.  It  does  not  matter  whether  a  logical  1  or  0  is  received,  but  only  whether  the  polarity  is  the  same  or  is  different  from  the  previous  value.  

o 4B/5B  –  encode  a  4  bit  pattern  into  5  bits  so  you  can  get  rid  of  a  lot  of  zeros  in  a  row  then  apply  NRZI;  PRO:  Transitions;  CON:  80%  efficiency    

 • Framing  Protocols  –  group  bits  into  

messages  o Byte-­‐oriented:  give  the  size  of  the  frame  

(bytes)  put  the  number  of  bytes  in  the  header  then  read  that  many  bytes  (don’t  have  to  escape  characters);  Header  –  Payload  -­‐  Checksum  

o Bit-­‐oriented:  these  protocols  beginning  and  ending  bit  pattern  (if  this  pattern  occurs  somewhere  else  in  your  data  it  puts  a  zero  in  6th  1’s  spot);  good  because  its  flexible  in  that  you  can  send  variable  number  of  bits;  EX:  HDLC  01111110  where  the  111111  is  the  escape  pattern    

o Clock-­‐based:  use  the  clock,  every  frame  is  exactly  the  same  size  (fixed  size  frames);  good  because  its  easy  but  bad  if  you  are  sending  small  amounts  of  data  because  you  are  wasting  lots  of  data  room;  EX:  SONET  (9  rows  of  90  bytes)  

o Sentinels  (byte  boundary):  use  a  control  code  at  the  beginning  and  end  of  the  frame  (means  you  need  to  escape  the  control  code  “/”  for  example;  good  example  of  this  is  a  PPP  (Flag  –  Header  –  Payload  –  Checksum  –  Flag)  

• Error  Detection    ADD  WORKSHEET  o 2D  parity:  each  row  and  col  has  an  even  

number  of  face  up  and  face  down  cards  so  you  can  compare  like  Sudoku  to  find  the  exact  position;  1  bit  knows  exactly  what  bit  is  error;  2  bit  can  detect  but  4  possible  bits  for  2  errors;  3  or  4  bits  can  detect  some  and  not  others      

o Checksum:  IP  uses  that  for  each  packet;  PRO:  no  matter  how  long  the  message  is  you  are  always  sending  the  same  amount  of  data,  which  means  scalability,  is  great.    This  could  detect  one  flipped  bit  (cant  recover  it  like  you  can  in  2D)  but  you  would  know  an  error  occurred.    Cant  detect  an  aligned  set  of  bits  with  2  switches  because  sum  of  that  col  would  be  the  same.      

Formula  for  checksum:  1.  Add  up  the  words  transmitted  using  ones  complement  arithmetic.  2.  Use  the  sum  as  the  checksum  (represented  in  ones  complement)  Review  of  ones  complement  representation:  Positive  numbers:  represented  normal  in  binary  Negative  numbers:  each  bit  is  inverted  Examples  of  ones  complement:  7  =  00000111,  -­‐7  =  11111000  Assume  data  is  the  following:  00000010(2)  00000101(5)  00000011(3)  11111100(-­‐3)  Then,  when  we  add  the  numbers,  we  get:  00000010(2)  00000101(5)  =  00000111  (7)  +  00000011(3)=  00001010(10)  +  11111100   (-­‐3)  =  00000110  (plus  a  1  in  the  carry  bit,  so  this  is  added  to  the  LSB)+1  =  00000111(7)  So,  00000111  would  be  sent  as  the  checksum  for  the  data.  o CRC:  Pro:  Low  overhead  (only  going  to  add  

the  number  of  bits  in  C(x)  which  is  an  advantage  over  checksum,  its  more  unlikely  that  if  you  flip  a  couple  of  bits  you  will  still  get  a  correct  remainder  of  0.    CONS:  more  work  (for  both  sender  and  receiver)  not  a  lot  but  a  litter  and  there  is  no  error  recovery.    Internets  idea  is  to  know  if  something  went  wrong  but  we  don’t  really  care  to  fix  it  –  just  have  sender  resend  data  

Background:  Represent  message  M  by  a  polynomial  M(x)  If  M  =  10010101,  then  M(x)  =  x7  +  x4  +  x2  +  x0  Sender  calculates  P(x)  from  M(x)  that  is  exactly  divisible  by  C(x),  where  C(x)  is  an  established  agreed  upon  polynomial  with  degree  k.  Send  P(x).  Receiver  divides  P(x)  by  C(x).  If  remainder  is  not  0,  an  error  occurred.  M(x)  is  all  but  the  last  k  bits  and  is  used  as  the  message  To  calculate  P(x):  

Multiply  M(x)  by  xk  where  C(x)  has  degree  k.  Let  the  result  be  T(x).  Find  remainder  R(x)  of  T(x)  /  C(x);  P(x)  =  T(x)  –  R(x)    Example  of  finding  P(x):  M  =  10101101;  M(x)  =  x7  +  x5  +  x3  +  x2  +  x0;  C(x)  =  x3  +  x2  +  1;  Since  the  degree  of  C(x)  =  3,  we  multiply  M(x)  by  x3.  ;  T(x)  =  x10  +  x8  +  x7  +  x5  +  x3  Now,  find  remainder  R(x)  when  dividing  T(x)  by  C(x)  (division  is  done  with  subtraction  as  XOR):              11011011     R:  111  1101    10101101000      1101        1111        1101          0101          0000              1010            1101              1111              1101                0100                0000          1000          1101            1010            1101              111  P(x)  =  T(x)  –  R(x)    10101101000  -­‐              111  ___________  10101101111     (subtraction  done  via  XOR)    10101101111  is  sent  to  receiver  Receiver  calculates  message:  P(x)  /  C(x)  000  is  remainder  Thus,  the  data  is  “good”  and  the  message  is  10101101.  (remove  last  3  bits  from  what  was  sent)  11-­‐>0;  10  -­‐>1;  01-­‐>1;  00-­‐>1  Reliable  Transmission:  Data  can  get  lost  because  of  buffer  overflow  on  the  switches,  corrupted  bits,  internal  nodes  goes  down,  sender  node  fails  ARQ:  Automatic  Repeat  Request  (at  the  link  layer);  sender  sends  the  frame,  wait  for  ack,  no  ack  received  send  the  frame  again,  if  ack  arrives  send  next  frame:    If  ack  takes  too  long  (more  than  2  RTT)  it  might  get  sent  again;  we  just  toggle  b/t  frame  1  and  frame  0  because  with  ARQ  we  can  only  have  2  things  out  at  a  time;  PRO:  simple  and  it  gets  you  what  you  want  -­‐>  you  know  when  someone  gets  your  message;  CON:  sender  waits  a  lot  so  not  utilizing  the  bandwidth  which  makes  it  very  slow  Stop  &  Wait  Sliding  Window:    PRO:  not  nearly  as  much  wait  time,  utilizing  bandwidth;  CON:  more  complicated  to  code,  more  things  to  keep  track  of  more  things  to  process  HANDOUT  LANs  MAC  addresses  (hardware  addresses)  Aloha  –  early  version  of  using  a  shared  resource:  Hawaiian  islands  if  you  had  data  to  send,  you  sent  it  and  if  you  collided  then  you  picked  a  random  length  of  time  and  tried  to  send  it  again;  P  persistent  wait  a  random  amount  of  time  Ethernet  (802.3)  CSMA/CD  (Carrier  Sense  (a  node  can  detect  whether  a  line  is  idle  or  busy)  Multiple  Access  (shared  common  resources)  with  Collision  Detection  (node  listens  while  sending  and  can  detect  collisions))  Protocol  for  sending:  1.  Send  if  you  have  data  2.  If  link  is  busy  wait  and  then  send;  this  is  1  Persistent  or  it  sends  ASAP  and  if  there  is  a  collision  both  have  to  wait  Each  frame  has  a  min  size  so  they’re  are  long  enough  to  detect  collisions  (64  B)  and  a  max  size  so  the  frame  isn’t  too  big  because  then  we  allow  one  to  hog  and  increase  the  chance  of  a  waiting  queue  (1500  B)  Coax  can  be  500  m  away  and  a  twisted  pair/fiber  can  be  2500  m  away  but  we  can  make  this  bigger  by  adding  switches  Frame  Format:  Preamble  (8B,  alternating  0’s  and  1’s  to  sync  reception)  –  Dest  (6B)  –  Source  (6B)  –  Type  (2B  what  higher  level  protocols)  –  Data/Payload  –  CRC  (4B,  error  detection)  

Page 2: Exam 1 Crib Sheet, 1

Ethernet  everyone  hears  everything  so  everyone  hears  the  destination  address,  is  it  for  you?  Accept.    If  not  ignore  If  destination  is  6  1’s  then  it’s  a  broadcast  so  everyone  should  receive.    1  followed  by  5bit  group  ID  is  a  multicast,  if  you  are  a  member  of  the  group  you  should  listen.  Collisions:  use  exponential  back  off  (1st  collisions  wait  0  or  1  frame  times,  2nd  collision  wait  0,  1,    2,  or  3  frame  times)  cap  N  at  10  not  the  most  fair  but  works  relatively  well  in  lightly  loaded  networks.    Max  number  of  nodes  on  a  network  is  1024  but  today  more  common  that  every  node  is  connected  to  a  switch.  PRO:  easy  to  administer  (EASY  to  add  another  node)  CON:  Doesn’t  work  very  well  on  a  crowded  network    You  can  mitigate  collisions  by  limiting  the  number  of  nodes,  the  distance  so  RTT  delay  is  much  less  than  the  max).    Wireless  (Wi  Fi  802.11)  CSMA/CA  (Carrier  Sense  Multiple  Access  with  Collision  Avoidance)  PAN  (Bluetooth)  LAN  (WiFi)  and  WAN  (3G)  Signal  degrades  as  distance  increases.  Wireless  cant  hear  everyone  else  like  you  can  on  Ethernet  because  of  hidden  nodes  problem  so  instead  wireless  listens  and  sees  if  any  signals  are  being  propagated  within  our  area,  if  so  wait,  if  idle  you  reserve  the  medium  or  signal.    If  signals  collide  within  your  radius  you  still  do  the  exponential  back  off    Say  B  wants  to  send  to  C  and  A  wants  to  send  to  B.    Band  C  within  range  and  same  with  A  and  B  (each  circle  covers  3).    Events:    1.  B  sends  C  a  RTS  frame  with  duration  (reservation)  2.  A  hears  RTS  and  defers  3.  C  responds  to  B  with  a  clear  to  send  (CTS)  frame  4.  D  hears  CTS  and  defers  5.  B  can  send  data  to  C  6.  C  sends  acks  back  to  B  If  a  node  hears  a  RTS  and  not  a  CTS  then  it  can  send  because  not  sending  to  same  circle.    Access  points  send  out  beacon  frames  and  that’s  what  computers  hears  Connecting  to  AP:  1.  Node  sends  a  probe  frame  2.  AP  requires  with  a  probe  response  frame  3.  Node  selects  and  AP  send  Association  request  Frame  4.  AP  Associate  Response    Frame:    Control  (16B,  RTS,  STS,  if  AP’s  other  bits  for  management)  –  Duration  (16B,  length  based  on  sender  data  size  and  rate)  –  Addr1  –  Addr2  –  Addr3  (48B  each,  with  4  they  make  up  the  MAC  addresses)  –  Sequence  Control  (16B  frame  #)  –  Addr4  –  Payload  (0  –  18996  B)  –  CRC  (32B)  Bluetooth:    Uses  a  master-­‐slave  model  that  makes  it  very  simple.    Slaves  can  only  communicate  the  with  the  baser  and  you  can  have  up  to  7  slaves.    Time  is  broken  into  time  plots  if  time  slots  are  numbered  a  frame  could  take  up  1,  3,  or  5  slots.    Slaves  can  only  send  during  even  time  slots  and  master  odd.    Slaves  only  respond  too  the  master  and  Bluetooth  uses  frequency  hopping.  3G  has  3  options.    1)  TDMA:  Everyone  gets  a  time  slot,  bandwidth  and  thru  put  isn’t  good.  2)  FDMA:  combine  all  data  and  all  send  at  different  frequency  (like  TV)  bandwidth  again  isn’t  great  3)  CDMA:  We  all  talk  at  once  but  we  all  talk  in  a  different  language  and  the  cell  tower  can  speak  all  languages  so  everyone  gets  a  special  code  and  you  XOR  your  data  before  sending  (data  encryption)  and  all  signals  are  added  together  and  then  receiver  XOR  data  backwards  to  know  who  is  was  sent  from.    The  built  in  error  detection  scheme  is  a  real  benefit.    Just  ignores  everything  it  hasn’t  given  a  code  out  for  so  it  has  built  in  interference  security.      Switches  (Bridges)  and  Forwarding  –  helps  with  scalability  Datagram:  what  networks  use  today;  needs  a  buffer  because  it  takes  data  in  and  sends  it  out  on  the  correct  cable.    Also  gives  us  a  way  to  connect  data  from  one  LAN  to  another  and  switch  deals  with  knowing  where  to  forward  the  data  out  too  and  on  what  line.    We  label  the  ports  by  the  direct  link  they  are  connected  too.  Forwarding  tables  only  know  the  next  hop  and  every  switch  ahs  its  own  forwarding  table  

 Dest  (Port)  A  (X1)  B  (X1)  C  (C)  D  (D)  E  (X3)  F  (X3)  G  (X3)    CON:  limited  table  size/tables  too  large/tables  can  get  out  of  date,  don’t  know  anything  about  the  nodes  your  sending  data  too  PRO:  simple,  we  don’t  have  to  know  anything  but  a  table  lookup,  we  can  figure  out  it  packets  aren’t  getting  there  and  we  can  change  forwarding  table  route  thorough  a  new  intermediate  switch  Virtual  Circuit  Switching  More  complicated  for  the  switch.    Each  switch  has  a  table  with:  Incoming  Port,  VCI  in,  Outgoing  Port,  VCI  out.    Every  switch  knows  exactly  how  many  connections  are  going  through  it  all  the  time  because  =  the  number  of  table  entries  (so  we  know  the  load  at  all  times).    Table  has  more  entries  because  different  connections  could  be  sending  simultaneously.    The  outgoing  ID  is  the  VC  for  the  next  hop.  Sequence  of  Events  for  Sending:  When  A  wants  to  send  to  F:  1.   Put  the  ID  as  5  in  header  of  packets  destined  to  F  Then,  S1  gets  packet:  1.  Looks  up  values  5  and  A  in  table    2.  Removes  5  as  the  VC  ID  in  header  3.  Puts  8  as  the  VC  ID  in  header  4.  Forwards  packet  along  outgoing  port  X2.  How  do  VCIs  get  assigned?  Signal:  A  sends  a  startup  message  to  switch  1  with  destination  F.    Switch  1  forwards  message  to  switch  2  with  an  unused  VCI,  fill  in  incoming  and  outgoing  port  entries.    Switch  2  forwards  message  to  switch  3  with  an  unused  VCI,  fill  in  ports.    Switch  3  forwards  message  to  F.  F  chooses  a  VCI.    F  sends  ack  to  Switch  3  with  VCI,  so  switch  3  uses  it  for  its  outgoing  ID.  Switch  3  forwards  ack  with  the  VCI  it  used  in  table.….  Ack  gets  back  to  A  and  a  virtual  connection  is  created.  PRO:  telephone  industry  uses.  Know  load  and  more  reliable.    Faster  connections  established.    Cycles  are  allowed  (redundancy  resilience)  CON:    every  switch  still  needs  a  forwarding  table  and  you  have  to  set  up  and  tear  down  all  the  connections  (table  entries)    Source  Routing  Most  difficult  for  the  node.    Instead  of  switches  dong  lots  of  work  the  end  nodes  do  all  the  work.    Nodes  have  to  know  topology  of  entire  network.    If  A  sends  to  F:  In  header,  A  puts  the  sequence  F  –  X3  –  X2.    Then,  each  node  looks  at  last  address  for  forwarding  and  rotates  the  entry  order  (moves  last  to  first).  So,  then  X1  would  see  the  header,  rotate  it  to  X2  –  F  –  X3  and  send  it  to  X2.  PRO:  Easy  for  switches  CON:  nodes  have  to  have  a  mechanism  to  get  topology  info  Learning  sources  /  ports  LAN  connections  listen  all  the  time  to  everyone’s  data.    We  only  add  to  the  table  by  source,  don’t  care  about  the  destination.    Constantly  listening  to  know  all  source  information  and  each  entry  lives  in  our  table  for  a  fixed  amount  of  time.    Cycles  may  send  packets  around  indefinitely.    So  we  build  STs.    See  HW2.    o Spanning  Tree  Algorithm  (Perlman  paper)  If  a  bridge  fails  the  connected  bridges  stop  getting  config  messages  so  they  send  out  the  I’m  the  root  message  and  we  rebuild  the  ST.  

 

Idea  of  algorithm:  1.  Elect  root  node  (use  lowest  address)  2.  Grow  tree  as  shortest  distances  from  the  root  bridge.    Break  ties  with  lowest  address.    Bridges  send  config  messages  over  ports  for  which  they  are  the  best  path.    Turn  off  ports  that  are  not  on  best  paths  3.  LAN  uses  its  designated  bridge  (one  with  port  still  active)  and  the  designated  bridges  do  the  forwarding  across  LANs    Algorithm:  1.  Each  bridge  believes  it  is  the  root.    When  learn  not  the  root,  stop  sending  config  (hello)  messages.    Forward  root’s  config  message  with  #  hops  incremented  by  1.    Records  best  config  for  each  port    2.  When  not  a  designated  bridge,  stop  forwarding  config  messages    3.  Real  root  sends  config  messages  periodically    4.  If  bridge  does  not  receive  a  config  message  in  a  certain  period  of  time,  assume  topology  has  changed  and  start  sending  config  messages  claiming  to  be  the  root  Example:  Assume  no  bridge  has  any  info  about  any  other  bridge  in  network.  Let’s  look  at  B3:  1.  B3  sends  (B3,  0,  B3)  to  B5  and  B2  [claiming  to  be  root]  2.  B3  receives  (B2,  0,  B2)  and  (B5,  0,  B2)  from  B2  and  B5,  respectively.  Since  B2  is  <  B3,  B3  accepts  B2  as  root  3.  B3  sends  (B2,  1,  B3)  to  B5  to  forward  message  [note  that  the  #hops  is  incremented]  4.  B3  receives  (B1,  1,  B2)  from  B2  and  (B1,  1,  B5)  from  B5.  Since  B1  <  B2,  B3  accepts  B1  as  root.  5.  B3  could  send  (B1,  2,  B3)  to  B2  or  B5,  but  it  does  not  since  it  is  nowhere  the  “shortest  path”  from  B1.  So,  B3  is  not  a  designated  bridge.  6.  B3  receives  (B1,  1,  B2)  from  B2  and  (B1,  1,  B5)  from  B5  again,  so  network  is  stable.  B3  turns  off  data  forwarding  to  LANs  A  and  C.  HOMEWORK  1  2.  Calculate  the  total  time  required  to  transfer  a  1000  KB  file  in  the  following  cases.  You  may  assume  a  RTT  of  100  ms,  a  packet  size  with  1  KB  of  data,  and  an  initial  2  x  RTT  of  “handshaking”  before  data  is  sent.  a.  The  bandwidth  is  1.5  Mbps  and  data  packets  are  sent  continuously:    2  initial  RTT  +  transmit+  P  delay  +  Q  delay=  200  ms  +(1000KB/1.5Mbps)+50ms  and  middle  term  looks  like  (1000x2^10x8for  bits)/1.5x10^6  =  5.4613  seconds  and  back  to  ordinal  =  .20  seconds  +(.05+5.4613)  =  5.7113  seconds    b.  The  bandwidth  is  1.5  Mbps  but  after  sending  each  data  packet,  we  must  wait  one  RTT  before  sending  the  next:    We  have  100  packets  -­‐>  999  wait  times  so  same  as  part  a  +  wait  times  =  5.7113  +(.1)(999)  =  105.6113  seconds  c.  The  bandwidth  is  “infinite”  (transmit  time  is  0)  and  up  to  20  packets  can  be  sent  per  RTT:  100/20  =  50  total  but  49.5  RTTs;  Total  time  =  (2xRTT)  +  49.5  RTT  =  51.5  RTTs  =  51.5(.1)  =  5.15  seconds    3.  Suppose  a  100  Mbps  point-­‐to-­‐point  link  is  being  set  up  between  Earth  and  the  moon.  The  distance  between  the  Earth  and  the  moon  is  385,000  km  and  the  data  travels  at  the  speed  of  light  –  3  x  108  meters  per  second.  a.  Calculate  the  minimum  RTT  for  the  link:  RTT  =  2xP  =  2x  (385000Km/3x10^8  m/s)  =  2x(385000x10^3  m/3x10^8  m/s)  =  2.57  seconds  b.  Using  the  minimum  RTT  as  the  delay,  calculate  the  delay  x  bandwidth  product  for  this  link.  DxB  =  100  Mbps  X  (2.57seconds/2)  =  1.28x10^8  bits  c.  A  camera  on  the  moon  takes  pictures  of  the  Earth  and  saves  them  in  digital  form.  Assume  you  want  to  retrieve  a  25  MB  image  from  the  moon.  What  is  the  minimum  amount  of  time  that  elapses  between  the  initial  request  from  Earth  and  the  entire  image  is  transferred  back  to  Earth.  1  RTT  +  T  =  2.57  seconds  +  25  MB/100Mbps  =  2.57  +  25x2^20x8  =  4.57  seconds  4.  Calculate  the  latency  (from  first  bit  sent  to  last  bit  received)  for  the  following:  a.  A  10  Mbps  Ethernet  with  a  single  store-­‐and-­‐forward  switch  in  the  path  and  a  packet  size  of  5000  bits.  Assume  that  each  link  introduces  a  propagation  delay  of  10  us  and  that  the  switch  begins  retransmitting  immediately  after  it  has  finished  receiving  the  packet:    L  =  P+T+Q=  10  ms  +5Kb/10Mbps  =  .01  sec  +  (5x2^10b/10x10^6  b/s)  =  14.1  ms  per  link  =  28.2  ms  b.  Same  as  (a)  but  with  3  switches  along  the  path:  56.4  ms  5.  For  each  of  the  following  situations,  calculate  the  bandwidth  necessary  to  transmit  the  data  in  real  time  (assume  no  compression  is  done).  a.  Video  at  a  resolution  of  640  x  480  pixels,  3  bytes  per  pixel,  30  frames/second:  

640x480x3x30bytes/second  b.  Song  with  length  of  2  minutes  and  total  size  of  30  MB:    30MB/2  min  =  30x2^20/2  min  =  .26  Mbps    HOMEWORK  2  4.    Consider  n  ARQ  protocol  running  over  a  20-­‐km  point-­‐to-­‐point  fiber  link.    A.  Calculate  the  propagation  delay  for  this  link,  assuming  the  speed  of  light  is  2x  10^8  m/s  in  fiber:    Prop  Delay  =  (20x10^3  m/2x10^8  m/s)  =  .1ms  b.  Suggest  a  suitable  timeout  for  the  ARQ  protocol  to  use  for  this  link:    A  suitable  ARQ  protocol  timeout  would  be  2  RTTs  to  send  data  back  and  forth  and  forth  and  back  c.  why  might  it  still  be  possible  for  the  ARQ  protocol  to  time  out  and  retransmit  a  frame,  given  this  timeout  value?    It  might  not  work  if  the  node  has  to  process  lots  of  data  or  it  processes  data  slowly  in  general.5.  Remember  the  timeline  diagrams  for  the  sliding  window  algorithm  with  SWS  =  3  frames  and  timeout  interval…lines  right  and  left  6.    

 10.  Give  the  circuit  table  for  all  the  switches  after  each  of  the  following  connections.    Host  A  connects  to  host  C,  Host  D  connects  to  Host  G,  Host  E  connects  to  host  I,  Host  D  connects  to  Host  B,  Host  F  connects  to  Host  I,  Host  H  connects  to  host  A  Switch   In  Port   VCI  in   Outgoing   VCI  out  1   A   0   C   1  1   D   2   2   3  2   2   3   4   0  4   4   0   G   1  2   E   1   2   2  2   2   2   3   5  3   3   5   I   0  1   D   4   1   5  2   1   5   2   6  3   2   6   3   1  3   3   1   B   2  2   F   7   2   8  2   2   8   3   9  3   3   9   I   4  4   H   2   2   10  2   2   10   1   11  1   1   11   A   6  

 

     9.  Give  the  tables  after  A-­‐>  C,  C-­‐>A,  D  -­‐>  C  Switch   Host   Port  B1   A   A  B1   C   B2  B2   A   B1  B2   C   B3  B2   D   B4  B3   A   B2  B3   C   C  B3   D   B2  B4   A   B2  B4   E   B2  B4   D   D