Salta al contenuto
Note per Studenti Network Devices - Hub, Switch and Router Report

Network Devices - Hub, Switch and Router

In questa pagina 5

A real network is made of different segments (LANs) joined by different devices, e.g. three LANs connected by hubs, switches, bridges and a router toward the Internet. Each device is defined by the highest layer of the stack it implements (ISO-OSI Model and TCP-IP StackCommunication between two computers is too varied a problem (signals, errors, medium access, routing, flow control, data representation) for a single protocol, so it is divided into layers. The ISO/OSI model has 7 layers (physical, data link, network, transport, session, presentation, application); the TCP/IP stack merges the top three into one application layer, so it has 5. Each layer offers a service to the one above and talks only to its peer layer through PDUs; going down a header (PCI) is added: encapsulation. Addresses: MAC (link, local), IP (network, global), port (transport).ISO-OSI Model and TCP-IP Stack →): the higher it goes, the more it "understands" of the packet and the more decisions it can take.

Hub (layer 1, physical)

Definition (hub). Device working only at the physical layer: it has no link-layer (MAC) addresses. Physically it is a star, but it behaves as a repeater: it is a connection point and regenerates and retimes the original bit sequence (the signal is attenuated and distorted along the cable, hence beyond a certain length it must be regenerated).

Example. 44 stations on a 100100 Mbit/s hub: there is a single channel. If all transmit all the time, each gets on average 100/4=25100/4=25 Mbit/s (capacity split equally: the shared link of Network Performance AnalysisNetwork performance is measured by traffic metrics (bitrate R0, the link maximum; throughput S <= R0, data delivered successfully; goodput at the application layer), delay (end-to-end d = d_proc + d_queue + d_trans + d_prop with d_trans = L/R and d_prop = d/v; jitter; RTT), pipe capacity (BDP = rate times delay) and reliability (PER, PDR, PLR). The throughput of a path is that of its bottleneck link, the minimum bitrate, remembering that shared links split their capacity.Network Performance Analysis →), and two pairs A→BA\to B and C→DC\to D cannot communicate in parallel. Moreover, since the medium is shared, the efficiency limits of random access apply (Performance of Multiple Access ProtocolsWith Poisson arrivals, the success probability of a frame is the probability that no other frame arrives in the vulnerable time: pure ALOHA P_S = e^(-2G), throughput S = G e^(-2G) with maximum 1/(2e) = 0.18 at G = 1/2; slotted ALOHA S = G e^(-G) with maximum 1/e = 0.37 at G = 1; non-persistent CSMA with a = tau_p/t_F: S = G e^(-aG) / (G(1+2a) + e^(-aG)), which tends to 1 as a tends to 0 but collapses for large a, where slotted ALOHA is better. For TDMA (M/D/1) E[T] = t_F (N_u/2 + S N_u / (2(1-S)) + 1 + a) and for FDMA E[T] = t_F (N_u + S N_u / (2(1-S)) + a): FDMA is slower by t_F (N_u/2 - 1).Performance of Multiple Access Protocols →): the useful throughput is below 100100 Mbit/s even at maximum load.

Bridge (layer 2)

Definition (bridge). Data-link device (an "intelligent" hub) that splits the network into two subnetworks (LANs) to reduce traffic in each or for security, managing the flow between them.

Advantage: it reduces traffic on a segment: if the destination is not on the other side of the bridge, the bridge blocks the frame. It usually connects very few networks (typically two).

Switch (layer 2)

Definition (switch). Device working at the physical and link layers (a more flexible bridge). It has filtering capability: it checks the destination MAC address of each frame and decides which port to send it out of, using a local table called forwarding/filtering database (FDB), associating MAC addresses (48 bit: Data Link Layer and FramingThe data link layer (DLL) delivers a frame from a node to an adjacent node over a link. Services: framing, medium access (MAC) with 48-bit MAC addresses, flow control, error detection and correction. It splits into DLC (framing, error and flow control) and MAC (shared medium access). Framing delimits frames with a flag: byte-oriented protocols (8-bit flag, ESC) use byte stuffing, bit-oriented ones (flag 01111110) use bit stuffing, which inserts a 0 after every five consecutive 1s.Data Link Layer and Framing →) with ports.

The first tables were static: if a station was added or removed the table had to be edited by hand, so they were impractical. The solution is a dynamic table that builds itself, i.e. a learning switch:

  • the destination address of the frame is used for the forwarding decision (table lookup);
  • the source address is used to add or update table entries: "the station with this MAC sits behind the port the frame came from".

Forwarding rule for a frame arriving from port pp:

  1. learn: entry (source MAC →p\to p);
  2. if the destination MAC is in the table with port qq: if q=pq=p discard (destination on the same segment), otherwise forward only on qq;
  3. if the destination is not in the table or is broadcast (FF:FF:FF:FF:FF:FF): forward on all ports except pp (flooding).

Example. A 33-port switch with AA on port 1, BB on 2, CC on 3 and an empty table.

