6.4 Switched Local Area Networks
6.4.1 – Link-layer Addressing and ARP
- Hosts and routers have link-layer addresses.
- It’s the adapters (network interfaces) that have link-layer addresses
- A host or router with multiple network interfaces will thus have multiple link-layer addresses associated with it, just as it would also have multiple IP addresses associated with it.
- Link-layer switches do not have link-layer addresses associated with their interfaces that connect to hosts and routers.
- This is because the job of the link–layer switch is to carry datagrams between hosts and routers; a switch does this job transparently, that is, without the host or router having to explicitly address the frame to the intervening switch.
- A link-layer address is variously called a LAN address, a physical address, or a MAC address.
- For most LANs, the MAC address is 6 bytes long, giving possible MAC addresses.
- Typically expressed in hex.
- No two adapters have the same address.
- The IEEE manages the MAC address space. When a company wants to manufacture adapters, it purchases a chunk of the address space consisting of addresses by fixing the first 24 bits of a MAC address and letting the company create unique combinations of the last 24 bits for each adapter.
- An adapter’s MAC address has a flat structure and doesn’t change no matter where the adapter goes, while the IP does change when you go somewhere else.
- When an adapter wants to send a frame to some destination adapter, the sending adapter inserts the destination adapter’s MAC address into the frame and then sends the frame into the LAN.
- A switch occasionally broadcast an incoming frame onto all of its interfaces. Thus, an adapter may receive a frame that isn’t addressed to it. Thus, when an adapter receives a frame, it will check to see whether the destination MAC address in the frame matches its own MAC address.
- If there is a match, the adapter extracts the enclosed datagram and passes the datagram up to the protocol stack.
- If there isn’t a match, the adapter discards the frame, without passing the network-layer datagram up.
- When an adapter wants all the other adapters on the LAN to receive and process the frame it is about to send, the sending adapter inserts a special MAC broadcast address into the destination address field of the frame.
- For LAN’s that use 6-byte address (Ethernet and 802.11), the broadcast address is a string of 48 consecutive 1s
- In the Internet, Address Resolution Protocol (ARP) is used to translate between network-layer and link-layer addresses.
- An ARP module in the sending host takes any IP address on the same LAN input, and returns the corresponding MAC address.
- In many ways it is analogues to DNS, except for one important difference:
- DNS resolves host names for hosts anywhere in the Internet, whereas ARP resolves IP addresses only for hosts and router interfaces on the same subnet.
- Each host and router has an ARP table in its memory, which contains mappings of IP addresses to MAC addresses. The ARP table also contains a time-to-live (TTL) value (typically 20min), which indicates when each mapping will be deleted from the table.
- A table doesn’t necessarily contain every host and router.
- When sending a datagram to an IP address on the subnet, the sending host will look for it in the ARP table, if it does, its good, if not, then the sender uses a special packet called an ARP packet.
- An ARP packet has several fields, including the sending and receiving IP and MAC addresses. Both ARP query and response packet have the same format.
- The purpose of the ARP query packet is to query all the other hosts and routers on the subnet to determine the MAC address corresponding to the IP address that is being resolved.
- Suppose a host passes an ARP query packet to the adapter along with an indication that the adapter should send the packet to the MAC broadcast address.
- The adapter encapsulates the ARP packet in a link-layer frame, uses the broadcast address for the frame’s destination address, and transmits the frame into the subnet.
- The frame containing the ARP query is received by all the other adapters on the subnet, and each adapter passes the ARP packet within the frame up to its ARP module. Each of these ARP modules checks too see if its IP address matches the destination IP address in the ARP packet.
- The one with a match sends to the querying host a response ARP packet with the desired mapping. The querying host can then update its ARP table and send its IP datagram, encapsulated in a link-layer frame whose destination MAC is that of the host or router responding to the earlier ARP query.
- The query ARP message is sent within a broadcast frame, whereas the response ARP message is sent within a standard frame.
- ARP is plug-and-play: that is, an ARP table gets built automatically, it doesn’t have to be configured by a system administrator. And if a host becomes disconnected from the subnet, its entry is eventually deleted from the other ARP tables in the subnet.
- An ARP packet is encapsulated within a link-layer frame and thus lies architecturally above the link layer. However, an ARP packet has fields containing link-layer addresses and thus is arguably a link-layer protocol, but it also contains network-layer addresses and thus is also arguably a network-layer protocol. In the end, ARP is probably best considered a protocol that straddles the boundary between the link and network layer.
- A router has an IP address for each of its interfaces. For each router interface there is also an ARP module and an adapter. A router with two interfaces has two IP addresses, two ARP modules, and two adapters and each adapter has its own MAC address.
- Suppose we have two subnets, Subnet 1 = 111.111.111/24 and Subnet 2 = 222.222.222/25
- Suppose that host 111.111.111.111 wants to send an IP datagram to a host 222.222.222.222.
- The sending host passes the datagram to its adapter, as usual. But the sending host must also indicate to its adapter an appropriate destination MAC address.
- One might be tempted to guess that the appropriate MAC address is that of the adapter for host 222.222.222.222. This guess, however, would be wrong.
- If the sending adapter were to use the MAC address to the receiving adapter then non of the adapters on subnet 1 would bother to pass the IP datagram up to its network layer, since the frame’s destination address would not match the MAC address of any adapter on subnet 1.
- In order for a datagram to go from 111.111.111.111 to host on subnet 2, the datagram must first be sent to the router interface 111.111.111.110, which is the IP address of the first-hop router on the path to the final destination. Thus, the appropriate MAC address for the frame is the address of the adapter for router interface 111.111.111.110
- Once the sending adapter has this MAC address, it creates a frame (containing the datagram addresses to 222.222.222.222) and sends the frame into subnet 1.
- The router adapter on subnet 1 sees that the link-layer frame is addressed to it, and therefore passes the frame to the network layer of the router.
- The router now has to determine the correct interface on which the datagram is to be forwarded to:
- This is done by consulting a forwarding table in the router. Which tells the router that the datagram is to be forwarded via router interface 222.222.222.220. This interface then passes the datagram to its adapter, which encapsulates the datagram in a new frame and sends the frame into subnet 2.
- The destination MAC address of the frame is indeed the MAC address of the ultimate destination. And how the router obtain the destination MAC address with ARP.
6.4.2 Ethernet
- Token ring, FDDI and ATM fought against Ethernet, but Ethernet became the warlord.
- Reasons for Ethernet’s success:
- It was the first widely deployed high-speed LAN.
- Because it was deployed early, network admins became intimately familiar with Ethernet and were reluctant to switch over to other LAN technologies when they came on the scene.
- Token ring, FDDI, and ATM were more complex and expensive than Ethernet, which further discouraged network admins from switching over.
- A good reason to switch to other technologies was usually the higher data rate of the new technology; however, Ethernet always fought back, producing version that operated at equal data rates or higher.
- Switched Ethernet was introduced in the early 1990s
- Ethernet became so popular that the Ethernet hardware has become a commodity and is remarkably cheap.
- Ethernet LAN was invented in the mid-1970s by Bob Metcalfe and David Boggs.
- The original Ethernet LAN used a coaxial bus to interconnect the nodes.
- Which was persistent throughout the 1980s into the mid-1990s
- Ethernet with a bus topology is a broadcast LAN.
- By the late 1990s, most companies and universities replaced their LANs with Ethernet installation using a hub-based star topology.
- The hosts are directly connected to a hub witch twisted-pair copper wire.
- A hub is a physical-layer device that acts on individual bits rather than frames. When a bit, representing 0 or 1, arrives from one interface, the hub simply re-creates the bit, boosts its energy strength, and transmits the bit onto all the other interfaces.
- Ethernet with a hub-based star topology is also a broadcast LAN. In particular, if a hub receives frames from two different interfaces at the same time, a collision occurs and the nodes that created the frames must retransmit.
- In the early 2000s the hub’s was switched with a switch. Which is “collision-less” but up through layer 3, a switch operates only up through layer 2.
- Ethernet Frame Structure:
- Data field (46 to 1500 bytes)
- This field carries the datagram.
- Maximum transmission unit of Ethernet is 1500 bytes.
- The minimum size is 47 bytes which means it has to be “stuffed” if the content is less than 47 bytes.
- The network layer uses the length field in the IP datagram header to remove the stuffin.
- Destination address (6 bytes)
- The field containing the MAC address to the destination adapter.
- Source address (6 bytes)
- The field containing the MAC address to the adapter sending the frame.
- Type field (2 bytes):
- Permits Ethernet to multiplex network-layer protocols.
- When the Ethernet frame arrives at adapter B, adapter B needs to know to which network-layer protocol it should pass the content of the data field. IP and other network-layer protocols each have their own, standardized type number.
- The ARP protocol has itws own type number, and if the arriving frame contains an ARP packet, the ARP packet will be demultiplexed up to the ARP protocol.
- Cyclic redundancy check (CRC) (4 bytes):
- Allows the receiving adapter to detect bit errors in the frame.
- Preamble (8 bytes):
- The Ethernet frame begins with an 8-byte preamble field.
- Each of the first 7 bytes of the preamble has a value of 10101010; the last byte is 10101011.
- The first 7 bytes of the preamble serve to “wake up” the receiving adapter and to synchronize their clocks to that of the sender’s clock.
- Why:
- Adapter A aims to transmit the frame at x Mbps/Gbps, depending on the type of Ethernet Lan. However, because nothing is absolutely perfect, adapter A will not transmit the frame at exactly the target rate; there will always be some drift from the target rate, a drift which is not known a priori by the other adapter on the LAN.
- A receiving adapter can lock onto adapter A’s clock simply by locking onto the bits in the first 7 bytes of the preamble.
- The last 2 bits of the eighth byte of the preamble alert adapter B that the “important stuff” is about to come.
- All of the Ethernet echnologies provide connectionless service to the network layer.
- That is, when adapter A wants to send a datagram to adapter B, adapter A encapsulates the datagram in an Ethernet frame and sends the frame into the LAN, without first handshaking with adapter B.
- Ethernet technologies provide an unreliable service to the network layer.
- Specifically, when adapter B receives a frame from adapter A, it runs the frame through a CRC check, but neither sends an acknowledgment when a frame passes the CRC check nor sends a negative acknowledgment when a frame fails the CRC check. When a frame fail.
- Does the application at Host B see gaps as well:
- Depends if it uses TCP or UDP who work as we have described in earlier chapters.
- Ethernet comes in many different types such as:
- 10Base-T
- 10Base-2
- 100Base-T
- 1000Base-LX
- 10GBase-T
- 40Base-T
- Many Ethernet technologies have been standardized over the years by the IEEE 802.3 CSMA/CD over the years.
- The first part of the acronym refers to the speed of the standard: 10, 100, 1000, or 10G. For 10 Megabit, 100 Megabit, Gigabit, 10 Gigabit and 40 Gigabit Ethernet, “BASE” refers to baseband Ethernet, meaning that the physical media only carries Ethernet traffic; almost all of the 802.3 standards are baseband Ethernet. The final part of the acronym refers to the physical media itself; Ethernet is both a link-layer and physical-layer specifications and is carried over a variety of physical media including coaxial cable, copper wire and fiber. Generally a “T” refers to twisted-pair copper wires.
- Historically, an Ethernet was initially conceived of as a segment of coaxial cable.
- The early 10Base-2 and 10Base-5 standards specify 10 Mbps over two types of coaxial cable each limited in length to 500m.
- A repeater: a physical-layer device that receives a signal on the input side, and regenerates the signal on the output side. A coaxial cable corresponds nicely to our view of Ethernet as a broadcast medium.
- In the mid-1990sEthernet was standardized at 100 Mbps. The original Ethernet MAC protocol and frame format were preserved, but higher-speed physical layers were defines for copper wire (100Base-T) and fiber (100Base-FX, 100BASE-SX, 100BASE-BX)
- 100 Mbps Ethernet is limited to a 100-meter distance over twisted pair, and to several KM over fiber.
- The standard for Gigabit Ethernet, referred to as IEEE 802.3z, does the following:
- Uses the standard Ethernet frame format and is backward compatible with 10BASE-T and 100BASE-T technologies. This allows for easy integration of Gigabit Ethernet with the existing installed base of Ethernet equipment.
- Allows for point-to-point links as well as shared broadcast channel. Point-to-point links use switches while broadcast channel use hubs, as described earlier. In Gigabit Ethernet jargon, hubs are called buffered distributors.
- Uses CSMA/CD for shared broadcast channels. In order to have acceptable efficiency, the maximum distance between nodes must be severely restricted.
- Allows for full-duplex operation at 40 Gpbs in both directions for point-to-point channels.
- If the prevalent use of Ethernet today is a switch-based star topology, using store-and-forward packet switching, is there really a need for an Ethernet MAC protocol:
- Switch coordinates its transmissions and never forwards more than one frame onto the same interface an any time.
- Modern switches are full-duplex, so that a switch and a node can each send frames to each other at the same time without interference.
- Thus switch-based Ethernet LAN there are no collisions and, therefore, no need for a MAC protocol.
6.4.3 – Link-Layer Switches
- The rate at which frames arrive to any one for the switches’ output interfaces may temporarily exceed the link capacity of that interface. To accommodate this problem, switch output interfaces have buffers, in much the same way that router output interfaces have buffers for datagram.
- Filtering is the switch function that determines whether a frame should be forwarded to some interface or should just be dropped.
- Forwarding is the switch function that determines the interfaces to which a frame should be directed, and then moves the frame to those interfaces.
- Switch filtering and forwarding are done witch a switch table.
- It contains:
- A MAC address
- The switch interface that leads toward that MAC address
- The time at which the entry was placed in the table.
- Suppose a frame with destination address DD-DD-DD-DD-DD-DD arrives at the switch on interface x. The switch indexes its table with the MAC address. There are 3 possible cases:
- There is no entry in the table for DD-DD-DD-DD-DD-DD. The switch forwards copies of the frame to the output buffers preceding all interfaces except for interface x. In other word, if there is no entry for the destination address, the switch broadcasts the frame.
- There is an entry in the table. In this case, the frame is coming from a LAN segment that contains adapter DD-DD-DD-DD-DD-DD. There being no need to forward the frame to any other interfaces, the switch performs the filtering function by discarding the frame.
- There is an entry in the table, associating DD-DD-DD-DD-DD-DD with interface y≠x. In this case, the frame needs to be forwarded to the LAN segment attached to interface y. The switch performs its forwarding function by putting the frame in an output buffer that precedes interface y.
- A switch’s table is built automatically , dynamically and autonomously. The switch is self-learning. This capability is accomplished as follows:
- The switch table is initially empty
- For each incoming frame received on an interface, the switch stores in its table: (1) The MAC address in the frame’s source address field (2) The interface from which the frame arrived (3) The current time. In this manner the switch records in its table the LAN segment on which the sender resides. If every host in the LAN eventually sends a frame, then every host will eventually get recorded in the table.
- The switch deletes and address in the table if no frames are received with that address as the source address after some period of time (the aging time). In this manner, if a PC is replaced by another PC, the MAC address of the original PC will eventually be purged from the switch table.
- Switches are plug-and-play devices because they require no intervention from a network administrator or user.
- Switches are full-duplex, meaning any switch interface can send and receive at the same time.
- Advantages of using switches:
- Elimination of collisions:
- The switches buffer frames and never transmit more than one frame on a segment at any one time. As with router, the maximum aggregate throughput of a switch is the sum of all the switch interface rates. Thus, switches provide a significant performance improvement over LANs with broadcast links.
- Heterogeneous links:
- Because a switch isolates one link from another, the different links in the LAN can operate at different speeds and can run over different media.
- F.ex. A switch might have three 1 Gbps 100BASE-T copper links, two 100 Mbps 100BASE-FX fiber link, and one 100BASE-T copper link. Thus, a switch is ideal for mixing legacy equipment with new equipment.
- Management:
- In addition to providing enhanced security, a switch also eases network management.
- F.ex. If an adapter malfunctions and continually sends Ethernet frames, a switch can detect the problem and internally disconnect the malfunctioning adapter.
- F.ex. A cable cut disconnects only that host that was using the cut cable to conencto to the switch.
- Switches also gather statistics on bandwidth usage, collision rates, and traffic types, and make this information available to the network manager.
- Switches use “match plus action” operation that can be used to forward a layer-2 frame based on the frame’s destination MAC address, as well as a layer-3 datagram using the datagram’s destination IP address.
- Switches using the OpenFlow standard can perform generalized packet forwarding based on any of eleven different frame, datagram, and transport-layer header fields.
- Given that both switches and routers are candidates for interconnecting devices, what are the pros and cons of the two approaches?
- Consider the pros and cons of switches:
- They are plug-and-play.
- They can have relatively high filtering and forwarding rates.
- To prevent the cycling of broadcast frames, the active topology of a switched network is restricted to a spanning tree.
- A large switched network would require large ARP tables in the hosts and routers and would generate substantial ARP traffic and processing.
- Switches are susceptible to broadcast storms, if one host goes haywire and transmits an endless stream of Ethernet broadcast frames, the switches will forward all of these frames, causing the entire network to collapse.
- Consider the pros and cons of routers:
- Packets are not restricted to a spanning tree and can use the best path between source and destination. Because routers do not have the spanning tree restriction, they have allowed the Internet to be built with a rich topology that includes, for example, multiple active links between Europe and North America.
- They provide firewall protection against layer-2 broadcast storms.
- They are not plug-and-play, they and the hosts that connect to them need their IP addresses to be configured.
- Routers often have a larger per-packet processing time than switches, because they have to process up through the layer-3 fields.
- Typically, small networks consisting of a few hundred hosts have a few LAN segments. Switches suffice for these small networks, as they localize traffic and increase aggregate throughput without requiring any configuration of IP addresses.
- Typically, larger networks consisting of thousands of hosts typically include routers within the network (in addition to switches). The routers provide a more robust provide a more robust isolation of traffic, control broadcast storms, and use more “intelligent” routes among the hosts in the network.