EEC484584 Computer Networks Lecture 13 Wenbing Zhao wenbingzgmail
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao wenbingz@gmail. com
Outline n Ethernet q q q n Manchester Encoding The Ethernet MAC Sublayer Protocol The Binary Exponential Backoff Algorithm ARP and DHCP 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
Ethernet “dominant” wired LAN technology: n cheap $20 for NIC n first widely used LAN technology n simpler, cheaper than other schemes n kept up with speed race: 10 Mbps – 10 Gbps Metcalfe’s Ethernet sketch
802. 3 Ethernet Standards: Link & Physical Layers n Many different Ethernet standards q q q common MAC protocol and frame format different speeds: 2 Mbps, 100 Mbps, 1 Gbps, 10 G bps different physical layer media: fiber, cable application transport network link physical MAC protocol and frame format 100 BASE-TX 100 BASE-T 2 100 BASE-FX 100 BASE-T 4 100 BASE-SX 100 BASE-BX copper (twister pair) physical layer fiber physical layer
Manchester Encoding n n Binary encoding q Hard to distinguish 0 bit (0 -volt) from idle (0 -volt) q Requires clocks of all stations synchronized Manchester encoding q used in 10 Base. T q each bit has a transition q allows clocks in sending and receiving nodes to synchronize to each other n 11/5/2020 no need for a centralized, global clock among nodes! EEC-484/584: Computer Networks Wenbing Zhao
Ethernet Frame Structure n Preamble: for clock synchronization q q n First 7 bytes with pattern 1010, last byte with pattern 10101011 The two consecutive 1’s indicate the start of a frame How can the receiver tell the end of the frame? q No current on the wire (interesting discussion at http: //www. tomshardware. com/forum/19951 -42 -detecting-length-ethernet-frame) Not considered as part of the header! 11/5/2020 >= 64 bytes EEC-484/584: Computer Networks Wenbing Zhao
Ethernet Frame Structure n Destination address: 6 bytes (48 bits) Highest order bit: 0 individual, 1 multicast; all 1’s broadcast q Frames received with non-matching destination address is discarded Type/Length: type of network layer protocol (or length of payload) Pad – used to produce valid frame >= 64 bytes Checksum – 32 -bit cyclic redundancy check q n n n 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
CSMA with Collision Detection n n If two stations start transmitting simultaneously, both detect collision and stop transmitting Monitor collision while sending q n Minimum time to detect collision => minimum frame length Time divided into slots q q 11/5/2020 Length of slot = 2 t = worst-case round-trip propagation time To accommodate longest path, slot time = 512 bit times = 51. 2 msec (10 Mbps Ethernet) => min frame length: 51. 2 msec X 10 Mbps = 512 b = 64 byte EEC-484/584: Computer Networks Wenbing Zhao
Minimum Time to Detect Collision (in worst-case scenario) n To ensure the sender can detect collision q All frames must take more than 2 t to send so that transmission is still taking place when the noise burst gets back to the sender 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
Ethernet MAC Sublayer Protocol n Connectionless: No handshaking between sending and receiving NICs q Ethernet resides in the Network Interface Card (NIC) n Unreliable: receiving NIC doesn’t send acks or nacks to n sending NIC q stream of datagrams passed to network layer can have gaps (missing datagrams) q gaps will be filled if app is using TCP q otherwise, app will see gaps Ethernet’s MAC protocol: CSMA/CD 11/5/2020 EEC-484/584: Computer Networks 5 -10
Ethernet CSMA/CD algorithm 1. NIC receives datagram from 4. If NIC detects another network layer, creates frame transmission while transmitting, aborts and sends jam signal 2. If NIC senses channel idle, starts frame transmission If NIC 5. After aborting, NIC enters senses channel busy, waits exponential backoff: after mth until channel idle, then collision, NIC chooses K at transmits random from {0, 1, 2, …, 2 m-1}. NIC waits K·512 3. If NIC transmits entire frame bit times, returns to Step 2 without detecting another transmission, NIC is done with frame ! 11/5/2020 EEC-484/584: Computer Networks 5 -11
Randomization and Binary Exponential Backoff n n n After 1 st collision, station picks 0 or 1 at random, waits that number of slots and tries again After 2 nd collision, station picks 0, 1, 2, 3 at random, waits that number of slots and tries again …. After i-th collision, station picks 0, 1, …, 2 i-1 at random, … If 10 <= i < 16, station picks 0, 1, …, 210 -1 at random If i=16, controller reports failure to computer Why randomization is needed? 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
Ethernet/MAC Addresses n Ethernet (or MAC or LAN or physical) address: q q Function: get frame from one interface to another physically-connected interface (same network) 48 bit MAC address n 11/5/2020 Burned in NIC ROM, also sometimes software settable EEC-484/584: Computer Networks 5 -13
MAC Addresses Each adapter on Ethernet has unique MAC address 1 A-2 F-BB-76 -09 -AD LAN (wired or wireless) 71 -65 -F 7 -2 B-08 -53 Broadcast address = FF-FF-FF-FF = adapter 58 -23 -D 7 -FA-20 -B 0 0 C-C 4 -11 -6 F-E 3 -98 11/5/2020 EEC-484/584: Computer Networks 5 -14
MAC Addresses n n n MAC address allocation administered by IEEE Manufacturer buys portion of MAC address space (to assure uniqueness) 32 -bit IP address: q network-layer address q used to get datagram to destination IP subnet MAC flat address ➜ portability q Can move LAN card from one LAN to another IP hierarchical address NOT portable q Address depends on IP subnet to which node is attached 11/5/2020 EEC-484/584: Computer Networks 5 -15
ARP: Address Resolution Protocol Question: how to determine MAC address of B knowing B’s IP address? n n 137. 196. 7. 78 1 A-2 F-BB-76 -09 -AD Each IP node (host, router) on LAN has ARP table: IP/MAC address mappings for some LAN nodes < IP address; MAC address; TTL> q 137. 196. 7. 23 137. 196. 7. 14 LAN 71 -65 -F 7 -2 B-08 -53 TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min) 58 -23 -D 7 -FA-20 -B 0 0 C-C 4 -11 -6 F-E 3 -98 137. 196. 7. 88 11/5/2020 EEC-484/584: Computer Networks 5 -16
ARP Protocol: Same LAN n n n 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 q Dest MAC address = FFFF-FF-FF q All machines on LAN receive ARP query B receives ARP packet, replies to A with its (B's) MAC address q 11/5/2020 n A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) q Soft state: information that times out (goes away) unless refreshed n ARP is “plug-and-play”: q Nodes create their ARP tables without intervention from net administrator Frame sent to A’s MAC address (unicast) EEC-484/584: Computer Networks 5 -17
Addressing: Routing to Another LAN Walkthrough: send datagram from A to B via R Assume A knows B’s IP address 88 -B 2 -2 F-54 -1 A-0 F 74 -29 -9 C-E 8 -FF-55 A 111 E 6 -E 9 -00 -17 -BB-4 B 1 A-23 -F 9 -CD-06 -9 B 222. 220 111. 112 R 222. 221 222 B 49 -BD-D 2 -C 7 -56 -2 A CC-49 -DE-D 0 -AB-7 D n Two ARP tables in router R, one for each IP network 11/5/2020 EEC-484/584: Computer Networks 5 -18
n n n n A creates IP datagram with source A, destination B A uses ARP to get R’s MAC address for 111. 110 A creates link-layer frame with R's MAC address as dest, frame contains A-to-B IP datagram This is a really important A’s NIC sends frame example – make sure you R’s NIC receives frame understand! R removes IP datagram from Ethernet frame, sees its destined to B R uses ARP to get B’s MAC address R creates frame containing A-to-B IP datagram sends to B 88 -B 2 -2 F-54 -1 A-0 F 74 -29 -9 C-E 8 -FF-55 A E 6 -E 9 -00 -17 -BB-4 B 111 1 A-23 -F 9 -CD-06 -9 B 222. 220 111. 112 R 222. 221 222 B 49 -BD-D 2 -C 7 -56 -2 A CC-49 -DE-D 0 -AB-7 D 11/5/2020 EEC-484/584: Computer Networks 5 -19
ARP – Exercise n n Node 1 wants to send a packet to node 4, what will be returned by ARP? Node 1 wants to send a packet to node 2, what will be returned by ARP? 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
RARP – Reverse Address Resolution Protocol 32 -bit Internet address ARP RARP 48 -bit Ethernet address n RARP - Allows a newly-booted diskless-workstation (e. g. , X terminal) to broadcast its Ethernet address and ask for its IP address q RARP server responds to a RARP request with the assigned IP address 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
Limitations of RARP n n RARP uses a link-layer broadcast, RARP requests are not forwarded by routers, therefore, an RARP server must be present on every network The only thing returned by the RARP server is the IP address 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
BOOTP – Bootstrap Protocol n BOOTP – uses UDP q q q n BOOTP drawbacks q n A client broadcasts to 255 The source IP address is set to 0. 0 if client does not know its own IP address yet Port number: 67 for server, 68 for client Requires manual configuration of tables mapping IP address to Ethernet address at the BOOTP server Replaced by DHCP 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
Dynamic Host Configuration Protocol n Allow host to dynamically obtain its IP address from network server when it joins network q q n DHCP overview (UDP is used for communication) q q n IP address assignment is lease-based (to cope with client failure, also enables reuse of addresses) Can renew its lease on address in use Host broadcasts “DHCP discover” msg DHCP server responds with “DHCP offer” msg Host requests IP address: “DHCP request” msg DHCP server sends address: “DHCP ack” msg Why two phases? q To deal with multiple DHCP servers 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
DHCP Replay n n A DHCP relay agent can be configured on each LAN The agent stores the IP address of the DHCP server and forward the request to the server 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
DHCP with Replay Agent n n n To find its IP address, a newly-booted machine broadcasts a DHCP Discover packet The DHCP relay agent on its LAN receives all DHCP broadcasts On receiving a DHCP Discover packet, the agent sends the packet as a unicast packet to the DHCP server, possibly on a distant network 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
Exercise n An IP packet to be transmitted by Ethernet is 60 bytes long. Is padding needed in the Ethernet frame, and if so, how many bytes? 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
Exercise n Consider building a CSMA/CD network running at 1 Gbps over a 1 -km cable. The signal speed in the cable is 200, 000 km/sec. What is the minimum frame size? 11/5/2020 EEC-484/584: Computer Networks Wenbing Zhao
- Slides: 28