Frame Action Table afterwards
A→BA\to B learn A@1A@1; BB unknown ⇒\Rightarrow flooding on ports 2 and 3 A@1A@1
B→AB\to A learn B@2B@2; AA known ⇒\Rightarrow only port 1 (CC sees nothing) A@1, B@2A@1,\ B@2
A→BA\to B BB known ⇒\Rightarrow only port 2 unchanged
C→AC\to A learn C@3C@3; AA known ⇒\Rightarrow only port 1 A@1,B@2,C@3A@1,B@2,C@3

Entries normally expire, so the table follows stations that change port. The switch works in full-duplex mode and is not a shared medium: several pairs of stations communicate in parallel and non-flooded frames do not reach those they do not concern (fewer collisions, more security).

Example. In the same scenario as the hub (44 stations at 100100 Mbit/s) with a switch, A→BA\to B and C→DC\to D run in parallel, each at 100100 Mbit/s: 2⋅100=2002\cdot100=200 Mbit/s overall. With kk flows between different pairs the hub stays at 100100 Mbit/s in total, the switch reaches 100 k100\,k.

Grafico interattivo: Overall capacity with k simultaneous flows between different pairs of stations on 100 Mbit/s ports: the hub stays at 100 Mbit/s (shared medium), the switch reaches 100*k (200 Mbit/s with k = 2)

The switch implements a different switching paradigm depending on how it forwards (circuit, packet with virtual circuit or datagram): see Circuit Switching and Packet SwitchingA switching node can connect input to output in three ways. Circuit switching sets up a dedicated physical connection first (telephone network), delivery time T = 3N t_p + N t_s + M/R. Datagram packet switching splits the message into K packets with a header, each routed independently with store-and-forward, T = N t_p + (N+K-1)(M/K+H)/R, with optimal K = sqrt((N-1)M/H). Virtual circuit has three phases (setup, data, teardown): a dedicated logical connection without dedicated resources, with a local identifier that changes at each hop.Circuit Switching and Packet Switching →.

Router (layer 3)

Definition (router). Device working at three layers (physical, link, network): it regenerates the signal (PHY), checks the source and destination physical addresses of the frame (DLL) and checks network addresses (network layer). It is the "gateway" of a network and interconnects independent networks forming an internetwork (INTERNET).

The router reads the destination IP address, consults its routing table to learn the next node, finds that node's MAC address with ARP (ARP - Address Resolution ProtocolTo place an IP datagram in a frame a node needs the MAC address of the next hop, obtained with ARP: a broadcast request (destination MAC FF:FF:FF:FF:FF:FF, carrying the sender's IP and MAC and the wanted IP) and a unicast reply with the wanted MAC, stored in the ARP cache; ARP always resolves the next hop (destination host or router), never the final destination, and since broadcasts do not leave the subnet a router can answer with its own MAC (proxy ARP).ARP - Address Resolution Protocol →) and builds a new frame for the next hop. It creates paths (routes) to send packets and is more sophisticated: it may have software to raise throughput (e.g. with a cache).

Comparison

Hub Bridge Router Switch
Layer 1 2 3 2
Traffic isolation no yes yes yes
Plug and play yes yes no yes
Optimal routing no no yes no
"Intelligent" device no yes yes yes
  • Switch versus hub. The hub is a shared-medium device: it broadcasts data to all ports, one station transmits at a time. The switch is not shared, it sends a frame with known destination only to the right port.
  • Switch versus bridge. The bridge connects fewer LANs (usually 22) than the switch.
  • Switch (hub) versus router. Switch and hub connect devices of the same network (they do not see IP addresses); the router connects different networks by looking at IP addresses. The router uses IP addresses, the switch MAC addresses, the hub looks at nothing (it is a repeater).
  • Why the router is not plug and play: it needs network IP addresses assigned and routing tables (static or learned).

Versione ripasso

Frame Action Table afterwards
A→BA\to B learn A@1A@1; BB unknown: flooding on 2 and 3 A@1A@1
B→AB\to A learn B@2B@2; AA known: only port 1 A@1, B@2A@1,\ B@2
  • Full-duplex switch. Not shared: A→BA\to B and C→DC\to D in parallel, 200200 Mbit/s overall with 4 stations at 100 Mbit/s. Non-flooded frames do not reach unconcerned stations.
  • Router (L3). Reads the destination IP, consults the routing table, finds the next hop's MAC with ARP and builds a new frame for that hop. Interconnects independent networks (internetwork).
  • Comparison. Traffic isolation: hub no, others yes. Plug and play: all except the router, which needs IPs and tables. Optimal routing: only the router.
  • Switch and hub versus router. They connect devices of the same network (the switch looks at MACs, the hub at nothing). The router connects different networks by looking at IPs.
  • Typical mistakes: the switch looks at MACs, not IPs; the hub does not filter; on a hub two pairs cannot communicate in parallel.

Teoria collegata