Giới thiệu & Cách mạng hoạt độngIntroduction & How Networks Work
Thuộc bộ kiến thức Network Engineer Roadmap.
Tổng quan
Một network (mạng máy tính) là tập hợp các thiết bị trao đổi dữ liệu qua các đường truyền dùng chung theo những quy tắc thống nhất (protocol). Network là thứ biến các máy đơn lẻ thành một hệ thống hữu ích khi kết hợp: cho phép một chiếc laptop nói chuyện với một web server ở nửa kia địa cầu, cho phép các microservice trong data center gọi lẫn nhau, và cho phép điện thoại xem video qua đường cellular.
Note này là nền tảng cho phần còn lại của Network Engineer roadmap. Nó trả lời ba câu hỏi thực tế:
- Về mặt cấu trúc, network gồm những gì? — các node, link và vai trò cấu thành mọi network.
- Internet là gì, và điều gì thực sự xảy ra khi bạn tải một trang web? — hành trình end-to-end từ lúc gõ URL đến khi thấy pixel trên màn hình, đi qua ISP, IP, DNS, TCP, TLS và HTTP.
- Network engineer làm gì, và nên học lĩnh vực này thế nào? — vai trò, tư duy, và cách xây dựng mental model bền vững thay vì học thuộc lòng.
Toàn bộ nội dung ở đây cố ý giữ ở mức tổng quan và mang tính kết nối. Các tầng sâu hơn có topic riêng: mô hình OSI/TCP-IP ở ./03-network-models-and-layers.md, và performance (bandwidth/latency/throughput/QoS) ở ./13-traffic-management-and-qos.md.
Kiến thức nền tảng
Network được tạo thành từ đâu
Mọi network, từ hai chiếc laptop chia sẻ file cho tới internet toàn cầu, đều được dựng từ cùng một nhúm thành phần cơ bản.
| Thuật ngữ | Ý nghĩa | Ví dụ |
|---|---|---|
| Node | Bất kỳ thiết bị nào tham gia network (có thể gửi, nhận, hoặc chuyển tiếp dữ liệu) | Laptop, điện thoại, server, router, switch, máy in |
| Host | Một node là điểm cuối — nơi khởi tạo hoặc tiêu thụ dữ liệu, thay vì chỉ chuyển tiếp | Laptop của bạn, một web server |
| Link | Kết nối (môi trường truyền) giữa hai node | Cáp Ethernet, sóng Wi-Fi, cáp quang, cellular |
| Client | Host yêu cầu một dịch vụ | Trình duyệt của bạn yêu cầu một trang |
| Server | Host cung cấp dịch vụ và trả lời các yêu cầu | Một HTTP server, một database |
| Router | Node chuyển tiếp packet giữa các network khác nhau dựa trên IP address | Router ở nhà, core router của ISP |
| Switch | Node chuyển tiếp frame trong một network cục bộ dựa trên MAC address | Switch trong tủ đấu dây văn phòng |
Có hai cặp vai trò cần làm rõ vì chúng hay gây nhầm lẫn nhất:
- Client và server là vai trò, không phải loại thiết bị. Cùng một máy có thể là client trong cuộc hội thoại này và là server trong cuộc khác. Một web server là “server” đối với trình duyệt, nhưng lại là “client” khi nó query database.
- Router và switch khác nhau ở phạm vi. Switch kết nối các thiết bị bên trong một network (một LAN) và chuyển tiếp dựa trên MAC address ở Layer 2. Router kết nối các network khác nhau và chuyển tiếp dựa trên IP address ở Layer 3. Cái hộp “router” ở nhà bạn thường là router + switch + Wi-Fi access point + firewall gộp lại.
Network topology (cách các node kết nối)
Topology mô tả hình dạng của các kết nối. Physical topology là cách đi dây thực tế; logical topology là cách dữ liệu thực sự chảy.
| Topology | Hình dạng | Đánh đổi |
|---|---|---|
| Star | Mọi node nối vào một switch/hub trung tâm | Đơn giản, dễ quản lý; thiết bị trung tâm là single point of failure. Phổ biến nhất trong văn phòng. |
| Mesh | Node nối tới nhiều node khác | Rất bền (nhiều đường đi); đi dây tốn kém. Lõi internet là một partial mesh. |
| Bus | Mọi node dùng chung một cáp backbone | Rẻ, cũ; đứt một chỗ là hỏng tất cả. Hầu như đã lỗi thời. |
| Ring | Mỗi node nối với hai node hàng xóm tạo thành vòng | Dễ dự đoán; đứt một chỗ có thể chia đôi vòng (khắc phục bằng dual ring). Dùng trong một số network metro/cáp quang. |
Phạm vi network (theo kích thước)
- LAN (Local Area Network) — một tòa nhà hoặc một tầng, ví dụ văn phòng hoặc nhà.
- WLAN — một LAN dùng Wi-Fi.
- MAN (Metropolitan Area Network) — network quy mô thành phố, thường là cáp quang metro của ISP.
- WAN (Wide Area Network) — trải rộng qua nhiều thành phố/quốc gia; internet là WAN lớn nhất.
Địa chỉ public và private
Không phải thiết bị nào cũng có địa chỉ duy nhất toàn cầu. Các dải private IP (RFC 1918: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) được tái sử dụng trong vô số network nhà và văn phòng. Router thực hiện NAT (Network Address Translation) để nhiều host private cùng chia sẻ một public IP khi đi ra internet.
# Xem private IP và các interface của bạn (Linux)
ip addr show
# hoặc xem route/gateway kiểu cổ điển
ip route show # default via 192.168.1.1 dev wlan0 ...
# Tìm public IP mà internet thực sự thấy về bạn
curl -s https://ifconfig.me
Khái niệm chính
Internet là gì
Internet không phải một network — nó là một network của các network: hàng chục nghìn network vận hành độc lập (gọi là Autonomous System, mỗi cái có một ASN) đồng ý kết nối và định tuyến traffic cho nhau. Không có chủ sở hữu trung tâm; nó hoạt động được vì mọi bên đều nói chung các protocol lõi (IP, TCP, UDP, DNS, BGP) và thống nhất cách trao đổi traffic.
ISP và các tier. Việc truy cập internet được phân thành các tầng (tier):
| Tier | Vai trò |
|---|---|
| Tier 1 | Nhà cung cấp backbone toàn cầu, tới được mọi network khác mà không phải trả tiền transit cho ai; họ peer với nhau miễn phí. |
| Tier 2 | ISP khu vực/quốc gia, peer ở nơi có thể nhưng mua transit từ Tier 1 để với tới phần còn lại của thế giới. |
| Tier 3 | ISP “last-mile” cục bộ, bán truy cập cho hộ gia đình và doanh nghiệp, và mua transit từ tuyến trên. |
Peering và transit. Hai network peer khi chúng trao đổi traffic của nhau trực tiếp (thường miễn phí, tại một Internet Exchange Point / IXP). Một network mua transit khi trả tiền cho một nhà cung cấp lớn hơn để chuyển traffic của mình tới phần còn lại của internet. BGP (Border Gateway Protocol) là protocol các network dùng để quảng bá những dải IP mà chúng có thể với tới, nhờ đó packet tìm được đường đi xuyên suốt cả hệ thống.
IP address — hệ thống bưu chính của internet
Mọi host truy cập được trên internet đều có một IP address. Router dùng nó để chuyển tiếp packet từng chặng (hop) hướng về đích.
| IPv4 | IPv6 | |
|---|---|---|
| Kích thước | 32-bit | 128-bit |
| Ví dụ | 93.184.216.34 | 2606:2800:220:1:248:1893:25c8:1946 |
| Số lượng địa chỉ | ~4,3 tỷ (đã cạn) | ~3,4×10³⁸ (gần như vô hạn) |
| Ký hiệu | Thập phân có dấu chấm | Hex ngăn cách bằng dấu hai chấm |
Các địa chỉ được gom thành subnet bằng ký hiệu CIDR (ví dụ 192.168.1.0/24 = 256 địa chỉ). Phần /24 là độ dài prefix: bao nhiêu bit đầu xác định network so với host. Subnetting sẽ được đào sâu ở một topic sau; ý chính bây giờ là router ra quyết định dựa trên network prefix, không phải từng host riêng lẻ.
Packet và packet switching
Dữ liệu không truyền đi dưới dạng một dòng liên tục trên đường truyền. Nó được cắt thành các packet — những đơn vị nhỏ, tự chứa, mỗi cái mang một mẩu dữ liệu cộng với các header ghi địa chỉ nguồn/đích và thông tin điều khiển.
Packet switching và circuit switching:
| Circuit switching | Packet switching | |
|---|---|---|
| Mô hình | Dành riêng một đường end-to-end cho cả phiên | Dữ liệu chia thành packet, mỗi packet định tuyến độc lập |
| Ví dụ kinh điển | Mạng điện thoại cũ (PSTN) | Internet |
| Dùng tài nguyên | Giữ chỗ bandwidth ngay cả khi rảnh → lãng phí | Dùng chung link, statistical multiplexing → hiệu quả |
| Độ bền | Đứt bất kỳ link nào trên đường là đứt cả circuit | Packet đi vòng qua chỗ hỏng |
| Thứ tự/mất gói | Đảm bảo thứ tự, không mất (khi đã thiết lập) | Packet có thể đến sai thứ tự, trùng, hoặc mất — tầng trên xử lý |
Packet switching là lý do internet vừa bền vừa tiết kiệm: nhiều cuộc hội thoại dùng chung link, và nếu một router hay sợi cáp chết, BGP cùng các routing table sẽ lái packet vòng qua chỗ hỏng.
Encapsulation (ý tưởng ở mức tổng quan)
Khi dữ liệu đi xuống stack ở phía gửi, mỗi tầng bọc nó bằng header của riêng mình (đôi khi cả trailer). Việc lồng nhau này gọi là encapsulation. Ở phía nhận, mỗi tầng gỡ header của mình (decapsulation) khi đi lên.
- 01Dữ liệu Applicationví dụ một HTTP request
- + TCP header (thêm port, sequence number)02Segment
- + IP header (thêm IP nguồn/đích)03Packet
- + Ethernet header+trailer (thêm MAC address, checksum)04Frame
- 05bit trên đường truyền
Mỗi tầng chỉ “nói chuyện” với tầng tương ứng của nó ở host bên kia, và không quan tâm các tầng dưới mang dữ liệu đi thế nào. Mô hình phân tầng này là chủ đề của ./03-network-models-and-layers.md.
End-to-end: điều gì xảy ra khi bạn tải một trang web
Đây là mental model giá trị nhất trong networking. Giả sử bạn gõ https://example.com rồi nhấn Enter.
1. Phân tích URL. Trình duyệt tách URL thành scheme (https), host (example.com) và path (/). HTTPS ngầm định port 443.
2. DNS resolution — tên → IP. Trình duyệt cần IP address của example.com. Nó kiểm tra các cache (trình duyệt, OS, resolver cục bộ), rồi một recursive resolver (thường của ISP hoặc 1.1.1.1/8.8.8.8) đi qua cây phân cấp DNS: root server → TLD server .com → authoritative nameserver của example.com, nơi trả về IP.
# Xem một lượt DNS lookup phân giải tên thành địa chỉ
dig example.com +short
# 93.184.216.34
# Xem đường recursive đầy đủ và chi tiết record
dig example.com
# Truy vết ủy quyền (delegation) từ root xuống (root → .com → authoritative)
dig +trace example.com
3. Định tuyến tới server. Đã biết IP đích, host của bạn dựng các packet. Nó so sánh IP đích với subnet của chính mình: nếu là cục bộ thì gửi thẳng; nếu không (ở đây thì không) thì gửi tới default gateway (router của bạn). Từ đó mỗi router tra routing table của mình và chuyển tiếp packet hướng về đích, từng hop một, xuyên qua các ISP và backbone của internet.
# Xem từng hop router giữa bạn và đích
traceroute example.com # Linux/macOS
# hoặc kiểm soát nhiều hơn:
traceroute -I example.com # dùng ICMP echo thay vì UDP
# Kiểm tra nhanh khả năng tới được + round-trip time
ping example.com
# 64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=11.3 ms
4. TCP handshake — thiết lập kết nối tin cậy. Trước khi có bất kỳ dữ liệu HTTP nào, TCP thực hiện three-way handshake với server trên port 443:
Bây giờ cả hai phía đã có một kênh byte-stream tin cậy, đúng thứ tự. (Với một số loại traffic như DNS hay video, người ta dùng UDP — không kết nối, không handshake, không đảm bảo giao gói, nhưng overhead thấp hơn.)
5. TLS handshake — thiết lập mã hóa. Vì đây là HTTPS, TLS thương lượng bên trên TCP: client và server thống nhất một cipher, server trình certificate (chứng minh nó đúng là example.com, được ký bởi một CA đáng tin cậy), rồi hai bên dẫn xuất ra các session key chung. Sau bước này, mọi thứ đều được mã hóa.
6. HTTP request/response. Cuối cùng trình duyệt gửi một HTTP request qua kênh đã mã hóa và server trả lời:
# Xem toàn bộ quá trình: DNS, TCP connect, TLS handshake, HTTP request + response header
curl -v https://example.com
# * Connected to example.com (93.184.216.34) port 443
# * TLS handshake, ... TLSv1.3
# > GET / HTTP/2
# > Host: example.com
# < HTTP/2 200
# < content-type: text/html; charset=UTF-8
7. Render. Trình duyệt phân tích HTML nhận về, phát hiện cần thêm CSS, JS, ảnh — và lặp lại bước 2–6 (thường tái sử dụng kết nối và DNS đã cache) cho từng tài nguyên bổ sung, rồi vẽ trang.
Mỗi bước trong số đó đều là một chỗ có thể hỏng, và chẩn đoán được bước nào hỏng (DNS? routing? TCP? TLS? hay chính app?) là cơm bữa của một network engineer.
Vai trò của network engineer
Một network engineer thiết kế, xây dựng, vận hành, bảo mật và troubleshoot các network mà mọi thứ khác chạy trên đó. Phạm vi trải từ LAN của campus/văn phòng, tới fabric của data center, tới network ISP/WAN, tới cloud networking (VPC, load balancer, VPN).
Trách nhiệm hằng ngày điển hình:
- Thiết kế & lập kế hoạch — sơ đồ IP addressing, subnetting/VLAN, topology, hoạch định dung lượng, dự phòng.
- Cấu hình & triển khai — router, switch, firewall, load balancer, VPN, wireless.
- Vận hành & giám sát — theo dõi mức sử dụng link, latency, packet loss, lỗi; phản ứng với cảnh báo.
- Troubleshoot — kỹ năng cốt lõi: cô lập một cách có phương pháp chỗ nào trên đường đi đang có vấn đề (physical, link, IP, transport, hay application).
- Bảo mật — firewall rule, ACL, phân đoạn (segmentation), VPN; giảm bề mặt tấn công.
- Tự động hóa & tài liệu — ngày càng dùng các công cụ như Ansible/Terraform, Python, và config được quản lý bằng version control.
- Phối hợp — với sysadmin, developer, đội security, và các vendor.
Tư duy và kỹ năng:
- Troubleshoot có hệ thống — đặt giả thuyết, kiểm chứng, thu hẹp vùng lỗi. Câu “Là DNS đấy à?” thành meme vì nó đúng thật quá thường xuyên.
- Tư duy phân tầng — luôn biết mình đang lập luận ở tầng nào (xem ./03-network-models-and-layers.md).
- Cẩn thận tới từng chi tiết — một subnet mask sai hay một dòng ACL sai là đủ để sập cả dịch vụ.
- Thành thạo CLI và đọc được các bản capture protocol (tcpdump/Wireshark).
- Biết tự động hóa — network hiện đại được quản lý như code.
Cơ bản về performance: bandwidth, latency, throughput
Ba thuật ngữ hay bị nhầm lẫn; xử lý sâu hơn (cùng QoS) nằm ở ./13-traffic-management-and-qos.md.
| Thuật ngữ | Định nghĩa | Ẩn dụ (một cái ống nước) | Đơn vị |
|---|---|---|---|
| Bandwidth | Dung lượng tối đa của một link — lượng dữ liệu có thể chảy mỗi giây | Đường kính của ống | bps, Mbps, Gbps |
| Throughput | Tốc độ dữ liệu thực tế đạt được trong thực tế | Lượng nước thực sự đang chảy | bps, Mbps, Gbps |
| Latency | Thời gian một packet đi từ nguồn → đích | Một giọt nước mất bao lâu để đi hết ống | ms |
Vài trực giác quan trọng:
- Bandwidth ≠ tốc độ (cảm nhận). Một link “béo” (bandwidth cao) mà latency cao thì vẫn thấy chậm với các tác vụ tương tác/nhiều round-trip. Bandwidth giúp truyền khối lượng lớn; latency mới quyết định độ mượt phản hồi.
- Throughput ≤ bandwidth, luôn luôn — bị giảm bởi nghẽn (congestion), packet loss, overhead của protocol, và latency (window của TCP giới hạn throughput trên các link latency cao).
- RTT (round-trip time) là thứ mà
pingbáo về — latency cả đi lẫn về. - Jitter là độ biến thiên của latency; nó hại traffic thời gian thực (voice/video) hơn là latency thuần túy.
# Latency / RTT
ping -c 5 example.com
# Ước lượng thô dung lượng/throughput một chiều giữa hai host bạn kiểm soát
iperf3 -c <server-ip> # chạy `iperf3 -s` ở phía server trước
Best Practices
Cho việc học lĩnh vực này
- Xây mental model, đừng học thuộc. Hiểu tại sao DNS lại phân cấp hay tại sao TCP cần handshake; các con số và câu lệnh cụ thể sẽ tự đến sau. Cái bạn hiểu thì khôi phục được; cái học vẹt thì rơi rụng dần.
- Neo mọi thứ vào mô hình phân tầng. Khi học một protocol mới, hãy hỏi: nó ở tầng nào, nó bọc cái gì, cái gì bọc nó? (Xem ./03-network-models-and-layers.md.)
- Luôn kể được hành trình của một packet. Nếu bạn thuật lại được toàn bộ vòng đời “tải một trang web” ở trên từ trí nhớ, nghĩa là bạn đã nắm cái lõi. Hãy dẫn lại nó cho tới khi thành phản xạ.
- Học thứ tự troubleshoot. Từ dưới lên: link có up không (
ip link)? có IP chưa (ip addr)? tới được gateway không (ping)? DNS phân giải được không (dig)? route có thông không (traceroute)? app có trả lời không (curl -v)? - Làm lab thực hành. Đọc thôi là chưa đủ. Luyện tập an toàn với:
- Chính máy của bạn:
ip,ping,traceroute,dig,curl -v,tcpdump. - Lab ảo: GNS3, Cisco Packet Tracer, Containerlab, hoặc
netns/vethtrên Linux để dựng topology mà không cần phần cứng. - Cloud VPC: dựng subnet, route table và security group trên AWS/GCP để thấy cùng những khái niệm đó trong bối cảnh hiện đại.
- Chính máy của bạn:
- Capture và đọc traffic thật. Chạy
tcpdump/Wireshark một lần, xem một TCP handshake và DNS query thật bay qua, dạy được nhiều hơn cả một chương sách.
Cho việc thực hành networking
- Lập kế hoạch addressing trước khi dựng. Quyết định subnet, dải địa chỉ và cách đặt tên ngay từ đầu; sửa lại sơ đồ IP về sau rất đau.
- Ghi tài liệu topology và các thay đổi. Sơ đồ và change log biến một sự cố lúc 3 giờ sáng từ hoảng loạn thành một lần tra cứu.
- Ưu tiên dự phòng tại các điểm nghẽn. Single point of failure (một router, một uplink) sớm muộn cũng sẽ hỏng.
- Giám sát bốn tín hiệu vàng của một link: mức sử dụng (utilization), latency, mất gói (loss), và lỗi (errors).
- Tự động hóa các config lặp đi lặp lại, và giữ config trong version control để thay đổi có thể review và hoàn tác được.
Tài liệu tham khảo
- Cloudflare — What is the Internet? / How does the Internet work?
- Cloudflare — What is a computer network?
- MDN — How does the Internet work?
- MDN — What happens when you navigate to a URL? (Overview of HTTP)
- RFC 1122 — Requirements for Internet Hosts
- RFC 9293 — Transmission Control Protocol (TCP)
- RFC 1918 — Address Allocation for Private Internets
- roadmap.sh — Network Engineer Roadmap
Part of the Network Engineer Roadmap knowledge base.
Overview
A computer network is a set of computing devices that exchange data over shared communication links according to agreed-upon rules (protocols). Networks are what turn isolated machines into something useful together: they let a laptop talk to a web server on the other side of the planet, let microservices in a data center call each other, and let a phone stream video over a cellular link.
This note is the foundation for the rest of the Network Engineer roadmap. It answers three practical questions:
- What is a network, structurally? — the nodes, links, and roles that make up any network.
- What is the internet, and what actually happens when you load a web page? — an end-to-end walk from typing a URL to pixels on screen, touching ISPs, IP, DNS, TCP, TLS, and HTTP.
- What does a network engineer do, and how should you learn this field? — the role, the mindset, and how to build durable mental models instead of memorizing facts.
Everything here is intentionally high-level and connective. Deeper layers get their own topics: the OSI/TCP-IP models in ./03-network-models-and-layers.md, and performance (bandwidth/latency/throughput/QoS) in ./13-traffic-management-and-qos.md.
Fundamentals
What a network is made of
Every network, from two laptops sharing files to the global internet, is built from the same handful of primitives.
| Term | Meaning | Example |
|---|---|---|
| Node | Any device that participates in the network (can send, receive, or forward data) | Laptop, phone, server, router, switch, printer |
| Host | A node that is an endpoint — it originates or consumes data, rather than just forwarding it | Your laptop, a web server |
| Link | The connection (medium) between two nodes | Ethernet cable, Wi-Fi radio, fiber, cellular |
| Client | A host that requests a service | Your browser requesting a page |
| Server | A host that provides a service and answers requests | An HTTP server, a database |
| Router | A node that forwards packets between different networks based on IP addresses | Your home router, an ISP core router |
| Switch | A node that forwards frames within a single local network based on MAC addresses | The switch in an office wiring closet |
Two roles are worth clarifying because they cause the most confusion:
- Client vs server is a role, not a device type. The same machine can be a client in one conversation and a server in another. A web server is a “server” to browsers, but a “client” when it queries a database.
- Router vs switch is about scope. A switch connects devices inside one network (a LAN) and forwards based on Layer 2 MAC addresses. A router connects different networks and forwards based on Layer 3 IP addresses. Your home “router” box is usually a router + switch + Wi-Fi access point + firewall combined.
Network topologies (how nodes connect)
The topology describes the shape of the connections. Physical topology is the literal cabling; logical topology is how data actually flows.
| Topology | Shape | Trade-off |
|---|---|---|
| Star | Every node connects to a central switch/hub | Simple, easy to manage; central device is a single point of failure. Most common in offices. |
| Mesh | Nodes connect to many other nodes | Highly resilient (many paths); expensive to cable. The internet’s core is a partial mesh. |
| Bus | All nodes share one backbone cable | Cheap, legacy; one cable fault breaks everything. Largely obsolete. |
| Ring | Each node connects to two neighbors forming a loop | Predictable; a break can split the ring (mitigated by dual rings). Used in some metro/fiber networks. |
Network scope (by size)
- LAN (Local Area Network) — one building or floor, e.g. an office or home.
- WLAN — a Wi-Fi LAN.
- MAN (Metropolitan Area Network) — a city-scale network, often an ISP’s metro fiber.
- WAN (Wide Area Network) — spans cities/countries; the internet is the largest WAN.
Public vs private addressing
Not every device has a globally unique address. Private IP ranges (RFC 1918: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) are reused inside countless home and office networks. A router performs NAT (Network Address Translation) to let many private hosts share one public IP toward the internet.
# See your own private IP and interfaces (Linux)
ip addr show
# or the classic route/gateway view
ip route show # default via 192.168.1.1 dev wlan0 ...
# Find the public IP the internet actually sees for you
curl -s https://ifconfig.me
Key Concepts
What the internet is
The internet is not one network — it is a network of networks: tens of thousands of independently operated networks (called Autonomous Systems, each with an ASN) that agree to interconnect and route each other’s traffic. There is no central owner; it works because everyone speaks the same core protocols (IP, TCP, UDP, DNS, BGP) and agrees on how to exchange traffic.
ISPs and tiers. Access to the internet is layered into tiers:
| Tier | Role |
|---|---|
| Tier 1 | Global backbone providers that reach every other network without paying anyone for transit; they peer with each other for free. |
| Tier 2 | Regional/national ISPs that peer where they can but buy transit from Tier 1 to reach the rest of the world. |
| Tier 3 | Local “last-mile” ISPs that sell access to homes and businesses and buy transit upstream. |
Peering vs transit. Two networks peer when they exchange each other’s traffic directly (often free, at an Internet Exchange Point / IXP). A network buys transit when it pays a larger provider to carry its traffic to the rest of the internet. BGP (Border Gateway Protocol) is the protocol these networks use to advertise which IP ranges they can reach, so packets can find a path across the whole system.
IP addresses — the internet’s postal system
Every host reachable on the internet has an IP address. Routers use it to forward packets hop by hop toward the destination.
| IPv4 | IPv6 | |
|---|---|---|
| Size | 32-bit | 128-bit |
| Example | 93.184.216.34 | 2606:2800:220:1:248:1893:25c8:1946 |
| Address count | ~4.3 billion (exhausted) | ~3.4×10³⁸ (effectively unlimited) |
| Notation | Dotted decimal | Colon-separated hex |
Addresses are grouped into subnets using CIDR notation (e.g. 192.168.1.0/24 = 256 addresses). The /24 is the prefix length: how many leading bits identify the network vs the host. Subnetting is covered deeply in a later topic; the key idea now is that routers make decisions based on the network prefix, not individual hosts.
Packets and packet switching
Data does not travel as one continuous stream over the wire. It is chopped into packets — small, self-contained units each carrying a chunk of data plus headers with source/destination addresses and control info.
Packet switching vs circuit switching:
| Circuit switching | Packet switching | |
|---|---|---|
| Model | A dedicated end-to-end path is reserved for the whole session | Data split into packets, each routed independently |
| Classic example | Old telephone network (PSTN) | The internet |
| Resource use | Reserved bandwidth even when idle → wasteful | Shared links, statistical multiplexing → efficient |
| Resilience | Circuit fails if any link on the path fails | Packets reroute around failures |
| Ordering/loss | Guaranteed order, no loss (once set up) | Packets may arrive out of order, duplicated, or lost — higher layers fix it |
Packet switching is why the internet is resilient and cost-effective: many conversations share the same links, and if a router or cable dies, BGP and routing tables steer packets around the damage.
Encapsulation (the high-level idea)
As data moves down the stack on the sender, each layer wraps it in its own header (and sometimes trailer). This nesting is encapsulation. On the receiver, each layer strips its header off (decapsulation) on the way up.
- 01Application datae.g. an HTTP request
- + TCP header (adds ports, sequence numbers)02Segment
- + IP header (adds source/dest IP)03Packet
- + Ethernet header+trailer (adds MAC addresses, checksum)04Frame
- 05bits on the wire
Each layer only “talks to” its peer layer on the other host and doesn’t care how the layers below carry it. This layered model is the subject of ./03-network-models-and-layers.md.
End-to-end: what happens when you load a web page
This is the single most valuable mental model in networking. Suppose you type https://example.com and hit Enter.
1. URL parsing. The browser splits the URL into scheme (https), host (example.com), and path (/). HTTPS implies default port 443.
2. DNS resolution — name → IP. The browser needs the IP address for example.com. It checks caches (browser, OS, local resolver), then a recursive resolver (often your ISP’s or 1.1.1.1/8.8.8.8) walks the DNS hierarchy: root servers → .com TLD servers → example.com’s authoritative nameserver, which returns the IP.
# Watch a DNS lookup resolve a name to an address
dig example.com +short
# 93.184.216.34
# See the full recursive path and record details
dig example.com
# Trace the delegation from the root down (root → .com → authoritative)
dig +trace example.com
3. Routing to the server. With the destination IP known, your host builds packets. It compares the destination to its own subnet: if it’s local, send directly; if not (it isn’t), send to the default gateway (your router). From there each router consults its routing table and forwards the packet toward the destination, hop by hop, across ISPs and the internet backbone.
# See every router hop between you and the destination
traceroute example.com # Linux/macOS
# or, with more control:
traceroute -I example.com # use ICMP echo instead of UDP
# Quick reachability + round-trip time check
ping example.com
# 64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=11.3 ms
4. TCP handshake — establish a reliable connection. Before any HTTP data, TCP performs a three-way handshake with the server on port 443:
Now both sides have a reliable, ordered, byte-stream channel. (For some traffic like DNS or video, UDP is used instead — connectionless, no handshake, no delivery guarantees, but lower overhead.)
5. TLS handshake — establish encryption. Because this is HTTPS, TLS negotiates on top of TCP: the client and server agree on a cipher, the server presents its certificate (proving it really is example.com, signed by a trusted CA), and they derive shared session keys. After this, everything is encrypted.
6. HTTP request/response. Finally the browser sends an HTTP request over the encrypted channel and the server responds:
# See the whole thing: DNS, TCP connect, TLS handshake, HTTP request + response headers
curl -v https://example.com
# * Connected to example.com (93.184.216.34) port 443
# * TLS handshake, ... TLSv1.3
# > GET / HTTP/2
# > Host: example.com
# < HTTP/2 200
# < content-type: text/html; charset=UTF-8
7. Render. The browser parses the returned HTML, discovers it needs CSS, JS, images — and repeats steps 2–6 (often reusing the connection and cached DNS) for each additional resource, then paints the page.
Every one of those steps is a place things can break, and diagnosing which step failed (DNS? routing? TCP? TLS? the app itself?) is the daily bread of a network engineer.
The role of a network engineer
A network engineer designs, builds, operates, secures, and troubleshoots the networks that everything else runs on. The scope ranges from campus/office LANs, to data-center fabrics, to ISP/WAN networks, to cloud networking (VPCs, load balancers, VPNs).
Typical daily responsibilities:
- Design & plan — IP addressing schemes, subnetting/VLANs, topology, capacity planning, redundancy.
- Configure & deploy — routers, switches, firewalls, load balancers, VPNs, wireless.
- Operate & monitor — watch link utilization, latency, packet loss, errors; respond to alerts.
- Troubleshoot — the core skill: methodically isolate where in the path a problem lives (physical, link, IP, transport, or application).
- Secure — firewall rules, ACLs, segmentation, VPNs; reduce attack surface.
- Automate & document — increasingly with tools like Ansible/Terraform, Python, and version-controlled configs.
- Collaborate — with sysadmins, developers, security, and vendors.
Mindset and skills:
- Systematic troubleshooting — form a hypothesis, test it, narrow the fault domain. “Is it DNS?” is a meme because it so often is.
- Layered thinking — always know which layer you’re reasoning about (see ./03-network-models-and-layers.md).
- Attention to detail — a single wrong subnet mask or ACL line takes down a service.
- Comfort with the CLI and reading protocol captures (tcpdump/Wireshark).
- Automation literacy — modern networks are managed as code.
Performance basics: bandwidth, latency, throughput
Three often-confused terms; deeper treatment (plus QoS) is in ./13-traffic-management-and-qos.md.
| Term | Definition | Analogy (a pipe) | Units |
|---|---|---|---|
| Bandwidth | Maximum capacity of a link — how much could flow per second | The pipe’s diameter | bps, Mbps, Gbps |
| Throughput | The actual data rate achieved in practice | Water actually flowing | bps, Mbps, Gbps |
| Latency | Time for one packet to travel source → destination | How long a drop takes to traverse the pipe | ms |
Key intuitions:
- Bandwidth ≠ speed. A fat link (high bandwidth) with high latency still feels slow for interactive/round-trip-heavy work. Bandwidth helps bulk transfers; latency dominates responsiveness.
- Throughput ≤ bandwidth, always — reduced by congestion, packet loss, protocol overhead, and latency (TCP’s window limits throughput over high-latency links).
- RTT (round-trip time) is what
pingreports — the there-and-back latency. - Jitter is the variation in latency; it hurts real-time traffic (voice/video) more than raw latency does.
# Latency / RTT
ping -c 5 example.com
# Rough one-way capacity/throughput between two hosts you control
iperf3 -c <server-ip> # run `iperf3 -s` on the server first
Best Practices
For learning the field
- Build mental models, don’t memorize. Understand why DNS is hierarchical or why TCP needs a handshake; the specific numbers and commands follow naturally. Facts you understand are recoverable; facts you memorized decay.
- Anchor everything to the layered model. When you learn a new protocol, ask: which layer, what does it wrap, what wraps it? (See ./03-network-models-and-layers.md.)
- Always be able to trace a packet. If you can narrate the full “load a web page” lifecycle above from memory, you understand the core. Re-derive it until it’s automatic.
- Learn the troubleshooting order. Bottom-up: is the link up (
ip link)? do I have an IP (ip addr)? can I reach the gateway (ping)? does DNS resolve (dig)? does the route work (traceroute)? does the app respond (curl -v)? - Do hands-on labs. Reading is not enough. Practice safely with:
- Your own machine:
ip,ping,traceroute,dig,curl -v,tcpdump. - Virtual labs: GNS3, Cisco Packet Tracer, Containerlab, or
netns/vethon Linux to build topologies without hardware. - Cloud VPCs: build subnets, route tables, and security groups in AWS/GCP to see the same concepts in a modern setting.
- Your own machine:
- Capture and read real traffic. Running
tcpdump/Wireshark once, watching a real TCP handshake and DNS query fly by, teaches more than a chapter of text.
For practicing networking
- Plan addressing before you build. Decide subnets, ranges, and naming up front; retrofitting IP schemes is painful.
- Document topology and changes. Diagrams and change logs turn a 3 a.m. outage from panic into a lookup.
- Prefer redundancy at choke points. Single points of failure (one router, one uplink) will eventually fail.
- Monitor the four golden signals of a link: utilization, latency, loss, and errors.
- Automate repetitive config, and keep configs in version control so changes are reviewable and reversible.
References
- Cloudflare — What is the Internet? / How does the Internet work?
- Cloudflare — What is a computer network?
- MDN — How does the Internet work?
- MDN — What happens when you navigate to a URL? (Overview of HTTP)
- RFC 1122 — Requirements for Internet Hosts
- RFC 9293 — Transmission Control Protocol (TCP)
- RFC 1918 — Address Allocation for Private Internets
- roadmap.sh — Network Engineer Roadmap