kb.erickguedes.com
Redes de Computadores: Fundamentos Práticos

Infraestrutura em Produção

Aula 6 de 6

Dispositivos de Rede

DispositivoCamadaFunção Principal
Switch2 (Enlace)Encaminhamento por MAC, VLAN
Roteador3 (Rede)Encaminhamento por IP, roteamento
Firewall3-4 (ou 7)Filtragem de tráfego por regras (ACL, stateful inspection, NGFW)
Load Balancer4-7Distribuição de tráfego entre servidores (health checks, SSL termination)
Proxy7 (Aplicação)Intermediação, cache, filtragem de conteúdo
WAF7Firewall de aplicação web (block SQLi, XSS)

Firewall — Tipos

TipoCaracterísticas
StatefulMantém tabela de estados (conexão permitida = tráfego de retorno permitido)
Stateless (ACL)Analisa pacote individualmente
NGFWInspeção profunda (DPI), IPS/IDS, filtragem por aplicação
WAFFocado em proteção de aplicações web (OWASP Top 10)

VLAN Design

Estrutura Típica

VLAN 10 — Voice         (192.168.10.0/24) — Telefonia IP
VLAN 20 — Data          (192.168.20.0/24) — Estações de trabalho
VLAN 30 — Management    (192.168.30.0/24) — Acesso a switches/roteadores
VLAN 40 — Guest         (192.168.40.0/24) — Wi-Fi visitantes (isolado)
VLAN 50 — DMZ           (192.168.50.0/24) — Servidores públicos
VLAN 99 — Native        (sem tag)        — Trunk nativa

Boas Práticas

  • Voice + Data: VLANs separadas para QoS (priorizar voz)
  • Management: acesso restrito por ACL, SSH apenas de IPs autorizados
  • Guest: isolamento completo, acesso apenas à internet
  • Native VLAN: mudar da VLAN 1 padrão (segurança)
  • VLAN hopping: desabilitar DTP (Dynamic Trunking Protocol)

QoS (Quality of Service)

Classificação e Marcação

Camada 2: CoS (Class of Service) — 3 bits no 802.1Q tag (0-7)
Camada 3: DSCP (DiffServ Code Point) — 6 bits no IP TOS field (0-63)

Classes comuns:
  EF (Expedited Forwarding)  — DSCP 46 — Voz (baixa latência)
  AF41                      — DSCP 34 — Vídeo
  AF21                      — DSCP 18 — Dados críticos
  BE (Best Effort)          — DSCP 0  — Tráfego padrão

Policing vs Shaping

TécnicaAçãoDescrição
PolicingDescartaExcede taxa → descarta pacote (pode marcar)
ShapingBufferizaExcede taxa → buffer (sem descarte, adiciona latência)
Policing: Trafego chegando a 100 Mbps → limite de 50 Mbps → descarta excesso
Shaping:  Trafego saindo a 100 Mbps → limite de 50 Mbps → bufferiza excesso

SDN (Software-Defined Networking)

Arquitetura

Aplicação Layer:  Firewall, Load Balancer, Monitoramento
         ↓ API (Northbound)
Control Layer:    Controller SDN (ONOS, OpenDaylight, Ryu)
         ↓ API (Southbound, ex: OpenFlow)
Infrastructure:   Switches/Roteadores (data plane)

Separação entre Control Plane (decisões) e Data Plane (encaminhamento).

Troubleshooting

Metodologia

  1. Identificar: qual sintoma? O que não funciona?
  2. Isolar: local, dispositivo, camada OSI?
  3. Testar: ping, traceroute, verificar portas
  4. Analisar: logs, captura de pacotes
  5. Resolver: aplicar correção, verificar resultado

Ferramentas Essenciais

# Ping — conectividade básica
ping -n 5 8.8.8.8
ping -n 5 -l 1472 -f 8.8.8.8   # Teste de MTU (Don't Fragment)

# Traceroute — caminho até o destino
tracert -d 8.8.8.8

# Telnet/Netcat — testar portas TCP
Test-NetConnection -ComputerName 10.0.0.1 -Port 443
# telnet 10.0.0.1 443 (se habilitado)

# Verificar portas abertas localmente
netstat -an | findstr "LISTENING"
netstat -an | findstr "ESTABLISHED"

# Estatísticas de interface
Get-NetAdapterStatistics -Name "Ethernet"

# Verificar resolução DNS
nslookup google.com 8.8.8.8

# mtr (combinado ping + traceroute) — via WSL
# mtr 8.8.8.8

# pathping (Windows)
pathping -n 8.8.8.8

# ss (Linux) — equivalente moderno ao netstat
# ss -tuln

# Ver interface e gateway
Get-NetIPConfiguration | Select-Object InterfaceAlias, IPv4Address, IPv4DefaultGateway

Lab: Cenário de Diagnóstico

# 1. Verificar configuração básica
Get-NetIPConfiguration | Format-List

# 2. Testar gateway local
ping -n 2 (Get-NetRoute -DestinationPrefix "0.0.0.0/0").NextHop

# 3. Verificar DNS
nslookup google.com 8.8.8.8

# 4. Mapear caminho completo
tracert -d 8.8.8.8

# 5. Verificar portas de escuta
netstat -an | findstr "LISTEN"

# 6. Testar porta específica (conectividade TCP)
Test-NetConnection -ComputerName google.com -Port 443

# 7. Ver estatísticas da interface (perdas de pacote)
Get-NetAdapterStatistics -Name "Ethernet" |
    Select-Object ReceivedDiscardedPackets, ReceivedErrors, TransmittedDiscardedPackets

# 8. Ver tabela ARP e verificar MACs
arp -a

# 9. Ver vizinhos IPv6
Get-NetNeighbor -AddressFamily IPv6 | Format-Table

# 10. Validar MTU
ping -n 2 -l 1472 -f 8.8.8.8

Em produção, 80% dos problemas estão na camada física (cabo, energia) ou DNS. Comece pelo ping ao gateway, depois teste DNS, depois caminho completo. Ferramentas de troubleshooting bem utilizadas resolvem a maioria dos incidentes em minutos.