1 Mac Addressing, Ethernet, and Interconnections MAC Addresses
Total Page:16
File Type:pdf, Size:1020Kb
MAC Addresses and ARP ❒ 32-bit IP address: ❍ network-layer address Mac Addressing, Ethernet, and ❍ used to get datagram to destination IP subnet Interconnections ❒ MAC (or LAN or physical or Ethernet) address: ❍ used to get datagram from one interface to another physically-connected interface (same network) ❍ 48 bit MAC address (for most LANs) burned in the adapter ROM 5: DataLink Layer 5-1 5: DataLink Layer 5-2 LAN Addresses and ARP LAN Address (more) Each adapter on LAN has unique LAN address ❒ MAC address allocation administered by IEEE ❒ manufacturer buys portion of MAC address space 1A-2F-BB-76-09-AD Broadcast address = (to assure uniqueness) FF-FF-FF-FF-FF-FF ❒ Analogy: LAN (a) MAC address: like Social Security Number (wired or = adapter wireless) (b) IP address: like postal address 71-65-F7-2B-08-53 58-23-D7-FA-20-B0 ❒ MAC flat address ➜ portability ❍ can move LAN card from one LAN to another 0C-C4-11-6F-E3-98 ❒ IP hierarchical address NOT portable ❍ depends on IP subnet to which node is attached 5: DataLink Layer 5-3 5: DataLink Layer 5-4 ARP: Address Resolution Protocol ARP protocol: Same LAN (network) ❒ A wants to send datagram to Question: how to determine ❒ Each IP node (Host, B, and B’s MAC address not in ❒ A caches (saves) IP-to-MAC A’s ARP table. MAC address of B Router) on LAN has address pair in its ARP table ❒ A broadcasts ARP query until information becomes old ARP table knowing B’s IP address? packet, containing B's IP (times out) address 237.196.7.78 ❒ ARP Table: IP/MAC ❍ soft state: information ❍ Dest MAC address = FF- that times out (goes 1A-2F-BB-76-09-AD address mappings for FF-FF-FF-FF-FF away) unless refreshed 237.196.7.23 ❍ 237.196.7.14 some LAN nodes all machines on LAN receive ARP query ❒ ARP is “plug-and-play”: < IP address; MAC address; TTL> LAN ❒ B receives ARP packet, ❍ nodes create their ARP ❍ TTL (Time To Live): replies to A with its (B's) 71-65-F7-2B-08-53 tables without 58-23-D7-FA-20-B0 time after which MAC address intervention from net address mapping will be ❍ frame sent to A’s MAC administrator 0C-C4-11-6F-E3-98 forgotten (typically 20 address (unicast) 237.196.7.88 min) 5: DataLink Layer 5-5 5: DataLink Layer 5-6 1 ❒ A creates datagram with source A, destination B Routing to another LAN ❒ A uses ARP to get R’s MAC address for 111.111.111.110 ❒ A creates link-layer frame with R's MAC address as dest, frame walkthrough: send datagram from A to B via R contains A-to-B IP datagram assume A know’s B IP address ❒ A’s adapter sends frame ❒ R’s adapter receives frame ❒ R removes IP datagram from Ethernet frame, sees its destined to B ❒ R uses ARP to get B’s MAC address A ❒ R creates frame containing A-to-B IP datagram sends to B A R B ❒ Two ARP tables in router R, one for each IP network (LAN) R ❒ In routing table at source Host, find router 111.111.111.110 B ❒ In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc 5: DataLink Layer 5-7 5: DataLink Layer 5-8 Ethernet Star topology “dominant” wired LAN technology: ❒ Bus topology popular through mid 90s ❒ cheap $20 for 100Mbs! ❒ Now star topology prevails ❒ first widely used LAN technology ❒ Simpler, cheaper than token LANs and ATM ❒ Connection choices: hub or switch (more later) ❒ Kept up with speed race: 10 Mbps – 10 Gbps Metcalfe’s Ethernet sketch hub or switch 5: DataLink Layer 5-9 5: DataLink Layer 5-10 Ethernet Frame Structure Ethernet Frame Structure (more) Sending adapter encapsulates IP datagram (or other ❒ Addresses: 6 bytes network layer protocol packet) in Ethernet frame ❍ if adapter receives frame with matching destination address, or with broadcast address (eg ARP packet), it passes data in frame to net-layer protocol ❍ otherwise, adapter discards frame Preamble: ❒ Type: indicates the higher layer protocol (mostly IP but others may be supported such as Novell ❒ 7 bytes with pattern 10101010 followed by one IPX and AppleTalk) byte with pattern 10101011 ❒ CRC: checked at receiver, if error is detected, ❒ used to synchronize receiver, sender clock rates the frame is simply dropped 5: DataLink Layer 5-11 5: DataLink Layer 5-12 2 Manchester encoding Unreliable, connectionless service ❒ Connectionless: No handshaking between sending and receiving adapter. ❒ Unreliable: receiving adapter doesn’t send acks or nacks to sending adapter ❍ stream of datagrams passed to network layer can have ❒ Used in 10BaseT gaps ❍ gaps will be filled if app is using TCP ❒ Each bit has a transition ❍ otherwise, app will see the gaps ❒ Allows clocks in sending and receiving nodes to synchronize to each other ❍ no need for a centralized, global clock among nodes! ❒ Hey, this is physical-layer stuff! 5: DataLink Layer 5-13 5: DataLink Layer 5-14 Ethernet uses CSMA/CD Ethernet CSMA/CD algorithm 1. Adaptor receives datagram 4. If adapter detects another ❒ No slots ❒ Before attempting a from net layer & creates frame transmission while transmitting, aborts and sends ❒ adapter doesn’t transmit retransmission, 2. If adapter senses channel idle, it starts to transmit frame. If jam signal if it senses that some adapter waits a random time, that is, it senses channel busy, waits 5. After aborting, adapter enters other adapter is until channel idle and then exponential backoff: after the transmitting, that is, random access transmits mth collision, adapter chooses carrier sense 3. If adapter transmits entire a K at random from {0,1,2,…,2m-1}. Adapter waits ❒ transmitting adapter frame without detecting another transmission, the K·512 bit times and returns to aborts when it senses adapter is done with frame ! Step 2 that another adapter is transmitting, that is, collision detection 5: DataLink Layer 5-15 5: DataLink Layer 5-16 Ethernet’s CSMA/CD (more) 10BaseT and 100BaseT ❒ 10/100 Mbps rate; latter called “fast ethernet” Jam Signal: make sure all Exponential Backoff: ❒ T stands for Twisted Pair other transmitters are ❒ Goal: adapt retransmission aware of collision; 48 bits attempts to estimated ❒ Nodes connect to a hub: “star topology”; 100 m Bit time: .1 microsec for 10 current load max distance between nodes and hub Mbps Ethernet ; ❍ heavy load: random wait for K=1023, wait time is will be longer about 50 msec ❒ first collision: choose K from {0,1}; delay is K· 512 twisted pair bit transmission times See/interact with Java ❒ after second collision: applet on AWL Web site: hub highly recommended ! choose K from {0,1,2,3}… ❒ after ten collisions, choose K from {0,1,2,3,4,…,1023} 5: DataLink Layer 5-17 5: DataLink Layer 5-18 3 Hubs Gbit Ethernet Hubs are essentially physical-layer repeaters: ❍ bits coming from one link go out all other links ❒ uses standard Ethernet frame format ❍ at the same rate ❒ allows for point-to-point links and shared ❍ no frame buffering broadcast channels ❍ no CSMA/CD at hub: adapters detect collisions ❒ in shared mode, CSMA/CD is used; short ❍ provides net management functionality distances between nodes required for efficiency ❒ uses hubs, called here “Buffered Distributors” twisted pair ❒ Full-Duplex at 1 Gbps for point-to-point links ❒ 10 Gbps now ! hub 5: DataLink Layer 5-19 5: DataLink Layer 5-20 Interconnecting with hubs Switch ❒ Backbone hub interconnects LAN segments ❒ Link layer device ❒ Extends max distance between nodes ❍ stores and forwards Ethernet frames ❒ But individual segment collision domains become one ❍ examines frame header and selectively large collision domain forwards frame based on MAC dest address ❒ Can’t interconnect 10BaseT & 100BaseT ❍ when frame is to be forwarded on segment, hub uses CSMA/CD to access segment ❒ transparent ❍ hosts are unaware of presence of switches hub hub hub ❒ plug-and-play, self-learning ❍ switches do not need to be configured 5: DataLink Layer 5-21 5: DataLink Layer 5-22 Forwarding Self learning switch 1 2 3 ❒ A switch has a switch table ❒ entry in switch table: hub ❍ (MAC Address, Interface, Time Stamp) hu hub b ❍ stale entries in table dropped (TTL can be 60 min) ❒ switch learns which hosts can be reached through which interfaces ❍ when frame received, switch “learns” location of sender: incoming LAN segment • How do determine onto which LAN segment to ❍ records sender/location pair in switch table forward frame? • Looks like a routing problem... 5: DataLink Layer 5-23 5: DataLink Layer 5-24 4 Filtering/Forwarding Switch example When switch receives a frame: Suppose C sends frame to D address interface index switch table using MAC dest address switch 1 A 1 2 3 if entry found for destination B 1 E 2 then{ hub A hub hub G 3 if dest on segment from which frame arrived I D F G then drop the frame B C E H else forward the frame on interface indicated ❒ Switch receives frame from from C } forward on all but the interface ❍ notes in bridge table that C is on interface 1 else flood on which the frame arrived ❍ because D is not in table, switch forwards frame into interfaces 2 and 3 5: DataLink Layer 5-25 ❒ frame received by D 5: DataLink Layer 5-26 Switch example Switch: traffic isolation Suppose D replies back with frame to C. ❒ switch installation breaks subnet into LAN segments address interface ❒ switch filters packets: switch A 1 ❍ same-LAN-segment frames not usually B 1 forwarded onto other LAN segments E 2 hub A hub hub G 3 ❍ segments become separate collision domains I C 1 switch D F G B C E H collision domain ❒ Switch receives frame from from D hub hub hub ❍ notes in bridge table that D is on interface 2 ❍ because C is in table, switch forwards frame only to interface 1 5: DataLink Layer 5-27 collision domain 5: DataLink Layer 5-28 ❒ frame received by C collision domain Switches: dedicated access More on Switches ❒ Switch with many A interfaces ❒ cut-through switching: frame forwarded C’ B ❒ Hosts have direct from input to output port without first connection to switch collecting entire frame switch ❒ No collisions; full duplex ❍ slight reduction in latency C ❒ combinations of shared/dedicated, Switching: A-to-A’ and B-to- B’ simultaneously, no B’ A’ 10/100/1000 Mbps interfaces collisions 5: DataLink Layer 5-29 5: DataLink Layer 5-30 5 Institutional network Switches vs.