0. A mentalidade certa antes de começar
A maioria das pessoas estuda rede decorando portas ("80 é HTTP, 443 é HTTPS") e para por aí. Isso te faz decorar um dicionário, não entender uma língua. O que separa quem trabalha com cyber de quem só passou numa prova é conseguir responder três perguntas sobre qualquer tráfego que aparecer na tela:
- Quem está falando com quem? (origem, destino, direção)
- Como essa conversa começou e como ela está sendo mantida? (handshake, estado da conexão)
- Isso faz sentido para este ambiente? (o desvio do normal é o que denuncia o ataque)
Todo o resto (OSI, subnetting, DNS) existe para você conseguir responder essas três perguntas com precisão.
1. Modelo OSI e TCP/IP: o "mapa" da comunicação
A analogia da carta. Imagine mandar uma carta física: você escreve o conteúdo, coloca num envelope com endereço, o carteiro decide a rota e o entregador local bate na porta certa. Cada um só se preocupa com a sua parte: o carteiro não lê a carta, só olha o envelope. É assim que uma rede funciona: camadas, cada uma com uma responsabilidade, cada uma "envelopando" a de cima.
O modelo OSI (7 camadas): o vocabulário do mercado
| # | Camada | O que faz | Exemplo | PDU |
|---|---|---|---|---|
| 7 | Aplicação | Interface com o software | HTTP, DNS, SMTP, SSH | Dados |
| 6 | Apresentação | Formato, criptografia, codificação | TLS, SSL, ASCII | Dados |
| 5 | Sessão | Abre/mantém/fecha a conversa | Controle de sessão | Dados |
| 4 | Transporte | Entrega fim-a-fim, portas, confiabilidade | TCP, UDP | Segmento / Datagrama |
| 3 | Rede | Endereçamento lógico e roteamento | IP, ICMP | Pacote |
| 2 | Enlace | Endereçamento físico local (MAC) | Ethernet, ARP, VLAN | Quadro |
| 1 | Física | Bits no fio/rádio | Cabo, sinal, Wi-Fi | Bits |
Mnemônico (de baixo para cima): "Fala EnRola Tudo Sem Acabar Assunto" → Física, Enlace, Rede, Transporte, Sessão, Apresentação, Aplicação.
O modelo TCP/IP (4 camadas): o que a internet realmente usa
| TCP/IP | Corresponde ao OSI | Protocolos-chave |
|---|---|---|
| Aplicação | 5, 6, 7 | HTTP, DNS, TLS, SSH, DHCP |
| Transporte | 4 | TCP, UDP |
| Internet | 3 | IP, ICMP, ARP* |
| Acesso à rede | 1, 2 | Ethernet, Wi-Fi |
* Tecnicamente o ARP fica "entre" camadas; guarde que ele resolve MAC↔IP.
Encapsulamento: o coração de tudo
[ HTTP GET /login ] ← Aplicação: seu pedido
[ TCP | porta origem/destino | HTTP GET ] ← Transporte: envelopa com portas
[ IP | IP origem/destino | TCP... ] ← Rede: envelopa com IPs
[ ETH | MAC origem/destino | IP... ] ← Enlace: envelopa com MACs
1010101110101... (vira sinal no fio) ← Física
Do outro lado, o processo é inverso (desencapsulamento): cada camada abre seu envelope e entrega o conteúdo para a de cima.
No Wireshark você vê essas camadas empilhadas, uma dentro da outra. Se entende encapsulamento, o Wireshark deixa de ser um monte de linhas coloridas e vira um raio-X. Cada ataque "mora" numa camada: ARP spoofing é L2, IP spoofing é L3, SYN flood é L4, SQL injection é L7. Saber a camada te diz onde procurar e como defender.
2. Endereçamento IPv4
A analogia do endereço postal. Um IP é como rua + número da casa. A "rua" é a rede; o "número" é o host. A máscara de sub-rede diz onde termina a rua e começa o número. Um IPv4 tem 32 bits, em 4 octetos (0–255):
192.168.0.10
11000000.10101000.00000000.00001010 = 192.168.0.10
8 . 8 . 8 . 8 bits = 32 bits
Faixas privadas (RFC 1918): decore estas
| Faixa | Máscara | Onde você vê |
|---|---|---|
| 10.0.0.0 – 10.255.255.255 | /8 | Grandes empresas, datacenters |
| 172.16.0.0 – 172.31.255.255 | /12 | Redes médias |
| 192.168.0.0 – 192.168.255.255 | /16 | Casa, roteador doméstico |
Outras faixas: 127.0.0.0/8 loopback (127.0.0.1 = localhost); 169.254.0.0/16 APIPA (o host não conseguiu IP do DHCP, sinal de problema); 0.0.0.0 "qualquer/rota padrão".
Se num log de firewall você vê tráfego saindo de um IP 10.x direto para a internet sem passar pelo NAT, ou uma máquina interna com 169.254.x tentando se comunicar, algo está errado. Reconhecer instantaneamente "privado / público / loopback" acelera qualquer triagem.
3. Subnetting: a habilidade que separa amador de profissional
A ideia é simples: dividir uma rede grande em pedaços menores e controláveis. Imagine um prédio onde qualquer pessoa entra em qualquer sala; subnetting é colocar paredes e portas (RH numa sub-rede, financeiro em outra, servidores em outra). Melhora organização, desempenho e, crucial para cyber, contenção: se um invasor cai numa sub-rede, não alcança as outras automaticamente.
CIDR: a notação "/"
Em vez da máscara 255.255.255.0, escrevemos /24. O número após a barra é quantos bits, da esquerda para a direita, pertencem à rede; o resto é dos hosts.
/24 → 11111111.11111111.11111111.00000000 → 255.255.255.0
\___________ rede __________/ \_host_/
Tabela mestra (a que você usa todo dia)
| CIDR | Máscara | Hosts utilizáveis | "Salto" no octeto |
|---|---|---|---|
| /24 | 255.255.255.0 | 254 | 256 |
| /25 | 255.255.255.128 | 126 | 128 |
| /26 | 255.255.255.192 | 62 | 64 |
| /27 | 255.255.255.224 | 30 | 32 |
| /28 | 255.255.255.240 | 14 | 16 |
| /29 | 255.255.255.248 | 6 | 8 |
| /30 | 255.255.255.252 | 2 | 4 |
Fórmula dos hosts: 2^(bits de host) − 2. Os "−2" são o endereço de rede (o primeiro) e o broadcast (o último); nenhum pode ser dado a uma máquina.
Exemplo prático passo a passo
Em qual sub-rede está o host 192.168.1.100/26?
1. /26 → o "salto" é 64. Blocos do último octeto: 0, 64, 128, 192
2. 100 cai entre 64 e 128 → bloco que começa em 64
3. Endereço de rede: 192.168.1.64
4. Broadcast: 192.168.1.127 (128 − 1)
5. Faixa utilizável: 192.168.1.65 até 192.168.1.126
Sem calculadora, no papel, em 30 segundos.
Ao escanear ou defender, você precisa saber qual faixa varrer e onde ficam as fronteiras. Um pentester que mapeia 10.0.5.0/24 sabe que são 254 alvos. Um analista que vê um IP fora da sub-rede esperada sabe na hora que é anômalo. Segmentação de rede (VLANs) é subnetting aplicado à defesa.
4. IPv6: o futuro que já chegou
O IPv4 tem ~4,3 bilhões de endereços, que já acabaram. O IPv6 usa 128 bits: são 340 undecilhões de endereços. Notação: 8 grupos de 4 dígitos hexadecimais separados por dois-pontos.
2001:0db8:0000:0000:0000:ff00:0042:8329
Encurtando (zeros à esquerda somem; sequência zerada vira :: uma vez):
2001:db8::ff00:42:8329
Loopback IPv6 = ::1 (equivale ao 127.0.0.1)
Muita gente configura firewall e monitoramento só para IPv4 e esquece do IPv6. Resultado: a máquina pode estar "protegida" no IPv4 e totalmente exposta no IPv6, porque ninguém filtrou aquele caminho. Sempre pergunte: "meu controle cobre IPv6 também?" Atacantes adoram esse ponto cego.
5. ARP: a "cola" entre IP e MAC
Você sabe o nome da pessoa (IP), mas para entregar algo na mão dela precisa saber em que mesa ela está sentada (o MAC físico da placa). ARP é gritar na sala: "Quem tem o IP 192.168.0.1? Me passa seu endereço físico!" Opera na rede local (mesma sub-rede), camada 2: um host manda um ARP Request em broadcast, o dono responde com ARP Reply, e o resultado fica na tabela ARP (cache).
arp -a # Windows e Linux
ip neigh # Linux moderno
O calcanhar de Aquiles: o ARP não tem autenticação. Qualquer um responde "sou eu o 192.168.0.1" mesmo não sendo. O atacante se passa pelo gateway e todo o tráfego da vítima flui por ele (MITM). Detecção: duas entradas ARP com o mesmo MAC para IPs diferentes, ou o MAC do gateway mudando de repente (arpwatch avisa). Mitigação: ARP estático em ativos críticos, Dynamic ARP Inspection (DAI) em switches gerenciados e segmentação.
6. DHCP: quem distribui os IPs
Chegou num hotel (a rede): na recepção (servidor DHCP) você recebe número do quarto (IP), planta (gateway e máscara), lista telefônica (DNS) e por quanto tempo pode ficar (lease). O processo DORA:
1. Discover cliente grita: "tem algum servidor DHCP aí?"
2. Offer servidor: "tenho, pega esse IP 192.168.0.50"
3. Request cliente: "aceito esse IP"
4. Acknowledge servidor: "confirmado, é seu por X horas (lease)"
DHCP Starvation: pede milhares de IPs até esgotar o pool (negação de serviço). Rogue DHCP: servidor pirata responde mais rápido, entregando gateway e DNS controlados pelo atacante (MITM). Se máquinas recebem gateway/DNS estranhos, ou surgem endereços APIPA (169.254.x) em massa, suspeite. Mitigação: DHCP Snooping no switch (só portas confiáveis respondem como servidor DHCP).
7. DNS: a agenda de contatos da internet
Você não decora o telefone de todo mundo; tem os nomes na agenda e o celular traduz na hora. DNS traduz google.com em 142.250.x.x. A resolução recursiva: seu PC pergunta ao resolver (ex.: 8.8.8.8); se ele não souber, pergunta aos servidores raiz → TLD (.br) → autoritativo; a resposta volta e fica em cache por um tempo (TTL).
| Registro | Para que serve |
|---|---|
| A | Nome → IPv4 |
| AAAA | Nome → IPv6 |
| CNAME | Apelido (nome → outro nome) |
| MX | Servidor de e-mail do domínio |
| NS | Servidores de nomes autoritativos |
| TXT | Texto livre (SPF, DKIM, verificações) |
| PTR | IP → Nome (DNS reverso) |
dig google.com A # registro A
dig google.com MX # servidores de e-mail
dig -x 8.8.8.8 # reverso: IP → nome
nslookup google.com # alternativa (Windows/Linux)
DNS Spoofing / Cache Poisoning: injeta respostas falsas para redirecionar a vítima. DNS Tunneling: esconde dados (exfiltração ou C2) dentro de consultas DNS (como DNS quase nunca é bloqueado, malware abusa disso). DGA: gera centenas de domínios aleatórios por dia para achar o servidor de controle. Fast Flux: troca o IP por trás de um domínio constantemente. Sinais: domínios recém-registrados, subdomínios enormes e aleatórios (x8f92a3b.evil.com), volume anormal de uma única máquina. Quem entende DNS enxerga o C2 antes do estrago.
8. NAT: uma rede inteira sai com um IP só
Um prédio comercial tem um único endereço na rua (IP público), mas dezenas de salas (IPs privados). A recepção (roteador com NAT) anota "a resposta do pedido nº 4521 é da sala 305". No PAT (o NAT de casa), o roteador troca o IP de origem pelo público e anota a tradução numa tabela, usando a porta para diferenciar cada conexão. Por isso a casa inteira navega com um IP público só.
NAT esconde a topologia interna: de fora você só vê o IP público. Isso ajuda a defesa, mas complica a investigação: num log você vê "o IP público X acessou tal coisa", mas qual máquina interna foi? Só descobre correlacionando com os logs de tradução NAT do roteador/firewall. Em incidente, esses logs são essenciais para achar a máquina real.
9. Roteamento: como o pacote acha o caminho
Você viaja sem GPS: em cada cruzamento (roteador) há uma placa "para tal destino, siga por aqui". Cada roteador só conhece o próximo passo (hop by hop). Conceitos: tabela de roteamento (lista de "para chegar em tal rede, mande por tal caminho"); gateway padrão (a rota 0.0.0.0/0); roteamento estático (na mão) e dinâmico (OSPF, BGP, EIGRP).
ip route # Linux traceroute google.com # Linux/Mac
route print # Windows tracert google.com # Windows
netstat -rn # ambos
Cada linha do traceroute é um roteador (hop) no caminho.
O traceroute dá o "mapa da estrada" até um alvo (recon e diagnóstico). Uma rota adicionada indevidamente numa máquina pode ser sinal de que um atacante desvia tráfego. E entender rotas é pré-requisito para segmentação: se não há rota entre a VLAN de usuários e a de servidores, o atacante fica preso.
10. VLANs: segmentação lógica
Um switch é um andar aberto com várias mesas; uma VLAN é colocar divisórias invisíveis: mesmo no mesmo móvel físico, o RH só "enxerga" o RH. Como funciona (802.1Q): cada VLAN tem um número (VLAN ID, 1 a 4094); ao atravessar entre switches, o quadro ganha uma etiqueta (tag) com o VLAN ID. Portas access pertencem a uma VLAN só; portas trunk carregam várias.
Switch Spoofing: o atacante finge ser switch e negocia um trunk, ganhando todas as VLANs. Double Tagging: insere duas tags 802.1Q; o primeiro switch remove uma e o quadro entra na VLAN errada. VLAN é a espinha dorsal da segmentação, defesa nº 1 contra movimento lateral. Mitigação: desativar DTP nas portas de acesso, não usar a VLAN 1 para nada real e definir uma VLAN nativa dedicada. Segmentar bem faz um incidente ficar contido em vez de virar comprometimento total.
11. Camada de Transporte: TCP vs UDP
É a camada onde vivem as portas e onde a maioria das ferramentas de scan atua.
| TCP | UDP | |
|---|---|---|
| Filosofia | Confiável, com confirmação | Rápido, sem garantia |
| Analogia | Ligação telefônica (confirma que ouviu) | Carta na caixa (mandou, torce) |
| Conexão | Orientado a conexão (handshake) | Sem conexão |
| Garante entrega? | Sim (retransmite) | Não |
| Ordem | Garante | Não garante |
| Velocidade | Menor (overhead) | Maior |
| Usos | HTTP, HTTPS, SSH, e-mail | DNS, DHCP, VoIP, streaming, jogos |
O Three-Way Handshake do TCP (memorize)
Cliente Servidor
| ---- SYN --------------------> | "quero conectar" (seq x)
| <--- SYN + ACK --------------- | "ok, e eu também" (confirma x, envia y)
| ---- ACK --------------------> | "confirmado" (confirma y)
| |
| == conexão estabelecida == |
O encerramento usa FIN/ACK (four-way).
As flags TCP (os "sinais" dentro do pacote)
| Flag | Significado |
|---|---|
| SYN | Iniciar conexão (Synchronize) |
| ACK | Confirmação (Acknowledge) |
| FIN | Encerrar conexão normalmente |
| RST | Resetar/abortar conexão bruscamente |
| PSH | Enviar dados imediatamente |
| URG | Dados urgentes |
Portas: o "número da sala" dentro do host
O IP leva o pacote até a máquina; a porta leva até o serviço certo. Faixas: 0–1023 well-known (22 SSH, 25 SMTP, 53 DNS, 80 HTTP, 443 HTTPS, 3389 RDP); 1024–49151 registradas; 49152–65535 dinâmicas/efêmeras.
ss -tulpn # Linux (t=tcp, u=udp, l=listening, p=processo, n=numérico)
netstat -tulpn # clássico
netstat -ano # Windows (mostra PID)
Como isso vira scan de porta (Nmap)
SYN Scan (-sS): manda SYN e vê a resposta. SYN+ACK = aberta; RST = fechada. Não completa o handshake (não manda o ACK final): é o "half-open", mais furtivo. Connect Scan (-sT): completa o handshake inteiro (mais barulhento, mais logado). UDP Scan (-sU): mais lento e incerto, porque UDP não responde de forma confiável.
O handshake é onde a mágica acontece nos dois lados. Um SYN Flood (DoS) é mandar milhares de SYN sem nunca completar, esgotando a tabela de conexões do servidor. No Wireshark, uma enxurrada de SYN sem SYN+ACK correspondente grita "ataque". Entender flags te deixa ler qualquer captura: você sabe se a conexão está nascendo (SYN), viva (ACK/PSH) ou morrendo (FIN/RST).
12. HTTP e HTTPS: a camada de aplicação mais atacada
HTTP é texto puro, pergunta-e-resposta: o cliente manda um request, o servidor devolve um response.
| Método | O que pede |
|---|---|
| GET | "Me dê esse recurso" |
| POST | "Estou enviando dados" (login, formulário) |
| PUT | "Crie/substitua este recurso" |
| DELETE | "Apague este recurso" |
| HEAD | "Só os cabeçalhos, sem corpo" |
| Faixa | Significado | Exemplos |
|---|---|---|
| 2xx | Sucesso | 200 OK, 201 Created |
| 3xx | Redirecionamento | 301 (permanente), 302 (temporário) |
| 4xx | Erro do cliente | 401 (não autenticado), 403 (proibido), 404 (não achou) |
| 5xx | Erro do servidor | 500, 502, 503 |
Cabeçalhos carregam informação extra: User-Agent (navegador), Cookie (sessão), Authorization (credenciais), Host (qual site), Content-Type (formato). No HTTP puro tudo trafega em texto claro: num MITM, qualquer um lê senhas e cookies. HTTPS = HTTP + TLS: o conteúdo continua HTTP, mas ninguém no meio consegue ler.
A web é a maior superfície de ataque hoje. Praticamente todo o OWASP Top 10 (SQL Injection, XSS...) acontece na camada HTTP. Ler request/response com fluência é obrigatório: headers suspeitos, cookies roubados, redirecionamentos maliciosos (301 para site falso). Um User-Agent estranho ou uma sequência de 404 pode ser alguém varrendo diretórios.
13. TLS: como a criptografia da web funciona
Você e um amigo querem trocar mensagens secretas num café cheio: primeiro combinam uma chave em segredo, depois conversam nessa "língua cifrada". TLS resolve o problema difícil: combinar a chave secreta na frente de todo mundo, sem que ninguém no meio a descubra.
1. ClientHello "olá, suporto estas versões e cifras"
2. ServerHello + Certificado servidor escolhe a cifra e envia o
certificado (chave pública assinada por uma CA)
3. Validação cliente confere se a CA é confiável e o cert é válido
4. Troca de chaves os dois combinam uma chave de sessão simétrica
5. Conversa criptografada com essa chave rápida (simétrica)
Cadeia de confiança: uma CA (Let's Encrypt, DigiCert) assina o certificado; seu SO/navegador já confia nessas CAs. Você confia na CA → a CA garante o site.
TLS protege confidencialidade e integridade, mas cria um dilema: se tudo é cifrado, como o firewall inspeciona? Surge a inspeção TLS (SSL inspection): um proxy corporativo descriptografa, olha e recriptografa. Do lado ofensivo, atacantes usam TLS para esconder C2 ("só mais um HTTPS"). Sinais: certificados autoassinados, recém-emitidos, validade estranha, SNI/CN suspeito. Ferramentas fazem JA3/JA3S fingerprinting: identificam o malware pela assinatura de como faz o handshake, sem ler o conteúdo.
14. VPN: o túnel seguro
Transportar documentos sigilosos por uma estrada pública cheia de bandidos: a VPN é um túnel blindado sobre essa estrada. O mundo vê que "algo" passa, mas não abre. O que ela faz: criptografa o tráfego, encapsula (tunneling) seus pacotes dentro de outros e faz parecer que você está na rede do outro lado.
| Tipo | Onde atua | Uso típico |
|---|---|---|
| IPsec | Camada 3 (rede) | Site-to-site, acesso corporativo |
| SSL/TLS VPN | Camada de aplicação | Acesso remoto de usuário |
| WireGuard | Moderno, enxuto | Rápido, simples, cada vez mais popular |
VPN é a porta de entrada legítima para acesso remoto, por isso é alvo prioritário. Credenciais vazadas = atacante entra "por dentro". Muitos ataques (inclusive ransomware) começam por VPN mal configurada ou sem MFA. Defesa: sempre MFA na VPN, monitorar logins em horários/países estranhos, e lembrar que uma vez dentro do túnel, o usuário (ou o atacante) está na rede interna.
15. Firewalls: o porteiro da rede
Um porteiro com uma lista de regras: "quem pode entrar, quem pode sair, para onde". Do mais simples ao mais esperto:
- Packet Filter (stateless): olha cada pacote isoladamente (IP, porta, protocolo). Rápido, mas "burro", não lembra o contexto.
- Stateful: mantém tabela de estados; sabe que "esse pacote de resposta pertence a uma conexão que EU deixei sair". Muito mais seguro.
- Application Layer / Proxy: entende o protocolo (HTTP, DNS) e inspeciona o conteúdo.
- Next-Generation (NGFW): stateful + DPI + identificação de aplicação + IPS + inspeção TLS. Padrão corporativo (FortiGate, Palo Alto).
Permitir LAN (192.168.1.0/24) → qualquer : 443/TCP (sair HTTPS)
Permitir qualquer → DMZ_Web (10.0.0.5) : 80,443 (acessar o site)
Negar qualquer → qualquer : qualquer ← implicit deny
Regra de ouro: a última regra deve ser negar tudo. Permite-se explicitamente só o necessário; o resto é barrado. Menor privilégio aplicado à rede.
O firewall é o principal ponto de controle e uma das melhores fontes de log. Quem trabalha com cyber lê regras para achar exposições ("por que a porta 3389 está aberta para a internet inteira?!") e lê logs para detectar scans, exfiltração e conexões negadas em massa. A DMZ é firewall aplicado à arquitetura: uma zona intermediária entre a internet e a rede interna, onde ficam os serviços expostos.
16. Caixa de ferramentas: os comandos que você vai usar
ping: "você está vivo?" (usa ICMP para testar conectividade e latência):
ping google.com
ping -c 4 8.8.8.8 # Linux: 4 pacotes só
Cuidado: muitos firewalls bloqueiam ICMP, então "não responde" ≠ "está desligado".
traceroute / tracert: "por onde eu passo?":
traceroute google.com # Linux
tracert google.com # Windows
dig / nslookup: "resolve esse nome para mim":
dig google.com A
dig google.com MX +short
dig -x 8.8.8.8 # reverso
nslookup google.com # alternativa
netstat / ss: "quem está conectado nesta máquina?" (comando de ouro para investigação local):
ss -tulpn # Linux (t/u tcp/udp, l listening, p processo, n numérico)
netstat -tulpn # clássico
netstat -ano # Windows (com PID)
Uma porta escutando que não deveria estar ali pode ser backdoor.
nmap: o canivete suíço do reconhecimento (descobre hosts, portas, serviços, versões e até o SO):
nmap 192.168.1.0/24 # hosts vivos na sub-rede
nmap -sS -p- 192.168.1.10 # SYN scan em todas as portas
nmap -sV 192.168.1.10 # detecta versão dos serviços
nmap -A 192.168.1.10 # agressivo: SO + versões + scripts
nmap -sU --top-ports 20 alvo # top 20 portas UDP
Só escaneie o que é seu ou o que você tem autorização escrita para testar. Scan em rede alheia pode ser crime.
tcpdump: captura de pacotes na linha de comando (ideal para servidores sem interface):
tcpdump -i eth0 # captura na interface eth0
tcpdump -i eth0 port 53 # só DNS
tcpdump -i eth0 host 192.168.1.10 # só de/para esse host
tcpdump -i eth0 -w captura.pcap # salva para abrir no Wireshark
tcpdump -i eth0 'tcp[tcpflags] & tcp-syn != 0' # só pacotes com flag SYN
Wireshark: o microscópio de pacotes. Filtros de exibição essenciais:
ip.addr == 192.168.1.10 # tráfego de/para esse IP
tcp.port == 443 # porta 443
http # só HTTP
dns # só DNS
tcp.flags.syn == 1 && tcp.flags.ack == 0 # só SYNs (achar scans)
tcp.analysis.retransmission # retransmissões
ip.addr == 10.0.0.5 && dns # DNS daquele host (tunneling/C2)
Recurso matador: botão direito num pacote → "Follow → TCP Stream" remonta a conversa inteira (request e response completos, como um chat).
ping/traceroute/dig são diagnóstico; nmap é reconhecimento; tcpdump/Wireshark são análise forense e detecção. A habilidade que vale ouro é abrir uma captura de tráfego suspeito e contar a história: quem falou com quem, o que trafegou e por que aquilo é (ou não) malicioso.
17. Fechando o ciclo: identificando comunicação suspeita
Ao olhar tráfego, um analista treina o olho para desvios do normal. Sinais clássicos de comunicação maliciosa:
- Beaconing: uma máquina interna fala com o mesmo IP externo em intervalos regulares (a cada 60s). Malware "batendo ponto" no C2.
- Exfiltração: volume grande de dados saindo para um destino incomum, especialmente fora do horário comercial.
- DNS anômalo: consultas a domínios aleatórios/recém-criados, ou subdomínios gigantes (tunneling).
- Portas não usuais: serviço escutando numa porta alta e estranha; conexão de saída para porta atípica.
- Handshakes que não fecham: enxurrada de SYN sem SYN+ACK (scan ou SYN flood).
- ARP inconsistente: MAC do gateway mudou, ou dois IPs com o mesmo MAC (MITM).
- Tráfego lateral inesperado: uma estação tentando se conectar a muitas outras (movimento lateral).
O fio condutor: você só reconhece o anormal se conhece o normal. O primeiro trabalho de quem defende uma rede é entender a linha de base (baseline) do tráfego dela.
OSI/TCP-IP: camadas empilhadas; cada ataque mora numa. IP/Subnetting: endereço = rede + host; 2^host − 2. ARP: IP↔MAC local, sem auth → spoofing/MITM. DHCP: DORA; cuidado com rogue DHCP. DNS: nome→IP; fonte nº 1 de detecção. NAT: 1 IP público; logs de tradução são chave. VLAN: segmentação; base contra movimento lateral. TCP: handshake (SYN, SYN+ACK, ACK); flags contam a história. UDP: rápido, sem garantia. HTTP/TLS: camada mais atacada; TLS protege mas esconde C2. Firewall: permitir o necessário, negar o resto. Ferramentas: ping/traceroute/dig (diagnóstico), nmap (recon), tcpdump/Wireshark (análise).
Monte um laboratório com 2–3 VMs (uma Kali/atacante, uma vítima Linux, uma vítima Windows) numa rede isolada. Capture o tráfego de um nmap no Wireshark e identifique o three-way handshake, os RST das portas fechadas e os SYN+ACK das abertas. Quando conseguir "ler" essa captura sozinho, a teoria virou habilidade.
0. The right mindset before you start
Most people study networking by memorizing ports ("80 is HTTP, 443 is HTTPS") and stop there. That makes you memorize a dictionary, not understand a language. What separates people who work in cyber from people who just passed an exam is being able to answer three questions about any traffic that shows up on the screen:
- Who is talking to whom? (source, destination, direction)
- How did this conversation start, and how is it being maintained? (handshake, connection state)
- Does this make sense for this environment? (deviation from normal is what gives the attack away)
Everything else (OSI, subnetting, DNS) exists so you can answer those three questions precisely.
1. The OSI and TCP/IP models: the "map" of communication
The letter analogy. Imagine sending a physical letter: you write the content, put it in an addressed envelope, the postal service decides the route, and the local carrier knocks on the right door. Each one only cares about its own part: the postal worker doesn't read the letter, only looks at the envelope. That is how a network works: layers, each with one responsibility, each one "wrapping" the layer above it.
The OSI model (7 layers): the industry vocabulary
| # | Layer | What it does | Example | PDU |
|---|---|---|---|---|
| 7 | Application | Interface with the software | HTTP, DNS, SMTP, SSH | Data |
| 6 | Presentation | Format, encryption, encoding | TLS, SSL, ASCII | Data |
| 5 | Session | Opens/maintains/closes the conversation | Session control | Data |
| 4 | Transport | End-to-end delivery, ports, reliability | TCP, UDP | Segment / Datagram |
| 3 | Network | Logical addressing and routing | IP, ICMP | Packet |
| 2 | Data Link | Local physical addressing (MAC) | Ethernet, ARP, VLAN | Frame |
| 1 | Physical | Bits on the wire/radio | Cable, signal, Wi-Fi | Bits |
Mnemonic (bottom to top): "Please Do Not Throw Sausage Pizza Away" → Physical, Data Link, Network, Transport, Session, Presentation, Application.
The TCP/IP model (4 layers): what the internet actually uses
| TCP/IP | Maps to OSI | Key protocols |
|---|---|---|
| Application | 5, 6, 7 | HTTP, DNS, TLS, SSH, DHCP |
| Transport | 4 | TCP, UDP |
| Internet | 3 | IP, ICMP, ARP* |
| Network Access | 1, 2 | Ethernet, Wi-Fi |
* Technically ARP sits "between" layers; just remember that it resolves MAC↔IP.
Encapsulation: the heart of it all
[ HTTP GET /login ] ← Application: your request
[ TCP | source/dest port | HTTP GET ] ← Transport: wraps it with ports
[ IP | source/dest IP | TCP... ] ← Network: wraps it with IPs
[ ETH | source/dest MAC | IP... ] ← Data Link: wraps it with MACs
1010101110101... (signal on the wire) ← Physical
On the other end, the process runs in reverse (decapsulation): each layer opens its envelope and hands the content to the layer above.
In Wireshark you see these layers stacked, one inside the other. If you understand encapsulation, Wireshark stops being a bunch of colored lines and becomes an X-ray. Every attack "lives" in a layer: ARP spoofing is L2, IP spoofing is L3, SYN flood is L4, SQL injection is L7. Knowing the layer tells you where to look and how to defend.
2. IPv4 addressing
The postal address analogy. An IP is like street + house number. The "street" is the network; the "number" is the host. The subnet mask says where the street ends and the number begins. An IPv4 address has 32 bits, in 4 octets (0–255):
192.168.0.10
11000000.10101000.00000000.00001010 = 192.168.0.10
8 . 8 . 8 . 8 bits = 32 bits
Private ranges (RFC 1918): memorize these
| Range | Mask | Where you see it |
|---|---|---|
| 10.0.0.0 – 10.255.255.255 | /8 | Large enterprises, data centers |
| 172.16.0.0 – 172.31.255.255 | /12 | Mid-sized networks |
| 192.168.0.0 – 192.168.255.255 | /16 | Home, home routers |
Other ranges: 127.0.0.0/8 loopback (127.0.0.1 = localhost); 169.254.0.0/16 APIPA (the host couldn't get an IP from DHCP, a sign of trouble); 0.0.0.0 "any/default route".
If a firewall log shows traffic leaving a 10.x IP straight to the internet without going through NAT, or an internal machine with a 169.254.x address trying to communicate, something is wrong. Instantly recognizing "private / public / loopback" speeds up any triage.
3. Subnetting: the skill that separates amateurs from professionals
The idea is simple: split a large network into smaller, manageable pieces. Picture a building where anyone can walk into any room; subnetting is putting up walls and doors (HR on one subnet, finance on another, servers on another). It improves organization, performance and, crucially for cyber, containment: if an intruder lands on one subnet, they don't automatically reach the others.
CIDR: the "/" notation
Instead of the mask 255.255.255.0, we write /24. The number after the slash is how many bits, from left to right, belong to the network; the rest belong to the hosts.
/24 → 11111111.11111111.11111111.00000000 → 255.255.255.0
\_________ network _________/ \_host_/
Master table (the one you use every day)
| CIDR | Mask | Usable hosts | Block size in the octet |
|---|---|---|---|
| /24 | 255.255.255.0 | 254 | 256 |
| /25 | 255.255.255.128 | 126 | 128 |
| /26 | 255.255.255.192 | 62 | 64 |
| /27 | 255.255.255.224 | 30 | 32 |
| /28 | 255.255.255.240 | 14 | 16 |
| /29 | 255.255.255.248 | 6 | 8 |
| /30 | 255.255.255.252 | 2 | 4 |
Host formula: 2^(host bits) − 2. The "−2" are the network address (the first one) and the broadcast address (the last one); neither can be assigned to a machine.
Step-by-step practical example
Which subnet is the host 192.168.1.100/26 in?
1. /26 → the block size is 64. Blocks in the last octet: 0, 64, 128, 192
2. 100 falls between 64 and 128 → the block starting at 64
3. Network address: 192.168.1.64
4. Broadcast: 192.168.1.127 (128 − 1)
5. Usable range: 192.168.1.65 to 192.168.1.126
No calculator, on paper, in 30 seconds.
When scanning or defending, you need to know which range to sweep and where the boundaries are. A pentester mapping 10.0.5.0/24 knows there are 254 targets. An analyst who sees an IP outside the expected subnet knows right away that it's anomalous. Network segmentation (VLANs) is subnetting applied to defense.
4. IPv6: the future that's already here
IPv4 has ~4.3 billion addresses, and they have already run out. IPv6 uses 128 bits: that's 340 undecillion addresses. Notation: 8 groups of 4 hexadecimal digits separated by colons.
2001:0db8:0000:0000:0000:ff00:0042:8329
Shortened (leading zeros drop; one run of all-zero groups becomes ::, only once):
2001:db8::ff00:42:8329
IPv6 loopback = ::1 (equivalent to 127.0.0.1)
Many people configure firewalls and monitoring for IPv4 only and forget about IPv6. The result: a machine can be "protected" on IPv4 and fully exposed on IPv6, because nobody filtered that path. Always ask: "does my control cover IPv6 too?" Attackers love this blind spot.
5. ARP: the "glue" between IP and MAC
You know the person's name (IP), but to hand them something directly you need to know which desk they're sitting at (the physical MAC of the network card). ARP is shouting across the room: "Who has IP 192.168.0.1? Give me your physical address!" It operates on the local network (same subnet), at layer 2: a host sends an ARP Request as a broadcast, the owner answers with an ARP Reply, and the result is stored in the ARP table (cache).
arp -a # Windows and Linux
ip neigh # modern Linux
The Achilles' heel: ARP has no authentication. Anyone can reply "I'm 192.168.0.1" even when they aren't. The attacker impersonates the gateway and all of the victim's traffic flows through them (MITM). Detection: two ARP entries with the same MAC for different IPs, or the gateway's MAC suddenly changing (arpwatch alerts on this). Mitigation: static ARP entries on critical assets, Dynamic ARP Inspection (DAI) on managed switches, and segmentation.
6. DHCP: who hands out the IPs
You arrive at a hotel (the network): at the front desk (DHCP server) you get a room number (IP), a floor plan (gateway and mask), a phone directory (DNS) and how long you can stay (lease). The DORA process:
1. Discover client shouts: "is there a DHCP server out there?"
2. Offer server: "yes, take this IP, 192.168.0.50"
3. Request client: "I accept this IP"
4. Acknowledge server: "confirmed, it's yours for X hours (lease)"
DHCP Starvation: requests thousands of IPs until the pool is exhausted (denial of service). Rogue DHCP: a rogue server answers faster, handing out a gateway and DNS controlled by the attacker (MITM). If machines receive odd gateway/DNS settings, or APIPA addresses (169.254.x) show up en masse, be suspicious. Mitigation: DHCP Snooping on the switch (only trusted ports can respond as a DHCP server).
7. DNS: the internet's contact list
You don't memorize everyone's phone number; you have names in your contacts and the phone translates them instantly. DNS translates google.com into 142.250.x.x. Recursive resolution: your PC asks the resolver (e.g. 8.8.8.8); if it doesn't know, it asks the root servers → TLD (.br) → authoritative server; the answer comes back and is cached for a while (TTL).
| Record | What it's for |
|---|---|
| A | Name → IPv4 |
| AAAA | Name → IPv6 |
| CNAME | Alias (name → another name) |
| MX | The domain's mail server |
| NS | Authoritative name servers |
| TXT | Free text (SPF, DKIM, verifications) |
| PTR | IP → Name (reverse DNS) |
dig google.com A # A record
dig google.com MX # mail servers
dig -x 8.8.8.8 # reverse: IP → name
nslookup google.com # alternative (Windows/Linux)
DNS Spoofing / Cache Poisoning: injects forged responses to redirect the victim. DNS Tunneling: hides data (exfiltration or C2) inside DNS queries (since DNS is almost never blocked, malware abuses it). DGA: generates hundreds of random domains per day to find the command-and-control server. Fast Flux: constantly rotates the IP behind a domain. Signs: newly registered domains, huge random subdomains (x8f92a3b.evil.com), abnormal volume from a single machine. Whoever understands DNS spots the C2 before the damage is done.
8. NAT: an entire network goes out through a single IP
An office building has a single street address (public IP), but dozens of suites (private IPs). The front desk (router with NAT) notes down "the reply to request no. 4521 goes to suite 305". With PAT (home NAT), the router swaps the source IP for the public one and records the translation in a table, using the port to tell each connection apart. That's why an entire household browses with a single public IP.
NAT hides the internal topology: from the outside you only see the public IP. That helps defense, but complicates investigation: a log shows "public IP X accessed such-and-such", but which internal machine was it? You only find out by correlating with the router/firewall NAT translation logs. During an incident, those logs are essential for finding the real machine.
9. Routing: how a packet finds its way
You're traveling without GPS: at every intersection (router) there's a sign saying "for this destination, go this way". Each router only knows the next step (hop by hop). Concepts: routing table (a list of "to reach this network, send it via this path"); default gateway (the 0.0.0.0/0 route); static routing (configured by hand) and dynamic routing (OSPF, BGP, EIGRP).
ip route # Linux traceroute google.com # Linux/Mac
route print # Windows tracert google.com # Windows
netstat -rn # both
Each line of traceroute output is a router (hop) along the path.
Traceroute gives you the "road map" to a target (recon and troubleshooting). A route improperly added to a machine can be a sign that an attacker is diverting traffic. And understanding routes is a prerequisite for segmentation: if there's no route between the user VLAN and the server VLAN, the attacker is stuck.
10. VLANs: logical segmentation
A switch is an open-plan floor with lots of desks; a VLAN puts up invisible partitions: even on the same physical furniture, HR only "sees" HR. How it works (802.1Q): each VLAN has a number (VLAN ID, 1 to 4094); when crossing between switches, the frame gets a tag carrying the VLAN ID. Access ports belong to a single VLAN; trunk ports carry several.
Switch Spoofing: the attacker pretends to be a switch and negotiates a trunk, gaining access to every VLAN. Double Tagging: inserts two 802.1Q tags; the first switch strips one and the frame lands in the wrong VLAN. VLANs are the backbone of segmentation, the number one defense against lateral movement. Mitigation: disable DTP on access ports, don't use VLAN 1 for anything real, and define a dedicated native VLAN. Good segmentation keeps an incident contained instead of turning it into a full compromise.
11. Transport Layer: TCP vs UDP
This is the layer where ports live and where most scanning tools operate.
| TCP | UDP | |
|---|---|---|
| Philosophy | Reliable, with acknowledgment | Fast, no guarantees |
| Analogy | Phone call (confirms you heard) | Letter in the mailbox (send it and hope) |
| Connection | Connection-oriented (handshake) | Connectionless |
| Guaranteed delivery? | Yes (retransmits) | No |
| Ordering | Guaranteed | Not guaranteed |
| Speed | Lower (overhead) | Higher |
| Uses | HTTP, HTTPS, SSH, email | DNS, DHCP, VoIP, streaming, games |
The TCP Three-Way Handshake (memorize it)
Client Server
| ---- SYN --------------------> | "I want to connect" (seq x)
| <--- SYN + ACK --------------- | "ok, me too" (acknowledges x, sends y)
| ---- ACK --------------------> | "confirmed" (acknowledges y)
| |
| == connection established == |
Teardown uses FIN/ACK (four-way).
TCP flags (the "signals" inside the packet)
| Flag | Meaning |
|---|---|
| SYN | Start a connection (Synchronize) |
| ACK | Acknowledgment (Acknowledge) |
| FIN | Close the connection gracefully |
| RST | Reset/abort the connection abruptly |
| PSH | Push data immediately |
| URG | Urgent data |
Ports: the "room number" inside the host
The IP takes the packet to the machine; the port takes it to the right service. Ranges: 0–1023 well-known (22 SSH, 25 SMTP, 53 DNS, 80 HTTP, 443 HTTPS, 3389 RDP); 1024–49151 registered; 49152–65535 dynamic/ephemeral.
ss -tulpn # Linux (t=tcp, u=udp, l=listening, p=process, n=numeric)
netstat -tulpn # classic
netstat -ano # Windows (shows PID)
How this turns into port scanning (Nmap)
SYN Scan (-sS): sends a SYN and looks at the response. SYN+ACK = open; RST = closed. It doesn't complete the handshake (it never sends the final ACK): this is the "half-open" scan, stealthier. Connect Scan (-sT): completes the full handshake (noisier, logged more often). UDP Scan (-sU): slower and less certain, because UDP doesn't respond reliably.
The handshake is where the magic happens, on both sides. A SYN Flood (DoS) sends thousands of SYNs without ever completing the handshake, exhausting the server's connection table. In Wireshark, a flood of SYNs with no matching SYN+ACK screams "attack". Understanding flags lets you read any capture: you know whether a connection is being born (SYN), alive (ACK/PSH) or dying (FIN/RST).
12. HTTP and HTTPS: the most attacked application layer
HTTP is plain text, request-response: the client sends a request, the server returns a response.
| Method | What it asks for |
|---|---|
| GET | "Give me this resource" |
| POST | "I'm sending data" (login, form) |
| PUT | "Create/replace this resource" |
| DELETE | "Delete this resource" |
| HEAD | "Headers only, no body" |
| Range | Meaning | Examples |
|---|---|---|
| 2xx | Success | 200 OK, 201 Created |
| 3xx | Redirection | 301 (permanent), 302 (temporary) |
| 4xx | Client error | 401 (unauthenticated), 403 (forbidden), 404 (not found) |
| 5xx | Server error | 500, 502, 503 |
Headers carry extra information: User-Agent (browser), Cookie (session), Authorization (credentials), Host (which site), Content-Type (format). With plain HTTP everything travels in cleartext: in a MITM, anyone can read passwords and cookies. HTTPS = HTTP + TLS: the content is still HTTP, but nobody in the middle can read it.
The web is the largest attack surface today. Practically the entire OWASP Top 10 (SQL Injection, XSS...) happens at the HTTP layer. Reading requests and responses fluently is mandatory: suspicious headers, stolen cookies, malicious redirects (a 301 to a fake site). An odd User-Agent or a string of 404s may be someone brute-forcing directories.
13. TLS: how web encryption works
You and a friend want to exchange secret messages in a crowded café: first you agree on a key in secret, then you talk in that "encrypted language". TLS solves the hard problem: agreeing on a secret key in front of everyone, without anyone in the middle figuring it out.
1. ClientHello "hello, I support these versions and ciphers"
2. ServerHello + Certificate the server picks the cipher and sends the
certificate (public key signed by a CA)
3. Validation the client checks that the CA is trusted and the cert is valid
4. Key exchange both sides agree on a symmetric session key
5. Encrypted conversation using that fast (symmetric) key
Chain of trust: a CA (Let's Encrypt, DigiCert) signs the certificate; your OS/browser already trusts those CAs. You trust the CA → the CA vouches for the site.
TLS protects confidentiality and integrity, but it creates a dilemma: if everything is encrypted, how does the firewall inspect it? Enter TLS inspection (SSL inspection): a corporate proxy decrypts, inspects and re-encrypts. On the offensive side, attackers use TLS to hide C2 ("just another HTTPS connection"). Signs: self-signed certificates, freshly issued ones, odd validity periods, suspicious SNI/CN. Tools perform JA3/JA3S fingerprinting: they identify malware by the signature of how it performs the handshake, without reading the content.
14. VPN: the secure tunnel
Moving confidential documents along a public road full of bandits: a VPN is an armored tunnel over that road. The world sees that "something" is passing through, but can't open it. What it does: encrypts the traffic, encapsulates (tunnels) your packets inside other packets, and makes it look like you're on the network at the other end.
| Type | Where it operates | Typical use |
|---|---|---|
| IPsec | Layer 3 (network) | Site-to-site, corporate access |
| SSL/TLS VPN | Application layer | User remote access |
| WireGuard | Modern, lean | Fast, simple, increasingly popular |
A VPN is the legitimate entry point for remote access, which is why it's a priority target. Leaked credentials = an attacker walks in "from the inside". Many attacks (ransomware included) start with a misconfigured VPN or one without MFA. Defense: always enforce MFA on the VPN, monitor logins at odd hours or from unusual countries, and remember that once inside the tunnel, the user (or the attacker) is on the internal network.
15. Firewalls: the network's gatekeeper
A doorman with a list of rules: "who can come in, who can go out, and where to". From the simplest to the smartest:
- Packet Filter (stateless): looks at each packet in isolation (IP, port, protocol). Fast, but "dumb": it doesn't remember context.
- Stateful: keeps a state table; it knows that "this reply packet belongs to a connection I let out". Much more secure.
- Application Layer / Proxy: understands the protocol (HTTP, DNS) and inspects the content.
- Next-Generation (NGFW): stateful + DPI + application identification + IPS + TLS inspection. The enterprise standard (FortiGate, Palo Alto).
Allow LAN (192.168.1.0/24) → any : 443/TCP (outbound HTTPS)
Allow any → DMZ_Web (10.0.0.5) : 80,443 (access the website)
Deny any → any : any ← implicit deny
Golden rule: the last rule must be deny all. Only what is necessary is explicitly allowed; everything else is blocked. Least privilege applied to the network.
The firewall is the main control point and one of the best log sources. People who work in cyber read rules to find exposures ("why is port 3389 open to the entire internet?!") and read logs to detect scans, exfiltration and mass denied connections. The DMZ is the firewall applied to architecture: an intermediate zone between the internet and the internal network, where exposed services live.
16. Toolbox: the commands you'll actually use
ping: "are you alive?" (uses ICMP to test connectivity and latency):
ping google.com
ping -c 4 8.8.8.8 # Linux: only 4 packets
Careful: many firewalls block ICMP, so "no response" ≠ "it's down".
traceroute / tracert: "which way am I going?":
traceroute google.com # Linux
tracert google.com # Windows
dig / nslookup: "resolve this name for me":
dig google.com A
dig google.com MX +short
dig -x 8.8.8.8 # reverse
nslookup google.com # alternative
netstat / ss: "who is connected to this machine?" (the golden command for local investigation):
ss -tulpn # Linux (t/u tcp/udp, l listening, p process, n numeric)
netstat -tulpn # classic
netstat -ano # Windows (with PID)
A listening port that shouldn't be there may be a backdoor.
nmap: the Swiss Army knife of reconnaissance (discovers hosts, ports, services, versions and even the OS):
nmap 192.168.1.0/24 # live hosts on the subnet
nmap -sS -p- 192.168.1.10 # SYN scan on all ports
nmap -sV 192.168.1.10 # detects service versions
nmap -A 192.168.1.10 # aggressive: OS + versions + scripts
nmap -sU --top-ports 20 target # top 20 UDP ports
Only scan what you own or what you have written authorization to test. Scanning someone else's network may be a crime.
tcpdump: command-line packet capture (ideal for headless servers):
tcpdump -i eth0 # capture on interface eth0
tcpdump -i eth0 port 53 # DNS only
tcpdump -i eth0 host 192.168.1.10 # only to/from this host
tcpdump -i eth0 -w captura.pcap # save to open in Wireshark
tcpdump -i eth0 'tcp[tcpflags] & tcp-syn != 0' # only packets with the SYN flag
Wireshark: the packet microscope. Essential display filters:
ip.addr == 192.168.1.10 # traffic to/from this IP
tcp.port == 443 # port 443
http # HTTP only
dns # DNS only
tcp.flags.syn == 1 && tcp.flags.ack == 0 # SYNs only (spot scans)
tcp.analysis.retransmission # retransmissions
ip.addr == 10.0.0.5 && dns # DNS from that host (tunneling/C2)
Killer feature: right-click a packet → "Follow → TCP Stream" reassembles the entire conversation (full request and response, like a chat).
ping/traceroute/dig are for troubleshooting; nmap is reconnaissance; tcpdump/Wireshark are forensic analysis and detection. The skill worth its weight in gold is opening a capture of suspicious traffic and telling the story: who talked to whom, what was transferred, and why it is (or isn't) malicious.
17. Closing the loop: identifying suspicious communication
When looking at traffic, an analyst trains their eye for deviations from normal. Classic signs of malicious communication:
- Beaconing: an internal machine talks to the same external IP at regular intervals (every 60s). Malware "clocking in" with its C2.
- Exfiltration: a large volume of data leaving for an unusual destination, especially outside business hours.
- Anomalous DNS: queries to random/newly created domains, or giant subdomains (tunneling).
- Unusual ports: a service listening on a strange high port; an outbound connection to an atypical port.
- Handshakes that never complete: a flood of SYNs with no SYN+ACK (scan or SYN flood).
- Inconsistent ARP: the gateway's MAC changed, or two IPs share the same MAC (MITM).
- Unexpected lateral traffic: a workstation trying to connect to many others (lateral movement).
The common thread: you can only recognize the abnormal if you know the normal. The first job of anyone defending a network is to understand its traffic baseline.
OSI/TCP-IP: stacked layers; every attack lives in one. IP/Subnetting: address = network + host; 2^host − 2. ARP: local IP↔MAC, no auth → spoofing/MITM. DHCP: DORA; watch out for rogue DHCP. DNS: name→IP; the number one detection source. NAT: 1 public IP; translation logs are key. VLAN: segmentation; the foundation against lateral movement. TCP: handshake (SYN, SYN+ACK, ACK); flags tell the story. UDP: fast, no guarantees. HTTP/TLS: the most attacked layer; TLS protects but also hides C2. Firewall: allow what's necessary, deny the rest. Tools: ping/traceroute/dig (troubleshooting), nmap (recon), tcpdump/Wireshark (analysis).
Build a lab with 2–3 VMs (one Kali/attacker, one Linux victim, one Windows victim) on an isolated network. Capture an nmap scan's traffic in Wireshark and identify the three-way handshake, the RSTs from closed ports and the SYN+ACKs from open ones. Once you can "read" that capture on your own, the theory has become a skill.