linuxlab.io
Tutorials▾
  • Linux & networking
    File system, processes, TCP/IP, BGP and OSPF
    →
  • Terraform & IaC
    HCL, state, plan/apply on a LocalStack sandbox
    →
  • Git & GitHub
    Object model, plumbing, branching, GitHub Actions
    →
All tutorials →
PricingAboutSign inCreate account
/
  • Введение
  • Уроки
  • How it works
  • Симулятор
  • База знаний
  • Собеседование
Lessons
Footer
linuxlab-TutorialsPricingAboutPrivacy & cookies
Copyright © 2026 LinuxLab. All rights reserved.

← из прошлого урока

You saw drop rules in nftables. Now the same netfilter machinery, but not to block: to rewrite. NAT and masquerade. One mechanism is what makes a home router work, and a Docker bridge too.

← к прошлому уроку

Средний

NAT and masquerade: how one IP hides many

18 мин · урок входит в курс «Средний»

Topology: client sits in a "private" network 10.20.1.0/24, server in a "public" network 203.0.113.0/24, and gw connects them (the router).

Without NAT: the server sees a request from the private IP 10.20.1.10 and answers back, but on the real internet 10.20.x.x is not routable, so the packet is dropped at the first provider router. The same thing happens at home: your ISP knows nothing about 192.168.1.5 and sees only the router's public IP.

nat (Network Address Translation) on gw swaps the packet's source IP for its own public one, then restores it on the way back. In particular, MASQUERADE is dynamic NAT that takes the IP of the outgoing interface on its own.

Урок закрыт

Чтобы запустить sandbox и пройти этот урок целиком, нужен соответствующий курс. Внутри - ещё много практических уроков того же уровня и сквозной прогресс.

Купить курсВойти← Все уроки

дальше →

You have been driving the network from the outside already (routing, NAT, firewall). Next we turn inward, toward processes: what they have open, which syscalls they make, where a thread is stuck in the kernel. /proc, lsof, strace: three tools for debugging.

Открыть превью: Debugging with /proc, lsof, and straceв курсе «Средний» - /pricing
Footer
linuxlab-
Copyright © 2026 LinuxLab. All rights reserved.
Tutorials
Pricing
About
Privacy & cookies