Redes de Computadores II - Aulas Teóricas 3 e 4 PDF
Document Details
Uploaded by RejoicingHeliotrope9845
Universidade do Algarve
Néstor Cataño
Tags
Summary
This document is a lecture on computer networking covering topics such as Ethernet, MAC addresses, switching, and security considerations, as part of a Redes de Computadores II course at Universidade do Algarve, The document includes examples, diagrams and quizzes.
Full Transcript
Redes de Computadores II Universidade do Algarve Aulas Teóricas 3 e 4 Semana 2 https://github.com/ncatanoc/redes_algarve Néstor Cataño [email protected] 1  The link (ethe...
Redes de Computadores II Universidade do Algarve Aulas Teóricas 3 e 4 Semana 2 https://github.com/ncatanoc/redes_algarve Néstor Cataño [email protected] 1  The link (ethernet) layer Goal: 1. To understand the principles behind the link layer: 1. Ethernet frames, MAC addresses 2. Switching application 3. Switch security considerations transport network link physical 2 Roadmap 1. Datagrams 2. The link (ethernet) layer ethernet frames, MAC addresses 3. Broadcasting 4. Switching 5. Switch security considerations 6. Error detection and correction 3 Recap: the 4-layers model application: supporting network applications. application transport transport: process-process data transfer. network network: routing of datagrams from link/ethernet source to destination. physical link: data transfer between neighbouring network elements. 4 Recap: datagrams 5 ethernet - data transmission Layer 2 (ethernet) is responsible for application hop-to-hop delivery. The MAC address uniquely identifies transport each individual NIC (network interface controller). network Besides your NIC, a switch also works at this level ethernet hop is a term that refers to the number of routers a packet (a portion physical of data) passes through from source to destination. 6 network - data transmission Layer 3 (network) is responsible for end- application to-end delivery. it uses IP addresses. transport when a computer has data to send, it network encapsulates the data in an IP header, including information such as the Source and Destination IP address. ethernet between each router, the MAC address header is stripped and regenerated to get physical the next hop (router 7 data transmission Layer 4 (transport) is responsible for application service-to-service delivery. We need a way to distinguish data transport streams from the Internet, e.g. browsers, Zoom, etc. network Protocols: TCP (transmission control protocol) and UDP (user datagram ethernet protocol). physical 8 data transmission When layer 4 gets data, it adds a header that facilitates service-to-service delivery, e.g., TCP or UDP ports. The whole datagram is referred to as a segment. When layer 3 gets data, it adds a header that facilitates end-to-end delivery, e.g., sure IP, destination IP, etc. The whole datagram is referred to as a packet. When layer 2 gets data, it adds a header that facilitates hop-to-hop delivery, e.g., a Source MAC address. The whole datagram is referred to as a frame. 9 Roadmap 1. Datagrams 2. The link (ethernet) layer ethernet frames, MAC addresses 3. Broadcasting 4. Switching 1. security considerations 5. Error detection and correction 10 the link (ethernet) layer What is ethernet and why do we care? Ethernet is a popular approach to solving the problem of transmitting data over a LAN (local area network). Immensely successful to this day, it continues to evolve wired, high- speed GigaBytes, wireless, etc. Provides link layer support for encapsulating IP datagrams. 11 building blocks of Ethernet 1. The frame Standardised set of bits that carry data 2. The MAC (media access control) protocol Set of rules for accessing Ethernet channels 3.The signalling components Standardised electronic devices that send and receive signals over Ethernet channels 4.The physical medium Cable carrying the signals We will focus on 1 and 2: data frames and MAC addresses 12 ethernet frames Destination - MAC address of the device where the packet is going Source - MAC address from which the packet came from Type - it allows multiplexing (which network protocol will be used) Data - the datagram that we are sending Padding - to complete the minimum size of the datagram CRC - cyclic redundant check, used to handle errors 13 ethernet frames If we were to send 1501 bytes of data, how many frames do we need to send? Frame 1. the Data field contains 1500 bytes. Frame 2. the Data field contains 1 data byte plus 45 bytes of padding. Those padding bytes are the Padding field. 14 Quiz - example 1 You are sending data over ethernet that is 5400 bytes long? How many ethernet frames will this be? 15 Quiz - example 1 You are sending data over ethernet that is 5400 bytes long? How many ethernet frames will this be? 3 frames x 1500 bytes = 4500 bytes 1 frame of 900 bytes 16 Quiz - example 2 You are sending data over ethernet that is 3201 bytes long? How many ethernet frames will this be? 17 Quiz - example 2 You are sending data over ethernet that is 3201 bytes long? 3021 How many ethernet frames will this be? 2 frames x 1500 bytes = 3000 bytes 1 frame of 21 bytes plus 25 bytes of padding 18 MAC addresses 1. OUI (Organization Unique Identifier), e.g. 60:45:BD for Microsoft. 2. NIC (Network Interface Controller), identifies the device. 19 Roadmap 1. Datagrams 2. The link (ethernet) layer ethernet frames, MAC addresses 3. Broadcasting 4. Switching 1. security considerations 5. Error detection and correction 20 ethernet frames - broadcasting Destination is sometimes a set of physical devices, in which case we are talking about a broadcast address: the broadcast address is FF:FF:FF:FF:FF:FF In practice, this means that if a network adapter gets a broadcast address, the adapter will send the address to the network layer to translate it. What about datagrams from other networks beyond the LAN? Well, that’s routing, and that’s the topic for next week 21 example 1 00-00-F0 equals to SAMSUNG and 00-05-5D to GUI-LINK The refrigerator builds a frame with the Source equals to 00-00-F0-70-BC-9 and the Destination equals to 00-05-5D-1A-09-BF 22 example 1 00-00-F0 means SAMSUNG 00-05-5D means GUI-LINK 23 example 2 - broadcasting The Wireless Access Point (WAP) broadcasts the MAC address FF: FF: FF: FF: FF:FF WAP 24 example 2 - broadcasting The Wireless Access Point (WAP) broadcasts the MAC address FF: FF: FF: FF: FF:FF WAP 25 exercise - broadcasting A is going to send a message with the destination MAC address FF:FF:FF:FF:FF:FF 26 exercise - broadcasting 1. What is the source address? 2. What is the destination address? 3. What devices on the network can see the ethernet frame and its contents? Check all that apply 1. A 2. B 3. C 4. D 4. What data do the devices on the network that you checked above have access to? Check all that apply 1. Ethernet frame data field 2. IP datagram 3. Transport layer data 4. Application layer data 27 Summary application transport 1. Ethernet is designed for local area networks and carries the IP network datagram. 2. Ethernet addresses are MAC addresses ethernet/link 3. MAC addresses have a specific format, physical including an OUI. 4. Next: transferring data through switching 28 Roadmap 1. Datagrams 2. The link (ethernet) layer ethernet frames, MAC addresses 3. Broadcasting 4. Switching 1. security considerations 5. Error detection and correction 29 Switching and routing A switch connects multiple devices to create a network. A router connects multiple switches, and their respective networks, to form an even larger network. 30 Switching example Switch table 31 How does the switch build its table? Switch table 32 How does the switch build its table? Switch table 33 How does the switch build its table? 1. The switch table starts empty 2. When the ethernet frame comes in, the switch stores the source MAC address to the port it came from. 3. It also records the time it received the transmission. 4. Aging: entries are allowed for a fixed time. Switch table A message sent to 0C:0C:0b:14:cd:98 is transmitted over port 2 34 flooding What happens when a switch does not know the packet destination? Message is sent to C (00-03-93-B0-84-0B), but C is not in the switch table. 35 flooding In that case the the switch floods all the ports it sends a message to each port This causes port C (and the other ports) to send a message to the LAN so this can complete the table. Switch table 36 Roadmap 1. Datagrams 2. The link (ethernet) layer ethernet frames, MAC addresses 3. Broadcasting 4. Switching 1. security considerations 5. Error detection and correction 37 Security - switch flooding/poisoning Flooding MAC ports leads to a DoS (Denial of Service) attack called MAC flooding attack. 38 Security - denial of service attack The attacker floods the switch with fake MAC addresses until the switch table is filled. The switch forwards traffic to all interfaces (A, B, C), but because the addresses are fake, the switch will flood the network. The network will slow down or crash 39 Security - network sniffing when a legitimate device wants to communicate with the switch, it will broadcast any received traffic to the whole network. once the attacker gets access to the traffic, they can carry out all types of attacks. Man-in-the-middle attack Eavesdropping Network sniffing 40 Security attack 41 Security attack 42 Mitigations for switch flooding by limiting the number of MAC addresses that can be learned at each port. Instead of 25K addresses, you limit the number of addresses to 10 or 15. by checking if MAC addresses are legitimate. Checking addresses w.r.t. to a set of predefined MAC addresses. 43 Quiz - security The uniqueness of MAC addresses means that people use them as a form of access control, for example, using MAC addresses to restrict access to wireless networks. How effective is this in preventing an attacker from joining the network? This will prevent any unauthorised access This will not prevent any unauthorised access. http://menti.com Code = 1867 6956 44 Quiz - security Answer: MAC addresses can be changed and spoofed so they are not a very form of access control. 45 Summary Ethernet is designed for local area networks (LANs), and carries the IP datagram. The datagram consists not only of an IP frame but also includes (information on) subsequent layers: TCP, UPD, HTTP Ethernet frames are transferred between network adapters (NICs), uniquely identified through MAC addresses. MAC address = OUI + NIC 46 Roadmap 1. Datagrams 2. The link (ethernet) layer ethernet frames, MAC addresses 3. Broadcasting 4. Switching 5. Switch security considerations 6. Error detection and correction 47 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, destination different from IP address! ▪ reliable delivery between adjacent nodes we learned how to do this already (chapter 3)! seldom used on low bit-error link (fiber, some twisted pair) wireless links: high error rates Q: why both link-level and end-end reliability? 48 Link layer services (more) ▪ flow control: pacing between adjacent sending and receiving nodes ▪ error detection: errors caused by signal attenuation, noise. receiver detects the presence of errors: signals sender for retransmission or drops frame ▪ error correction: receiver identifies and corrects bit error(s) without resorting to retransmission ▪ half-duplex and full-duplex with half duplex, nodes at both ends of link can transmit, but not at same time Link Layer and LANs 49 Adaptors communicating datagram datagram controller controller sending host receiving host datagram frame ▪ sending side: ▪ receiving side encapsulates datagram in looks for errors, rdt, flow frame control, etc. adds error checking bits, extracts datagram, passes to upper layer at receiving side rdt, flow control, etc. 50 Error detection EDC= Error Detection and Correction bits (redundancy) D = Data protected by error checking, it may include header fields Error detection is not 100% reliable! protocol may miss some errors, but rarely larger EDC field yields better detection and correction otherwise 51 Parity checking single bit parity: two-dimensional bit parity: ▪ detect single-bit ▪ detect and correct single-bit errors errors 0 0 52 Internet checksum (review) goal: detect “errors” (e.g., flipped bits) in the transmitted packet (note: used at transport layer only) sender: receiver: ▪ treat segment contents as ▪ compute checksum of sequence of 16-bit received segment integers ▪ check if computed ▪ checksum: addition (1’s checksum equals checksum complement sum) of field value: segment contents NO - error detected ▪ sender puts checksum YES - no error detected. value into UDP checksum But maybe errors field nonetheless? 53 Cyclic redundancy check ▪ more powerful error-detection coding ▪ view data bits, D, as a binary number ▪ choose r+1 bit pattern (generator), G ▪ goal: choose r CRC bits, R, such that exactly divisible by G (modulo 2) receiver knows G, divides by G. If non-zero remainder: error detected! can detect all burst errors less than r+1 bits ▪ widely used in practice (Ethernet, 802.11 WiFi, ATM) 54 CRC example want: D.2r XOR R = nG equivalently: D.2r = nG XOR R equivalently: if we divide D.2r by G, want remainder R to satisfy: D.2r R = remainder[ ] G * Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Link Layer and LANs 55 Summary Error detection Error correction 56