What is Traffic Mirroring?
Traffic mirroring (also called port mirroring or SPAN) creates a copy of network packets and sends them to a monitoring destination. Metlo receives this mirrored traffic and analyzes it for:- Endpoint discovery
- Sensitive data detection
- Attack patterns
- API behavior analysis
Traffic mirroring is completely passive—Metlo receives a copy of traffic but cannot block or modify requests. For active blocking, you need Metlo agents deployed inline.
Benefits of Traffic Mirroring
No Code Changes
Analyze APIs without modifying application code or deploying agents
Zero Performance Impact
Mirrored traffic is processed out-of-band, no latency added to production
Complete Visibility
See all API traffic, including from third-party services you don’t control
Multi-Cloud Support
Works across AWS, GCP, Azure, and on-premises infrastructure
AWS Traffic Mirroring
AWS provides native VPC Traffic Mirroring for EC2 instances.Prerequisites
- EC2 instances running your API servers (source)
- Metlo ingestor instance (target)
- Both in the same VPC or with VPC peering configured
- Supported instance types (Nitro-based instances)
Setup Steps
Deploy Metlo Ingestor
Launch a Metlo ingestor EC2 instance to receive mirrored traffic. This runs the Metlo packet capture service.
AWS Mirroring Best Practices
- Instance Type: Ensure source instances are Nitro-based (most modern EC2 types)
- Target Sizing: Size the ingestor based on traffic volume (start with t3.medium, scale up if needed)
- Session Limits: AWS limits 3 mirror sessions per source interface
- Costs: Mirroring has data transfer costs—monitor usage
GCP Packet Mirroring
GCP provides Packet Mirroring for VPC networks.Prerequisites
- Compute Engine instances running your APIs
- Metlo ingestor instance
- VPC network with packet mirroring enabled
Setup Steps
Create Instance Group
Add the collector to an unmanaged instance group (required for packet mirroring)
Configure Packet Mirroring Policy
Create a policy specifying:
- Mirrored sources: Your API server instances/subnets
- Collector: The Metlo ingestor instance group
- Filter: IP protocol and port ranges (TCP 80, 443)
- Go to VPC Network → Packet Mirroring
- Click “Create Mirroring Policy”
- Configure:
- Name:
metlo-api-mirroring - Source: Select API server instances or subnets
- Collector: Select Metlo ingestor instance group
- Filter:
- Protocol: TCP
- IP ranges: 0.0.0.0/0 (or restrict to API traffic)
- Ports: 80, 443, 8080, etc.
- Name:
- Click “Create”
GCP Mirroring Considerations
- Mirroring Ratio: GCP samples 1 in N packets by default—set to 1.0 for complete capture
- Load Balancers: Configure mirroring on backend instances, not the load balancer
- Cross-Region: Packet mirroring works within a single region only
Azure Network Watcher
Azure uses Network Watcher packet capture for traffic mirroring.Setup Overview
Azure packet capture has different capabilities than AWS/GCP mirroring. For production deployments, consider using Network Security Group (NSG) flow logs with a custom processor that forwards to Metlo.
Kubernetes Traffic Mirroring
For containerized APIs in Kubernetes, use service mesh or sidecar-based mirroring.Using Istio
Istio’s Envoy sidecars can mirror traffic:Using Tap
Deploy Metlo as a sidecar with iptables rules to tap traffic:On-Premises Mirroring
For on-premises deployments, configure port mirroring on your network switches.Switch Configuration
Most enterprise switches support SPAN (Switched Port Analyzer): Cisco Example:- Identify the switch port(s) carrying API traffic (source)
- Connect Metlo ingestor to an unused switch port (destination)
- Configure SPAN session to mirror source → destination
- Verify mirrored traffic is reaching Metlo
TAP Devices
For physical network taps:- Install network TAP inline with API servers
- Connect TAP’s monitor port to Metlo ingestor
- Configure Metlo to capture from the network interface
Verifying Traffic Mirroring
After configuration, verify Metlo is receiving traffic:Check Ingestor Logs
SSH to the Metlo ingestor and check logs:You should see packets being processed.
If endpoints aren’t appearing, check firewall rules, security groups, and ensure the Metlo ingestor can receive packets on the mirrored port.
Troubleshooting
No Traffic Received
Check:- Mirror session is active and correctly configured
- Security groups allow traffic to ingestor
- Ingestor service is running:
systemctl status metlo-ingestor - Network interface is in promiscuous mode:
ifconfig eth0 promisc
Partial Traffic Capture
Possible causes:- Packet sampling is enabled (reduce sampling rate)
- MTU mismatch causing packet fragmentation
- Ingestor CPU/network bandwidth saturated (scale up)
High Costs
Optimize:- Filter mirroring to only HTTP/HTTPS ports
- Mirror specific source instances rather than entire subnets
- Use sampling for high-volume APIs (though this reduces detection accuracy)
- Review data transfer costs and adjust configuration
Mirroring vs. Inline Agents
Traffic Mirroring
Pros:
- No code changes
- Zero latency impact
- See all traffic
- Cannot block attacks
- May miss encrypted traffic
- Additional infrastructure
Inline Agents
Pros:
- Can block malicious requests
- More accurate traffic capture
- No cloud provider dependencies
- Requires code changes
- Minimal latency added
- Per-language implementation
Best Practices
Start Small
Begin by mirroring traffic from a subset of API servers, validate it works, then expand
Monitor Costs
Traffic mirroring incurs data transfer costs—set up billing alerts
Filter Aggressively
Only mirror API traffic (HTTP/HTTPS)—avoid mirroring database or internal service traffic
Right-Size Ingestors
Scale ingestor instances based on traffic volume—one ingestor per 1-5 Gbps of traffic
Encrypt Mirrored Traffic
Use VPN or private connectivity between sources and Metlo ingestor