Lecture 22 CPE 400 / 600 Computer Communication Networks University of Nevada – Reno Computer Science & Engineering Department Fall 2015 CPE 400 / 600 Computer Communication Networks Lecture 22 Prof. Shamik Sengupta Office SEM 204 ssengupta@unr.edu http://www.cse.unr.edu/~shamik/
Chapter 5 Link Layer Computer Networking: A Top Down Approach 6th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you see the animations; and can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) that you mention their source (after all, we’d like people to use our book!) If you post any slides on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright 1996-2012 J.F Kurose and K.W. Ross, All Rights Reserved Link Layer
The Data Link Layer Our goals: understand principles behind data link layer services: link layer addressing sharing a broadcast channel: multiple access reliable data transfer error detection, correction Understanding various link layer technologies Ethernet (wired domain) Hubs, Switches, Bridges Differences with Routers Wi-Fi (wireless domain)
Link Layer: Introduction Some terminology: hosts and routers are nodes communication channels that connect adjacent nodes along communication path are links wired links wireless links layer-2 packet is a frame, encapsulates datagram data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Link Layer Services framing, link access: encapsulate datagram into frame, adding header, trailer channel access if shared medium “MAC” addresses used in frame headers to identify source, dest different from IP address! reliable delivery between adjacent nodes Q: why both link-level and end-end reliability?
Link Layer Services (more) flow control: pacing between adjacent sending and receiving nodes error detection: errors caused by signal attenuation, noise. receiver detects presence of errors: signals sender for retransmission or drops frame error correction: receiver identifies and corrects bit error(s) without resorting to retransmission
Where is the link layer implemented? in each and every host link layer implemented in “adaptor” (aka network interface card NIC) Ethernet card, 802.11 card implements link, physical layer attaches into host’s system buses combination of hardware, software, firmware host schematic application transport network link physical cpu memory host bus (e.g., PCI) controller physical transmission network adapter card
MAC Addresses There are two types of addresses: 32-bit IP address: network-layer address used to get datagram to destination IP subnet MAC (or LAN or physical or Ethernet) address: function: get frame from one interface to another physically-connected interface (same network) 48 bit MAC address (for most LANs) burned in NIC ROM, also sometimes software settable
MAC Addresses MAC (or LAN or physical or Ethernet) address: 48 bit MAC address
MAC Addresses Each adapter on LAN has unique MAC address Locally administered 1A-2F-BB-76-09-AD Broadcast address = FF-FF-FF-FF-FF-FF LAN (wired or wireless) = adapter 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 Which ones are globally unique and which ones are locally administered? 0C-C4-11-6F-E3-98
ARP Link Layer
ARP: Address Resolution Protocol Question: how to determine MAC address of B knowing B’s IP address? Each IP node (host, router) on LAN has ARP table ARP table: IP/MAC address mappings for some LAN nodes < IP address; MAC address> Timeout: time after which address mapping will be forgotten (Varies from vendor to vendor, device to device) 137.196.7.78 1A-2F-BB-76-09-AD 137.196.7.23 137.196.7.14 LAN 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 137.196.7.88
ARP: Address Resolution Protocol Question: how to determine MAC address of B knowing B’s IP address? 137.196.7.78 1A-2F-BB-76-09-AD arp -a arp -s arp -d 137.196.7.23 137.196.7.14 LAN 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 137.196.7.88
ARP protocol: Same LAN (network) A wants to send datagram to B, and B’s MAC address not in A’s ARP table. A broadcasts ARP query packet, containing B's IP address dest MAC address = FF-FF-FF-FF-FF-FF all machines on LAN receive ARP query B receives ARP packet, replies to A with its (B's) MAC address frame sent to A’s MAC address (unicast) A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state: information that times out (goes away) unless refreshed ARP is “plug-and-play”: nodes create their ARP tables without intervention from net administrator
Addressing: routing to another LAN Proxy-ARP: walkthrough: send datagram from A to B via R assume A knows B’s IP address two ARP tables in router R, one for each IP network (LAN) R 1A-23-F9-CD-06-9B 222.222.222.220 111.111.111.110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D 111.111.111.112 111.111.111.111 A 74-29-9C-E8-FF-55 222.222.222.221 88-B2-2F-54-1A-0F B 222.222.222.222 49-BD-D2-C7-56-2A
Addressing: routing to another LAN A creates IP datagram with IP source A, destination B A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram MAC src: 74-29-9C-E8-FF-55 MAC dest: E6-E9-00-17-BB-4B IP Eth Phy IP src: 111.111.111.111 IP dest: 222.222.222.222 R 1A-23-F9-CD-06-9B 222.222.222.220 111.111.111.110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D 111.111.111.112 111.111.111.111 74-29-9C-E8-FF-55 A 222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.221 88-B2-2F-54-1A-0F B Link Layer
Addressing: routing to another LAN frame sent from A to R frame received at R, datagram removed, passed up to IP MAC src: 74-29-9C-E8-FF-55 MAC dest: E6-E9-00-17-BB-4B IP src: 111.111.111.111 IP dest: 222.222.222.222 IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy IP Eth Phy R 1A-23-F9-CD-06-9B 222.222.222.220 111.111.111.110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D 111.111.111.112 111.111.111.111 74-29-9C-E8-FF-55 A 222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.221 88-B2-2F-54-1A-0F B Link Layer
Addressing: routing to another LAN R forwards datagram with IP source A, destination B R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP Eth Phy IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy R 1A-23-F9-CD-06-9B 222.222.222.220 111.111.111.110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D 111.111.111.112 111.111.111.111 74-29-9C-E8-FF-55 A 222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.221 88-B2-2F-54-1A-0F B Link Layer
Addressing: routing to another LAN R forwards datagram with IP source A, destination B R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram IP src: 111.111.111.111 IP dest: 222.222.222.222 MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP Eth Phy IP Eth Phy R 1A-23-F9-CD-06-9B 222.222.222.220 111.111.111.110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D 111.111.111.112 111.111.111.111 74-29-9C-E8-FF-55 A 222.222.222.222 49-BD-D2-C7-56-2A 222.222.222.221 88-B2-2F-54-1A-0F B Link Layer
Addressing: routing to another LAN R forwards datagram with IP source A, destination B R creates link-layer frame with B's MAC address as dest, frame contains A-to-B IP datagram MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111 IP dest: 222.222.222.222 IP Eth Phy B A R 111.111.111.111 222.222.222.222 49-BD-D2-C7-56-2A 74-29-9C-E8-FF-55 222.222.222.220 1A-23-F9-CD-06-9B 111.111.111.110 E6-E9-00-17-BB-4B 111.111.111.112 222.222.222.221 CC-49-DE-D0-AB-7D 88-B2-2F-54-1A-0F Link Layer
Understanding the competition for medium (channel) access Protocols for Medium Access Control (MAC)
Multiple Access Links and Protocols Two types of “links”: broadcast (shared wire or medium) Ethernet 802.11 wireless LAN point-to-point point-to-point link between switches/Bridges and hosts humans at a cocktail party (shared air, acoustical) shared wire (e.g., cabled Ethernet) shared RF (e.g., 802.11 WiFi) shared RF (satellite)
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes: interference collision if node receives two or more signals at the same time multiple access protocol distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit communication about channel sharing must use channel itself! no out-of-band channel for coordination
Ideal Multiple Access Protocol What are the multiple access protocols?
Channel Partitioning MAC protocols: TDMA TDMA: time division multiple access access to channel in "rounds" each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle 6-slot frame 1 3 4 1 3 4
Channel Partitioning MAC protocols: FDMA FDMA: frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle time frequency bands FDM cable
“Taking Turns” MAC protocols Polling: master node “invites” slave nodes to transmit in turn typically used with “dumb” slave devices concerns: polling overhead latency single point of failure (master) data poll master data slaves
“Taking Turns” MAC protocols Token ring: control token passed from one node to next sequentially. token message concerns: token overhead latency single point of failure (token) T (nothing to send) T data
Concerns with Ideal protocols Conservative Too much overhead wasted Not flexible, dynamic If one user has nothing to send that “slot” is wasted Internet is all about dynamic…why not make MAC protocol dynamic in nature?
MAC: Random Access Protocols When node has packet to send transmit at full channel data rate R. no a priori coordination among nodes two or more transmitting nodes ➜ “collision”, random access MAC protocol specifies: how to detect collisions how to recover from collisions (e.g., via delayed retransmissions) Examples of random access MAC protocols: Ethernet (IEEE 802.3) Wi-Fi (IEEE 802.11) Based on the principle of reducing collisions!
CSMA (Carrier Sense Multiple Access) CSMA: listen before transmit: If channel sensed idle: transmit entire frame If channel sensed busy, defer transmission human analogy: don’t interrupt others!
CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, collision detection collisions detected within short time colliding transmissions aborted, reducing channel wastage collision detection: easy in wired LANs: measure signal strengths, compare transmitted, received signals difficult in wireless LANs: received signal strength overwhelmed by local transmission strength human analogy: the polite conversationalist
Ethernet
Ethernet “dominant” wired LAN technology: cheap $20 for NIC first widely used LAN technology simpler, cheaper kept up with speed race: 10 Mbps – 10 Gbps Metcalfe’s Ethernet sketch
Ethernet: physical topology bus: popular through mid 90s all nodes in same collision domain can collide with each other star: prevails today active switch in center each “spoke” runs a (separate) Ethernet protocol nodes do not collide with each other switch star bus: coaxial cable Link Layer
Ethernet frame structure sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame preamble: 7 bytes with pattern 10101010 followed by one byte with pattern 10101011 dest. address source data (payload) CRC preamble type Link Layer
Ethernet frame structure (more) addresses: 6 byte source, destination MAC addresses if adapter receives frame with matching destination address, or with broadcast address (e.g. ARP packet), it passes data in frame to network layer protocol otherwise, adapter discards frame type: indicates higher layer protocol IPV4, IPV6, ARP etc. CRC: cyclic redundancy check at receiver error detected: frame is dropped dest. address source data (payload) CRC preamble type Link Layer
Lecture 23 CPE 400 / 600 Computer Communication Networks University of Nevada – Reno Computer Science & Engineering Department Fall 2015 CPE 400 / 600 Computer Communication Networks Lecture 23 Prof. Shamik Sengupta Office SEM 204 ssengupta@unr.edu http://www.cse.unr.edu/~shamik/
Ethernet: Unreliable, connectionless connectionless: No handshaking between sending and receiving NICs unreliable: receiving NIC doesn’t send acks or nacks to sending NIC stream of datagrams passed to network layer can have gaps (missing datagrams) gaps will be filled if app is using TCP otherwise, app will see gaps Ethernet’s MAC protocol: unslotted CSMA/CD
Ethernet CSMA/CD algorithm 1. NIC receives datagram from network layer, creates frame 2. If NIC senses channel idle, starts frame transmission. If NIC senses channel busy, waits until channel idle, then transmits 3. If NIC transmits entire frame without detecting another transmission, NIC is done with frame ! 4. If NIC detects another transmission while transmitting, aborts, send a jam signal and prepare for retransmission 5. After collision, NIC enters exponential backoff: after mth collision, NIC chooses K at random from {0,1,2,…,2m-1}. NIC waits K slot times, returns to Step 2 (1 slot = 512 bit times)
Ethernet’s CSMA/CD (more) Jam Signal: make sure all other transmitters are aware of collision; 48 bits Bit time: .1 microsec for 10 Mbps Exponential Backoff: Goal: adapt retransmission attempts to estimated current load heavy load: random wait will be longer first collision: choose K from {0,1}; delay is K· 512 bit transmission times after second collision: choose K from {0,1,2,3}… after ten collisions, choose K from {0,1,2,3,4,…,1023}
Overview of physical devices in the LAN Hubs Switches Bridges
Hubs … physical-layer (“dumb”) repeaters: bits coming in one link go out all other links at same rate all nodes connected to hub can collide with one another no frame buffering no CSMA/CD at hub: host NICs detect collisions twisted pair hub
Switch link-layer device: transparent plug-and-play, self-learning smarter than hubs, take active role store, forward Ethernet frames examine incoming frame’s MAC address, selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment, uses CSMA/CD to access segment transparent hosts are unaware of presence of switches plug-and-play, self-learning switches typically do not need to be configured
Switch: allows multiple simultaneous transmissions hosts have dedicated, direct connection to switch switches buffer packets Ethernet protocol used on each incoming link, but no collisions each link is its own collision domain Full duplex switching: A-to-A’ and B-to-B’ simultaneously, without collisions not possible with “dumb” hub C’ B 1 2 6 3 4 5 C B’ A’ switch with six interfaces (1,2,3,4,5,6)
Switch Table A Q: how does switch know that A’ reachable via interface 4, B’ reachable via interface 5? A: each switch maintains a switch table each entry in the table holds: MAC address of host interface to reach host time stamp C’ B 1 2 6 3 4 5 C B’ A’
Switch: self-learning Source: A Dest: A’ A A A’ Q: how are entries created, maintained in switch table? switch learns which hosts can be reached through which interfaces when frame received, switch “learns” location of sender: incoming LAN segment records sender/location pair in switch table C’ B 1 2 6 3 4 5 C B’ A’ MAC addr interface TTL A 1 60 Switch table (initially empty)
Self-learning, forwarding: example Source: A Dest: A’ A A A’ frame destination unknown: C’ B flood 1 2 3 A A’ A A’ A A’ A A’ A A’ 6 4 5 destination A location known: C A’ A selective send B’ A’ MAC addr interface TTL A 1 60 Switch table (initially empty) A’ 4 60
Interconnecting switches switches can be connected together D E F S2 S4 S3 H I G S1 A B C Q: sending from A to G - how does S1 know to forward frame destined to G via S4 and S3? A: self learning! (works exactly the same as in single-switch case!)
Institutional network mail server to external network web server router Link Layer
Switches vs. routers both are store-and-forward: application transport network link physical datagram both are store-and-forward: routers: network-layer devices examine network-layer headers switches: link-layer devices examine link-layer headers both have forwarding tables: routers: compute tables using routing algorithms, IP addresses switches: learn forwarding table using flooding, learning, MAC addresses frame link physical frame switch network link physical datagram frame application transport network link physical Link Layer
Introduction to Bridges Many times it is necessary to connect a local area network to another local area network The LANs might be of different types E.g., Ethernet LAN, token ring LAN etc. Switches are not sufficient then! Local area network to local area network connections are often performed with a bridge
A bridge interconnecting two dissimilar LANs
Bridges A bridge can be used to connect two different LANs, such as a CSMA/CD LAN and a token ring LAN A bridge can also be used to connect two similar LANs, such as two CSMA/CD LANs Just like switch functionality
Bridges (2) Just like switch, a bridge does not need programming but observes all traffic and builds routing tables from this observation This observation is called backward learning. Each bridge has two connections (ports) and there is a routing table associated with each port. A bridge observes each frame that arrives at a port, extracts the source address from the frame, and places that address in the port’s routing table.
Bridges (3) More importantly, A bridge can also convert one frame format to another The bridge removes the headers and trailers from one frame format and inserts (encapsulates) the headers and trailers for the second frame format
Data Communications and Computer Networks Chapter 8 Encapsulation
Lecture 24 CPE 400 / 600 Computer Communication Networks University of Nevada – Reno Computer Science & Engineering Department Fall 2015 CPE 400 / 600 Computer Communication Networks Lecture 24 Prof. Shamik Sengupta Office SEM 204 ssengupta@unr.edu http://www.cse.unr.edu/~shamik/
VLANS Link Layer
VLANs: motivation consider: CS user moves office to EE, but wants connect to CS switch? single broadcast domain: all layer-2 broadcast traffic must cross entire LAN ARP, DHCP, unknown location of destination MAC address security/privacy, efficiency issues Computer Science Computer Engineering Electrical Engineering Link Layer
VLANs port-based VLAN: switch ports grouped (by switch management software) so that single physical switch Virtual Local Area Network 1 8 9 16 10 2 7 … Electrical Engineering (VLAN ports 1-8) Computer Science (VLAN ports 9-15) 15 switch(es) supporting VLAN capabilities can be configured to define multiple virtual LANS over a single physical LAN infrastructure Electrical Engineering (VLAN ports 1-8) … 1 8 2 7 9 16 10 15 Computer Science (VLAN ports 9-16) … operates as multiple virtual switches Link Layer
Electrical Engineering Port-based VLAN traffic isolation: frames to/from ports 1-8 can only reach ports 1-8 can also define VLAN based on MAC addresses of endpoints, rather than switch port router forwarding between VLANS: done via routing (just as with separate switches) in practice vendors sell combined switches plus routers 1 7 9 15 dynamic membership: ports can be dynamically assigned among VLANs 2 8 10 16 … … Electrical Engineering (VLAN ports 1-8) Computer Science (VLAN ports 9-15) Link Layer
VLAN-aware switches Commercial 8-port VLAN-aware switches ($30-$60) Link Layer
VLANS spanning multiple switches 1 7 9 15 16 1 3 5 7 2 8 10 2 4 6 8 … … Electrical Engineering (VLAN ports 1-8) Computer Science (VLAN ports 9-15) Ports 2,3,5 belong to EE VLAN Ports 4,6,7,8 belong to CS VLAN trunk port: carries frames between VLANS defined over multiple physical switches frames forwarded within VLAN between switches can’t be ordinary 802.1 frames (must carry VLAN ID info) 802.1q protocol adds/removed additional header fields for frames forwarded between trunk ports Link Layer
802.1Q VLAN frame format 802.1 frame 802.1Q frame type dest. address source address preamble data (payload) CRC 802.1 frame type dest. address source preamble 802.1Q frame data (payload) CRC 2-byte Tag Protocol Identifier (value: 0x8100) Recomputed CRC Tag Control Information (3 bit priority field like IP TOS, 1 bit drop eligible indicator, 12 bit VLAN ID field) Link Layer
Link layer in wireless Link Layer
link access in wireless domain # wireless (mobile) phone subscribers now exceeds # wired phone subscribers! computer networks: laptops, palmtops, PDAs, Smart Phones promise anytime wireless Internet access! It has really been a wireless revolution decade…with more to come Wireless is no longer a luxury but a necessity
WLAN Market: WiFi WLAN growing exponentially Source: Pyramid Research Source: AirTight Networks
IEEE 802.11 Wireless LAN 802.11a 802.11b 802.11n: multiple antennae 5 GHz range up to 54 Mbps 802.11n: multiple antennae 2.4 / 5 GHz range up to 200 Mbps 802.11b 2.4 GHz unlicensed spectrum up to 11 Mbps 802.11g 2.4 GHz range up to 54 Mbps What else? 802.11 ac – builds on 802.n – provides 80-160MHz channels 802.11ad – 60GHz mmwave spectrum 802.11af – Super Wi-Fi all use CSMA/CA for multiple access all have infrastructure and ad-hoc network versions
802.11 LAN architecture wireless host communicates with base station Internet wireless host communicates with base station base station = access point (AP) Basic Service Set (BSS) (aka “cell”) in infrastructure mode contains: wireless hosts access point (AP): base station ad hoc mode: hosts only AP hub, switch or router AP BSS 1 BSS 2
Basic Service Set (BSS) A04 IEEE 802.11 Architecture Basic Service Set (BSS) BSS Version 01-01
Extended Service Set (ESS) BSS’s with wired Distribution System (DS) A04 IEEE 802.11 Architecture Extended Service Set (ESS) BSS’s with wired Distribution System (DS) BSS Distribution System BSS Version 01-01
802.11: Channels, association 802.11b: 2.4GHz-2.485GHz spectrum divided into 13 channels at different frequencies AP admin chooses frequency for AP interference possible: channel can be same as that chosen by neighboring AP! host: must associate with an AP scans channels, listening for beacon frames containing AP’s name (SSID) and MAC address selects AP to associate with will typically run DHCP to get IP address in AP’s subnet
IEEE 802.11: multiple access problem 802.11: CSMA - sense before transmitting don’t collide with ongoing transmission by other node Certain differences from Ethernet LAN in wired domain 802.11: no collision detection! difficult to receive (sense collisions) when transmitting due to weak received signals (fading) Signal strength falls off rapidly with distance Signal strength may weaken due to obstacles Medium “air” shared among many users (not just WiFi users) can’t detect all collisions in any case: hidden terminal problem
“Open” Wireless Medium Wireless interference Hidden terminal Goal: CSMA/C(ollision)A(voidance) S1 R1 S2 R1 S1 R1 S2
How does the medium access work in WLAN? Contention Based Contention Free Access methods DCF CSMA/CA (mandatory) collision avoidance via exponential backoff Minimum distance (IFS) between consecutive packets ACK packet for acknowledgements (not for broadcasts) DCF with RTS/CTS (optional) Distributed Foundation Wireless MAC avoids hidden terminal problem PCF (optional) access point polls terminals according to a list Distributed Coordination Function (DCF) Point Coordination Function (PCF)
802.11 – MAC DIFS = SIFS + (2 * Slot time) Priorities defined through different inter frame spaces SIFS (Short Inter Frame Spacing) highest priority, for ACK, CTS, polling response PIFS (PCF IFS) medium priority, for time-bounded service using PCF DIFS (DCF, Distributed Coordination Function IFS) lowest priority, for asynchronous data service, competing stations DIFS DIFS PIFS SIFS medium busy contention next frame t access if medium is free DIFS
Lecture 25 CPE 400 / 600 Computer Communication Networks University of Nevada – Reno Computer Science & Engineering Department Fall 2015 CPE 400 / 600 Computer Communication Networks Lecture 25 Prof. Shamik Sengupta Office SEM 204 ssengupta@unr.edu http://www.cse.unr.edu/~shamik/
WLAN access scheme details Sending unicast packets station has to wait for DIFS before sending data receivers acknowledge at once (after waiting for SIFS) if the packet was received correctly automatic retransmission of data packets in case of transmission errors DIFS data sender SIFS ACK receiver DIFS data other stations t waiting time contention
Contention for channel When the other stations find the channel idle, they would like to transmit their own packets Contention for channel If all the waiting stations attempt at once, this will surely result in collision Some CA scheme is necessary Backoff intervals can be used to reduce collision probability DIFS data sender SIFS ACK receiver DIFS data other stations t waiting time contention
Backoff Interval When transmitting a packet, choose a backoff interval in the range [0,cw] cw is contention window Count down the backoff interval when medium is idle Count-down is suspended if medium becomes busy When backoff interval reaches 0, transmit packet B1 = 25 B2 = 20 B1 = 5 B2 = 15 data wait data wait B2 = 10 B1 and B2 are backoff intervals at nodes 1 and 2 Assume cw = 31
Backoff Interval The time spent counting down backoff intervals is a part of MAC overhead Choosing a large cw leads to large backoff intervals and can result in larger overhead Choosing a small cw leads to a larger number of collisions (when two nodes count down to 0 simultaneously) Since the number of nodes attempting to transmit simultaneously may change with time, some mechanism to manage contention is needed IEEE 802.11 DCF: contention window cw is chosen dynamically depending on collision occurrence Follows Binary exponential backoff algorithm
Binary Exponential Backoff (BEB) in DCF Even before the first collision, nodes follow BEB Initial backoff interval (before 1st collision) [0,7] If still packets collide, double the collision interval [0,15], [0,31] and so on…
Avoiding collisions (more) idea: allow sender to “reserve” channel rather than random access of data frames: avoid collisions of long data frames sender first transmits small request-to-send (RTS) packets to BS using CSMA RTSs may still collide with each other (but they’re short) BS broadcasts clear-to-send CTS in response to RTS CTS heard by all nodes sender transmits data frame other stations defer transmissions avoid data frame collisions completely using small reservation packets!
Collision Avoidance: RTS-CTS exchange B AP RTS(A) RTS(B) reservation collision RTS(A) CTS(A) DATA (A) ACK(A) defer time
Numerical Problems Practice Wi-Fi Hidden Node Problem Wi-Fi with RTS/CTS
802.11 frame: addressing Address 4: used only in ad hoc mode control duration address 1 2 4 3 payload CRC 6 0 - 2312 seq Address 4: used only in ad hoc mode Address 1: MAC address of wireless host or AP to receive this frame Address 3: MAC address (dependent on frame control field) Address 2: MAC address of wireless host or AP transmitting this frame Wireless, Mobile Networks
802.11 frame: addressing Internet router H1 R1 R1 MAC addr H1 MAC addr AP MAC addr H1 MAC addr R1 MAC addr address 1 address 2 address 3 802.11 frame H1 R1 R1 MAC addr H1 MAC addr dest. address source address 802.3 frame Wireless, Mobile Networks
802.11 frame: more frame seq # (for RDT) duration of reserved transmission time (RTS/CTS) frame control duration address 1 2 4 3 payload CRC 6 0 - 2312 seq Type From AP Subtype To More frag WEP data Power mgt Retry Rsvd Protocol version 2 4 1 frame type (RTS, CTS, ACK, data) Wireless, Mobile Networks
Frame Control field Protocol Version: Type= frame type: ToDS: FromDS: zero for 802.11 standard Type= frame type: data, management, control Subtype = frame sub-type ToDS: when bit is set indicate that destination frame is for DS FromDS: When bit is set indicate frame coming from DS Data Link Layer
Frame Control field Retry: More fragments: Power Management More Data: Set in case of retransmission frame More fragments: Set when frame is followed by other fragment Power Management bit set when station go Power Save mode (PS) More Data: When set means that AP have more buffered data for a station in Power Save mode Data Link Layer
Address Field Description A04 IEEE 802.11 Architecture Address Field Description Protocol Version Type SubType To DS Retry Pwr Mgt More Data WEP Rsvd Frame Control Field Bits: 2 2 4 1 From Frag To DS From DS Address 1 DA BSSID RA Address 2 SA TA Address 3 Address 4 N/A Addr. 1 = All stations filter on this address. Addr. 2 = Transmitter Address (TA), Identifies transmitter to address the ACK frame to. Addr. 3 = Dependent on To and From DS bits. Addr. 4 = Only needed to identify the original source of WDS (Wireless Distribution System) frames Version 01-01
Type field descriptions A04 IEEE 802.11 Architecture Type field descriptions Protocol Version Type SubType To DS Retry Pwr Mgt More Data WEP Rsvd Frame Control Field Bits: 2 2 4 1 From Frag Type and subtype identify the function of the frame: Type=00 Management Frame Beacon (Re)Association Probe Type=01 Control Frame RTS/CTS ACK Type=10 Data Frame Version 01-01
Type and subtypes Data Link Layer
Type and subtypes Data Link Layer
Type and subtypes Data Link Layer
RTS/CTS frames Data Link Layer
Lecture 26 CPE 400 / 600 Computer Communication Networks University of Nevada – Reno Computer Science & Engineering Department Fall 2015 CPE 400 / 600 Computer Communication Networks Lecture 26 Prof. Shamik Sengupta Office SEM 204 ssengupta@unr.edu http://www.cse.unr.edu/~shamik/
Chapter 6 Wireless and Mobile Networks Computer Networking: A Top Down Approach 6th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you see the animations; and can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) that you mention their source (after all, we’d like people to use our book!) If you post any slides on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright 1996-2012 J.F Kurose and K.W. Ross, All Rights Reserved Wireless, Mobile Networks
Components of cellular network architecture connects cells to wired tel. net. manages call setup (more later!) handles mobility (more later!) MSC covers geographical region base station (BS) analogous to 802.11 AP mobile users attach to network through BS air-interface: physical and link layer protocol between mobile and BS cell Mobile Switching Center Public telephone network wired network Wireless, Mobile Networks
2G (voice) network architecture Base station system (BSS) MSC BTS G BSC Public telephone network Gateway MSC Legend Base transceiver station (BTS) Base station controller (BSC) Mobile Switching Center (MSC) Mobile subscribers Wireless, Mobile Networks
3G (voice+data) network architecture MSC G Public telephone network radio network controller Gateway MSC G Public Internet SGSN Key insight: new cellular data network operates in parallel (except at edge) with existing cellular voice network voice network unchanged in core data network operates in parallel GGSN Serving GPRS Support Node (SGSN) Gateway GPRS Support Node (GGSN) Wireless, Mobile Networks
3G (voice+data) network architecture MSC G Public telephone network radio network controller Gateway MSC G Public Internet SGSN GGSN radio interface (WCDMA, HSPA) radio access network Universal Terrestrial Radio Access Network (UTRAN) core network General Packet Radio Service (GPRS) Core Network public Internet Wireless, Mobile Networks
What is mobility? spectrum of mobility, from the network perspective: no mobility high mobility mobile wireless user, using same access point mobile user, connecting/ disconnecting from network using DHCP. mobile user, passing through multiple access point while maintaining ongoing connections (like cell phone) Wireless, Mobile Networks
Mobility: vocabulary home network: permanent “home” of mobile (e.g., 128.119.40/24) home agent: entity that will perform mobility functions on behalf of mobile, when mobile is remote wide area network permanent address: address in home network, can always be used to reach mobile e.g., 128.119.40.186 Wireless, Mobile Networks
Mobility: more vocabulary visited network: network in which mobile currently resides (e.g., 79.129.13/24) permanent address: remains constant (e.g., 128.119.40.186) care-of-address: address in visited network. (e.g., 79,129.13.2) wide area network foreign agent: entity in visited network that performs mobility functions on behalf of mobile. correspondent: wants to communicate with mobile Wireless, Mobile Networks
How do you contact a mobile friend: Consider friend frequently changing addresses, how do you find her? I wonder where Alice moved to? search all phone books? call her parents? expect her to let you know where he/she is? Wireless, Mobile Networks
Mobility: approaches routing tables indicate where each mobile located let routing handle it: routers advertise permanent address of mobile-nodes-in-residence via usual routing table exchange. routing tables indicate where each mobile located no changes to end-systems let end-systems handle it: indirect routing: communication from correspondent to mobile goes through home agent, then forwarded to remote direct routing: correspondent gets foreign address of mobile, sends directly to mobile Wireless, Mobile Networks
Mobility: approaches routing tables indicate where each mobile located let routing handle it: routers advertise permanent address of mobile-nodes-in-residence via usual routing table exchange. routing tables indicate where each mobile located no changes to end-systems let end-systems handle it: indirect routing: communication from correspondent to mobile goes through home agent, then forwarded to remote direct routing: correspondent gets foreign address of mobile, sends directly to mobile not scalable to millions of mobiles Wireless, Mobile Networks
Mobility: registration visited network home network 1 mobile contacts foreign agent on entering visited network 2 foreign agent contacts home agent home: “this mobile is resident in my network” wide area network end result: foreign agent knows about mobile home agent knows location of mobile Wireless, Mobile Networks
Mobility via indirect routing foreign agent receives packets, forwards to mobile home agent intercepts packets, forwards to foreign agent visited network home network 3 4 1 2 wide area network correspondent addresses packets using home address of mobile mobile replies directly to correspondent Wireless, Mobile Networks
Indirect Routing: comments mobile uses two addresses: permanent address: used by correspondent (hence mobile location is transparent to correspondent) care-of-address: used by home agent to forward datagrams to mobile foreign agent functions may be done by mobile itself triangle routing: correspondent-home-network-mobile inefficient when correspondent, mobile are in same network Wireless, Mobile Networks
Indirect routing: moving between networks suppose mobile user moves to another network registers with new foreign agent new foreign agent registers with home agent home agent update care-of-address for mobile packets continue to be forwarded to mobile (but with new care-of-address) mobility, changing foreign networks transparent: on going connections can be maintained! Wireless, Mobile Networks
Mobility via direct routing foreign agent receives packets, forwards to mobile correspondent forwards to foreign agent 1 2 3 4 visited network home network mobile replies directly to correspondent correspondent requests, receives foreign address of mobile Wireless, Mobile Networks
Mobility via direct routing: comments overcome triangle routing problem non-transparent to correspondent: correspondent must get care-of-address from home agent what if mobile changes visited network? 1 2 3 4 Wireless, Mobile Networks
Accommodating mobility with direct routing anchor foreign agent: FA in first visited network data always routed first to anchor FA when mobile moves: new FA arranges to have data forwarded from old FA (chaining) foreign net visited at session start anchor foreign agent wide area network 2 1 4 3 5 new foreign network correspondent agent new foreign agent correspondent Wireless, Mobile Networks
Mobile IP: indirect routing dest: 128.119.40.186 foreign-agent-to-mobile packet dest: 79.129.13.2 dest: 128.119.40.186 packet sent by home agent to foreign agent: a packet within a packet Permanent address: 128.119.40.186 Care-of address: 79.129.13.2 dest: 128.119.40.186 packet sent by correspondent Wireless, Mobile Networks
Mobile IP: agent discovery agent advertisement: foreign/home agents advertise service by broadcasting ICMP messages (typefield = 9) H,F bits: home and/or foreign agent R bit: registration required Wireless, Mobile Networks
Mobile IP: registration example visited network: 79.129.13/24 home agent HA: 128.119.40.7 foreign agent COA: 79.129.13.2 mobile agent MA: 128.119.40.186 ICMP agent adv. COA: 79.129.13.2 …. registration req. COA: 79.129.13.2 HA: 128.119.40.7 MA: 128.119.40.186 Lifetime: 9999 identification:714 …. registration req. COA: 79.129.13.2 HA: 128.119.40.7 MA: 128.119.40.186 Lifetime: 9999 identification: 714 encapsulation format …. registration reply HA: 128.119.40.7 MA: 128.119.40.186 Lifetime: 4999 Identification: 714 encapsulation format …. registration reply HA: 128.119.40.7 MA: 128.119.40.186 Lifetime: 4999 Identification: 714 …. time Wireless, Mobile Networks
Components of cellular network architecture recall: correspondent wired public telephone network MSC MSC MSC MSC MSC different cellular networks, operated by different providers Wireless, Mobile Networks
Handling mobility in cellular networks home network: network of cellular provider you subscribe to (e.g., Sprint PCS, Verizon) home location register (HLR): database in home network containing permanent cell phone #, profile information (services, preferences, billing), information about current location (could be in another network) visited network: network in which mobile currently resides visitor location register (VLR): database with entry for each user currently in network could be home network Wireless, Mobile Networks