Advertisement
pexea12

Chapter 5 - Link Layer

Jun 1st, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.48 KB | None | 0 0
  1. Link layer: Intro
  2. hosts and routers are nodes
  3. communication channels connect adjacent nodes along communication path: links
  4. wired links
  5. wireless links
  6. LANs
  7. packet: frame, encapsulate datagram
  8.  
  9. transfer datagram from 1 node to adjacent node over a links
  10.  
  11. datagram tranfer by different link protocol over different link
  12. each link protocol provide different service
  13.  
  14. Service:
  15. framing, link access
  16. encapsulate datagram into frame
  17. channel access if shared medium
  18. MAC address used in frame header to identify src, dst
  19. reliable delivery between adjacent nodes:
  20. flow control
  21. error detection
  22. error correction
  23. half-duplex and full-duplex
  24.  
  25. implement in adaptor (network interface card - NIC)
  26. attach into host system buses
  27. combination of hardware, software, firmware
  28.  
  29. sending side:
  30. encapsulate
  31. add error checking bit, rdt, flow control
  32. receiving side:
  33. look for errors, rdt, flow control
  34. extract datagram, pass to upper layer
  35.  
  36. Error detection:
  37. EDC: error detection correction bits (redundancy)
  38. not 100% reliable
  39. may miss some errors (rarely)
  40. larger EDC field -> better detection and correction
  41. parity checking:
  42. single bit parity
  43. 2-dimensional bit parity
  44.  
  45. internet checksum
  46. checksumming: cyclic redundancy check (CRC)
  47.  
  48. Multiple Access:
  49. point-to-point:
  50. PPP for dial-up access
  51. point-to-point link between Ethernet switch and host
  52. broadcast (shared wire or medium)
  53. old-fashioned Ethernet
  54. upstream HFC
  55. 802.11 wireless LAN
  56.  
  57. single shared broadcast channel
  58. 2 or more simultaneous transmissions by nodes: interference
  59. collision if node receives 2 or more signals at the same time
  60.  
  61. multiple access protocol
  62. determine how node share channel, when node can transmit
  63. communication about channel sharing must use channel itself
  64. no out-of-band channel for coordination
  65.  
  66. Ideal Multiple Access Protocol:
  67. broadcast channel of rate R bps
  68. when 1 node transmit, it send at rate R
  69. when M nodes transmit, send at average rate R/MAC
  70. full decentralized
  71. no special node to coordinate transmissions
  72. no sync of clock, slot
  73. simple
  74.  
  75. MAC protocol:
  76. channel partitioning
  77. divide into smaller pieces
  78. allocate piece to node for exclusive use
  79. random access
  80. channel not divided, allow collision
  81. recover from collision
  82. taking turn
  83. node take turn
  84. node with more to send can take longer turn
  85.  
  86. TDMA: time division multiple access
  87. access to channel in rounds
  88. each station get fixed length slot
  89. unused slots go idle
  90. FDMA: frequency division multiple access
  91. channel spectrum divide into frequency band
  92. each station assign fixed frequency band
  93. unused tramission time in frequency band go idle
  94.  
  95. Random Access Protocol:
  96. node have packet to send -> transmit full channel data rate R
  97. no coordination
  98. specify:
  99. how to detect collision
  100. how to recover from collision
  101. slotted ALOHA, ALOHA, CSMA, CSMA/CD, CSMA/CA
  102.  
  103. slotted ALOHA
  104. assume:
  105. frame same size
  106. time divided into equal size slots
  107. node transmit only slot beginning
  108. node are sync
  109. if 2 or more nodes transmit in slot, all detect collision
  110. operation:
  111. when node obtain fresh frame, transmit in next slot
  112. if no collision, send new frame in next slot
  113. if collision, retransmit frame in each subsequent slot with probability p until success
  114. pros:
  115. transmit at full rate of channel
  116. highly decentralized: slot in node need to be in sync
  117. simple
  118. cons:
  119. collision, wasting slot
  120. idle slot
  121. may detect collision in less than time to transmit packet
  122. clock sync
  123. max efficiency: 1/e = 0.37
  124. channel used for useful transimissions 37% of time
  125.  
  126. pure (unslotted) ALOHA:
  127. simple, no sync
  128. when frame arrive, transmit immediately
  129. collision probability increase
  130. max efficiency: 1/(2e) = 0.18
  131. -> worse than slotted ALOHA
  132.  
  133. CSMA (Carrier Sense Multiple Access)
  134. listen before transmit
  135. if channel sensed idle -> transmit entire frame
  136. if channel sensed busy -> defer transmissions
  137.  
  138. CSMA collision:
  139. can still occur:
  140. propagation delay -> may not hear other transmision
  141. collsion:
  142. entire packet transmission time wasted
  143.  
  144. CSMA/CD (CSMA / Collision Detection)
  145. carrier sensing, deferral as in CSMA
  146. collision detect in short time
  147. collide transmision aborted, reduce channel wastage
  148. collision detection:
  149. easy in wired LANs:
  150. measure signal strength
  151. compare transmitted
  152. receive signals
  153. difficult in wireless LANs:
  154. received signal strength
  155. overwhelm by local transmision strength
  156.  
  157. channel partitioning:
  158. channel share efficiently and fairly at high load
  159. inefficient at low load: delay in channel access, low bandwidth
  160. random access:
  161. efficient at low load
  162. high load: collision overhead
  163.  
  164. taking turn MAC protocols:
  165. polling:
  166. master node invite slave node to transmit in turn
  167. use with slave devices
  168. concern:
  169. polling overhead
  170. latency
  171. single point of failure (master)
  172. token passing:
  173. control token passed from 1 node to next sequentially
  174. token message
  175. concern:
  176. token overhead
  177. latency
  178. single point of failure (token)
  179. bluetooth, FDDI, IBM Token Ring
  180.  
  181. MAC Addr and ARP:
  182. MAC (LAN or physical or Ethernet) address
  183. get frame from 1 interface to another physically connected interface (same network)
  184. 48 bit (most LANs)
  185. burned in NIC ROM, sometimes software settable
  186.  
  187. allocation administered by IEEE
  188. manufacturer buys portion of MAC address space
  189. MAC flat addr -> portability
  190. can move LAN card from 1 LAN to another
  191. IP hierarchical addr not portable
  192. depend on IP subnet to which node is attached
  193.  
  194. ARP: Addr Resolution Protocol
  195. Each IP node on LAN has ARP table
  196. ARP table: IP/MAC addr mapping for some LAN nodes
  197. TTL (time to live): time after which addr mapping will be forgotten (typically 20 min)
  198.  
  199. A want to send to B, B's MAC addr not in A's ARP table
  200. A broadcast ARP query packet, contain B's IP addr
  201. dst MAC addr = FF-FF-FF-FF-FF-FF
  202. all machines on LAN receive ARP query
  203. B receive ARP packet, reply to A with B's MAC addr
  204. frame sent to A's MAC addr (unicast)
  205. A cache IP-to-MAC addr pair in ARP table until time out
  206. soft state: info time out unless refreshed
  207. ARP is plug-and-play
  208. node create their ARP table without intervention from net admin
  209.  
  210. send datagram from A to B via R (assume A know B IP addr)
  211. create IP datagram with src A, dest B
  212. A use ARP to get R MAC addr
  213. A create link-layer frame with R MAC addr as dst, frame contain A-to-B IP datagram
  214. A NIC send frame
  215. R NIC receive frame
  216. R remove IP datagram from Ethernet frame, see its destined to B
  217. R use ARP to get B MAC addr
  218. R create frame contain A-to-B IP datagram send to B
  219.  
  220. Ethernet
  221. dominant wired LAN technology
  222. cheap for NIC
  223. first widely used LAN technology
  224. simpler, cheaper than token LANs and ATM
  225. kept up with speed race: 10Mbps - 10Gbps
  226.  
  227. bus topology -> all node in same collision domain
  228. star topology
  229. active switch in center
  230. each run a seperate Ethernet protocol (no collide with other)
  231.  
  232. Frame Structure:
  233. sending adapter encapsulate IP datagram (or other network layer protocol packet) in Ethernet frame
  234.  
  235. preamble -> dest addr -> source addr -> type -> data -> CRC
  236.  
  237. Preamble
  238. 7 byte with pattern 10101010 fllowed by 1 onyte with pattern 10101011
  239. used to sync receiver, sender clock rates
  240. Addr: 6 bytes
  241. if match dst addr, or with broadcast addr, pass data in frame to network layer protocol
  242. otherwise, discard
  243. Type: indicate higher layer protocol (mostly IP, Novell IPX, AppleTalk)
  244. CRC: checked at receiver, if error detect, drop
  245.  
  246. connectionless: no handshaking between send and receive
  247. unreliable: receive does not send ACKs or NACKs to send
  248. can have gap (missing datagram)
  249. gap will be filled if app using TCP
  250. MAC protocol: unslotted CSMA/CD
  251.  
  252. Ethernet CSMA/CD
  253. 1. NIC receive datagram from network layer, create frame
  254. 2. if NIC sense channel idle, start frame tramission
  255. if busy, wait until idle, then transmit
  256. 3. if transmit entire frame without detect another transmision, done
  257. 4. if detect another transmision, abort and send jam signal
  258. 5. after aborting, enter exponential backoff
  259. after mth collision, NIC choose K at random from {0, 1, 2, ..., 2^m - 1}. NIC wait K.512 bit times, return to 2
  260.  
  261. Jam signal: make sure all other transmitter aware of collision (48 bit)
  262. Bit time: 1 microsec for 10Mbps Ethernet
  263. K = 1023, wait time is about 50 msec
  264. Exponential backoff:
  265. adapt retransmission attempt to estimated current load
  266. heavy load: random wait will be longer
  267.  
  268. better performance than ALOHA
  269. simple, cheap, decentralized
  270.  
  271. efficiency = 1 / (1 + 5(t_prop / t_trans))
  272. t_prop: max prop delay between 2 nodes in LAN
  273. t_trans: time to transmit max-size frame
  274. efficiency -> 1
  275. t_prop -> 0, t_trans -> infinitive
  276.  
  277. 802.3 Ethernet Standards:
  278. many different Ethernet standard
  279. common MAC protocol and frame format
  280. different speed
  281. different physical layer media: fiber, cable
  282. copper (twister pair) physical layer
  283. fiber physical layer
  284.  
  285. Manchester encoding:
  286. used in 10BaseT
  287. each bit has a transition
  288. allow clock in send and receive node to sync to each other
  289. no need for a centralized, clobal clock among node
  290. physical layer stuff
  291.  
  292. Hub:
  293. physical layer (dumb) repeater
  294. bit coming in one link, go out all other link at same rate
  295. all node connected to hub can collide with other
  296. no frame buffer
  297. no CSMA/CD at hub: host NICs detect collision
  298.  
  299. Switch:
  300. link layer device: smarter than hubs, take active role
  301. store and forward Ethernet frame
  302. examine incoming frame MAC addr
  303. selectively forward frame to 1-or-more outgoing links
  304. use CSMA/CD to access segment
  305. transparent
  306. host unaware of presence of switches
  307. plug and play, self-learning
  308. no need to be configure
  309.  
  310. allow multiple simultaneous transmission
  311. host have dedicated, direct connection to switch
  312. switch buffer packets
  313. Ethernet protocol use on each incoming link, no collision
  314. full-duplex
  315. switch simulatenously, without collision
  316.  
  317. each switch has a switch table (MAC addr of host, interface to reach host, time stamp)
  318.  
  319. switch learn which hosts can be reached through which interface
  320. when frame receive, switch learn location of sender, incoming LAN segment
  321. record sender/location pair in switch table
  322.  
  323. switch frame filtering/forwarding:
  324. when frame received:
  325. record link associated with send host
  326. index switch table use MAC dst addr
  327. if entry found for dest:
  328. if dst on segment from which frame arrived
  329. drop
  330. else forward the frame on interface indicated
  331. else flood (forward on all but the interface on which the frame arrived)
  332.  
  333. frame dst unknown: flood
  334. dst A location known: selective send
  335.  
  336. switch can be connected together
  337.  
  338. switch vs. router
  339. store-and-forward device
  340. router: network layer device
  341. switch: link layer device
  342. router maintain routing table, implement routing algorithm
  343. swithc maintain switch table, implement filtering, learning algorithm
  344.  
  345. VLAN: Virtual local area network
  346. switch support VLAN can be configured to define multiple virtual LANs over single physical LAN infrastructure
  347.  
  348. port-based VLAN: switch ports grouped (by switch managment software) so that single physical switch
  349. operate as multiple virtual switch
  350. traffic isolation
  351. dynamic membership
  352. forwarding between VLANs
  353. trunk port: carry frame between VLANs define over multiple physical switches:
  354. 802.1 can't be forward within VLAN between switch
  355. 802.1Q add/remove additional header for frame forward between trunk port
  356.  
  357. 802.1 frame:
  358. preamble -> dst addr -> src addr -> type -> data -> CRC
  359. 802.1Q frame:
  360. preamble -> dst addr -> src addr -> tag protocol identifier -> tag control info -> type -> data -> CRC
  361.  
  362. Point-to-point data link control
  363. 1 sender, 1 receiver, 1 link: easier than broadcast link
  364. no media access control
  365. no need for explicit MAC addr
  366. protocol:
  367. PPP (point-to-point protocol)
  368. HDLC (high level data link control)
  369.  
  370. PPP:
  371. packet framing: encapsulation of network layer datagram
  372. bit transparency
  373. error detection (no correction)
  374. connection liveness
  375. network layer addr negotiation
  376.  
  377. data frame:
  378. flag -> addr -> control -> protocol -> info ->> check
  379. data transparency requirement:
  380. data field must be allowed to include flag pattern 01111110
  381.  
  382. before exchange data:
  383. configure PPP link (max frame length, authentication)
  384. learn/configure network
  385.  
  386. Virtualization:
  387. Internetwork Architecture:
  388. 2 layers of address: internetwork and local network
  389. new layer (IP) make everything homogeneous at internetwork layer
  390. underlying locla network technology:
  391. cable, satellite, ATM, MPLS
  392. invisible at internetwork layer
  393.  
  394. ATM and MPLS:
  395. seperate network in their own right
  396. different service model, addressing, routing from Internet
  397. viewed by internet as logical link connecting IP router
  398.  
  399. ATM: Asynchronous Transfer Mode
  400. integrated, end-end transport of cary voice, video, data
  401. packet switching using virtual circuit
  402.  
  403. MPLS: Multiprotocol label switching
  404. speed up IP forwarding by using fixed length label (instead of IP addr) to do forwarding
  405. IP datagram still keep IP addr
  406. borrow idea from Virtual Circuit (VC)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement