허브 & 스위치 & 라우터

작성자

카테고리:

← 피드로
DEV Community · MinBapE · 2026-08-05 개발(SW)

MinBapE

1. Hub vs Switch

Both let LAN end hosts (PCs, servers, printers) plug in over Ethernet and talk to each other. The difference is the layer they operate at and how much they know.

Hub Switch Operates at Layer 1 Layer 2 (and Layer 1) MAC addresses Not aware Aware Duplex half-duplex only full-duplex capable, always full in practice Simultaneous send/receive No, one or the other Yes Collision Domain All hosts share one Dedicated per port Collision Detection Required, CSMA/CD detects then retransmits Not required Frame handling Floods every port except the one it came in on Sends to the destination port only (once learned)

2. How a Switch Works

Step Behavior Learning On receiving a frame, record the Source MAC from the Ethernet header against the receiving port in the MAC address table Forwarding If the Destination MAC is in the table, send only out that port Flooding If the destination is a broadcast or an unknown unicast, send out every port except the one it arrived on

There are only two flooding conditions: broadcast, or unknown unicast.

Sending only to the destination port helps both performance and security. The frame goes where it’s needed, so other hosts don’t spend cycles on it and never see traffic that isn’t theirs. A hub does the opposite: it sprays every port, so every host has to process every frame.

3. Router

  • Knows the paths to the various IP subnets on the network
  • Sending traffic from one subnet to another always requires a router
  • Operates at Layer 3 (also at Layers 2 and 1, and usually aware up to Layer 7)
Router Switch Aware at Layer 3 Layer 2 Role Routing between different networks Switching between hosts on a LAN Interfaces Varied: Ethernet, Serial, ISDN, ADSL Usually Ethernet only Port count Few Many Broadcasts Not forwarded by default Forwarded

Hosts in the same subnet (10.10.10.x) talk through a switch alone, but the moment another subnet (10.10.11.x) is involved a router is required.

Layer 3 Switch

  • Higher-end switches are Layer 3 aware and can route between IP subnets
  • Interfaces are still Ethernet only, and port count is higher than a router’s
  • Typical build: a Layer 3 Switch routes between internal subnets, a router handles the WAN

A Layer 3 Switch is a switch with router functions.

4. Summary

  • Hub is L1, half-duplex, one collision domain, no MAC awareness → always floods
  • Switch is L2, full-duplex, per-port collision domains, keeps a MAC address table
  • Learning uses the Source MAC, forwarding uses the Destination MAC
  • Flooding happens on broadcast or unknown unicast (out every port but the ingress one)
  • Many MACs per port is fine, one MAC on many ports is not
  • A router is required for inter-subnet traffic. Varied interfaces, few ports, no broadcast forwarding
  • A Layer 3 Switch can route but has Ethernet interfaces only

원문에서 계속 ↗

추출 본문 · 출처: dev.to · https://dev.to/min38/hub-switch-router-4g82

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다