Chapter 5: Link Layer
Pros and Cons of Routers
Pros: - Firewall protection for added security - Optimal routing Cons: - Not plug-and-play - Larger processor time since frames have to be processed up to layer 3 (network layer)
Random Access Protocol and name some examples
A transmitting node will have a complete throughput of R bps and when there is collision, each node will independently choose a random delay to resend the frame until the frame is properly received without collision. Slotted ALOHA
Bob tries to connect his laptop to the school's internet. Describe each step thoroughly.
1. Bob's laptop creates a DHCP request message, puts the message in a UDP segment, then the segment is placed in an IP datagram with broadcast address 255.255.255.255 and source IP address 0.0.0.0 since his laptop has not obtained an IP address yet. 2. DHCP message is placed in an Ethernet frame with destination MAC address of FF:FF:FF:FF:FF:FF which is broadcasted to all devices connected to the switch. 3.Router receives Ethernet frame and extracts the IP datagram from the frame. The datagram is then processed to the upper layer protocols up to UDP where the DHCP server should now have the DHCP request message. 4. DHCP server creates DHCP ACK message which is put into a UDP segment, into a IP datagram, then into a frame. 5. Ethernet frame is sent from router to a switch. The switch is self-learning and konws to forward the frame to the output port towards Bob's laptop 6. Bob's laptop receives the DHCP ACK message by extracting it from all of its encapsulation and his DHCP client updates the forwarding table and the network settings are initialized.
Describe the process of a switch table
1. If a frame arrives at the switch from some source address and some interface and there is no entry on the table, the switch broadcasts the frame and adds a new entry on the table 2. If a frame arrives at the switch and there is an entry with the same source address and same interface, the switch filters it out and discards the frame 3. If a frame arrives at a switch and there is an entry with the same source address and different interface, the switch forwards the frame.
Advantages of Taking-Turns Protocol
1. If one node is active (aka ready to transmit), that node will have maximum throughput of R bps 2. If multiple nodes are active, each node will have R/M bps where M is the number of active nodes.
Characteristics of Multiple Access Protocol
1. If there is only 1 node, throughput is R bps 2. If there are M nodes, the average throughput of each node will be R/M bps 3. Decentralized, so no single point of failure 4. Simple and inexpensive
Switch Table contains...
1. MAC Address of the frame's source address field (aka address of sender adapter) 2. Interface from where the frame came from 3. Time when entry was placed on the table These tables have self-learning where table is updated dynamically.
Two Important Rules of Networking Protocols
Carrier Sensing: "Listen before speaking" or a node that listens to a channel before transmitting. If another node is transmitting, the current node waits its turn before transmitting. Collision Detection: "If someone starts talking at the same time, stop talking" If node is transmitting an interfering frame, it stops transferring and waits a random amount of time before attempt retransmission.
Three categories of multiple access protocols
Channel Partitioning Protocols (CPP) Random Access Protocols (RAP) Taking-Turns Protocol (TTP)
Links
Communication channels that connect nodes.
Characteristics of Ethernet
Connectionless: no need for handshaking from Adapter A to Adapter B Unreliable: CRC check is performed by the receiving adapter, but no ACK is sent from either adapter A or B and the receiving adapter simply discards the Ethernet frame if error is detected
MAC Address
Synonym for link-layer addresses and are 8 bytes in hexadecimal where every adapter / interface has a unique address. They do not change no matter what kind of like Social Security Numbers. (E.G - 1A-23-F9-CD-06-9B)
Ethernet Frame Structure
Data Field: Destination Address: In MAC form Source Address: In MAC Form Type Field: This fields allows Ethernet to use other protocols besides IP. Cyclic Redundancy Check: Preamble: 8-byte field where the first 7 bytes (each byte with value 10101010) serve to "wake up" other adapter to sync their clock with the sender adapter's clock. Clocks can get off sync since transmission isn't always exactly 10Mpbs, 100Mpbs, or 1GBs. The last byte is (10101011) where the last 2 bits alert Adapter B that "important stuff" is about to come
Nodes
Devices that a run in the link-layer such as routers, hosts, switches, and access points.
Properties of Link-Layer Switching
Eliminates Collisions Links are independent from one another Switches can detect when an adapter malfunctions and disconnects that adapter
Explain how ARP works
Every host and router has an ARP table with IP and MAC address mappings along with time-to-live (TTL). The sender looks up the table to find the corresponding MAC address, then sends the packet to that address.
Switch Functions
Filtering: Switch function that decides whether an incoming frame should be forwarded or dropped. Forwarding: Switch function that determines which interface the frame should be directed, and then directs the frame to that interface using a switch table.
Services of the link-layer protocol
Framing: Encapsulating the network layer datagram into a frame before transmission Link Access: Medium access control (MAC) protocol specifies how the frame will be transmitted over the link Reliable Delivery Error Detection and Correction: Typically implemented in hardware and can detect exactly where the bit error is located in the frame.
Blades
Hosts in data centers
Address Resolution Protocol (ARP)
How IP addresses are translated into MAC addresses. Similar to DNS, ARP resolves IP addresses by looking up the corresponding MAC address although it can only resolve on the same subnet. If a node in California uses ARP to resolve the IP address for a node in Mississippi, ARP would return an error.
How is an entry deleted from the switch table?
If no frames are received from a MAC address after some period of time (aging time)
Where is the link-layer implemented?
In a network adapter / network interface card (NIC), so mostly in hardware and some software in host's CPU.
What are MPLS capable routers called?
Label-switched routers
Techniques for EDC (error -detection -correction)
Parity Checks: Sender adds a single parity bit of value 1 to the data which becomes either an even or odd parity scheme. (E.G. Sender sends a frame with even parity scheme, receiver gets a frame with odd parity scheme. Hence, at least 1 or an odd number of bits have been flipped) Checksum: Use 1s compliment to add the data bits, receiver uses the calculated checksum to detect errors Cyclic Redundancy Check (CRC):
Hub
Physical device that takes a bit, makes a copy of it, then sends all of the copies to all other interfaces. If a hub receives multiple frames, collision occurs and the nodes must retransmit the frames
Two types of network links
Point-to-Point Link: Single sender and single receiver Broadcast Link: Multiple sender and receivers sharing the same channel
Two examples of Taking-Turns Protocol (TTP)
Polling Protocol: One node is designated as a master node and starts by allowing node 1 to transmit some maximum number of frames. After node 1 has transmit some frames, the master node tells node 2 to transmit up to the max number of frames. This repeats. Adv: - Eliminates empty slots - Eliminates collisions Disadv: - Introduces polling delay, the time it takes for master node to notify each node - If master node fails, the entire channel becomes inoperative Token-Passing Protocol: A special token frame is passed along nodes and whichever node that holds the token is allowed to transmit the maximum number of frames. When finished, the token is passed along to other nodes. Adv: - Decentralized, no single point of failure - Efficient Disadv: - Failure or one node can crash entire channel - Node accidentally neglecting the token halts the channel
Pros and Cons of Switches
Pros: - Plug and play - High filtering and forwarding rates - Switches only have to process frames up to layer 2 (link layer) Cons: - Susceptible to broadcast storms when one host sends an endless stream of frames, the network can potentially collapse - Large switched network requires large ARP tables
Role of Switches
Receiving incoming frames and forward them to outgoing links. They are transparent to hosts/routers (meaning hosts and routers do not address the frame to the switch and ignores them)
How does an adapter send a frame to all other adapters in which all receiving adapters will RECEIVE and PROCESS the frame?
Sender adapter includes the MAC BROADCAST ADDRESS into the frame which is FF-FF-FF-FF-FF.
Multiprotocol Label Switching (MPLS)
Served to improve forwarding speed of routers using a fixed-length label. A frame passed through a MPLS capable router will have a MPLS header and does not rely on destination IP address lookup.
Top of Rack Switch (TOR Switch)
Switch at the top of the rack that interconnects all of the hosts to each other in the data center
Channel Partitioning Protocols: - Time Division Multiplexing (TDM) - Frequency Division Multiplexing (FDM) - Code Division Multiple Access (CDMA)
TDM: A cocktail party where only one person gets to speak for some time frame, then the next person gets to speak. In terms of N nodes and R bps, each node is only allowed R/N bps even though only one node is allowed to transmit data at a time. FDM: Divides R bps channel into different frequencies where each frequency is assigned to each node. Both methods avoid collisions and assign fair throughput of R/N bps, but still has the disadvantage of R/N bps even when one node is sending data. CDMA: Each node is assigned an unique code that encodes the data bits that are sent. Since every code is unique, senders can transmit simultaneously and receivers will receive all incoming data correctly without collisions.
Do hosts and routers have link-layer addresses as well as network layer addresses?
Technically no, but it is the hosts and routers' adapters / interfaces that have link-layer addresses
What happens if the sender wants to send a packet to a destination, but there is no destination address entry in the ARP table?
The ARP query is used by having the sender adapter send a packet with the MAC broadcast address FF-FF-FF-FF-FF-FF. All of the adapters in the subnet will receive this frame and the adapter with matching destination IP address will respond back with their MAC address which an entry is then added to the ARP table.
Forward Error Correction (FEC)
The ability of a receiver that can detect and correct errors
Binary Exponential Backoff
The algorithm used to determine how long a node should randomly wait before retransmission. Equation: K * 512 where K is chosen randomly from {0, 1, 2, ... (2^n) -1} where n is the number of collisions and is capped at 10. Ex: 1 collision, K is chosen from {0, 1} 2 collisions, K is chosen from {0, 1, 2, 3} etc...
Frame
The encapsulation unit of the network layer datagram. Basically the transfer unit of the link-layer.
How does a host send a datagram to a host in a different subnet?
The host first uses ARP to determine the MAC address of the router and then encapsulates the packet into a frame to be sent to the router. The router uses a forwarding table to determine the MAC address of the other host then encapsulates the datagram into a frame to be sent to subnet B. Router B receives the datagram and uses ARP to determine the MAC address of the 2nd host and sends it there. tl;dr: Host A - Router A - Router B - Host B
Multiple Access Problem
The problem in determining "who gets to talk" from all of the senders and receivers in that shared channel. This problem is resolved with the MULTIPLE ACCESS PROTOCOL which coordinates frame transmission.
How does frame collision occur?
When multiple nodes transmit frames at the same time and the receiving nodes cannot interpret the received message properly, resulting in the loss of frames.