Skip to main content

How to use Packet Filter

Packet Filter is a network impairment simulation feature provided by GNS3. It allows you to simulate real-world network issues at the link layer, such as latency, packet loss, and packet corruption.

note

Only supported on specific node types: VPCS, Dynamips, QEMU, IOU, Cloud, NAT, Docker.

Quick Start

Step 1: Open the Packet Filter Interface

In the project topology, right-click on the link you want to configure and select Packet filters.

Right-click to select Packet filters

Step 2: Select Filter Type

In the Packet filters dialog, select the corresponding tab to configure the filter.

Packet filters dialog

Step 3: Configure Filter Parameters

Choose the filter type and configure its parameters:

Filter TypeFunctionParameters
Delay LatencyLatency1-32767ms
Delay JitterJitter0-32767ms
Packet lossRandom packet dropChance (0-100%)
Packet corruptionPacket corruptionChance (0-100%)
Frequency dropDrop one packet every N packetsFrequency (-1 to 32767, -1=drop all, 0=no filter)
BPFPrecise traffic filteringBPF expression (e.g., icmp, port 80)
note

Packet Filter rules take effect bidirectionally. For example, if you configure Delay Latency 100ms and Delay Jitter 20ms:

  • A → B direction: 100ms latency, ±20ms jitter
  • B → A direction: 100ms latency, ±20ms jitter

Step 4: Apply Configuration

After configuring the parameters, click the Apply button. A Packet Filter icon will appear on the link.

Packet Filter icon on link

Clearing Filters

Method 1: Reset Parameters

Open the Packet filters dialog and click the Reset button to quickly clear all parameters.

Reset button

Method 2: Delete the Link

Deleting the link will automatically clear all filter configurations.

BPF Expression Examples

BPF (Berkeley Packet Filter) supports precise traffic filtering using the same syntax as tcpdump:

ExpressionFunction
icmpDrop all ICMP traffic
port 80Drop traffic on port 80
host 10.0.0.1Drop traffic to/from a specific host
dst host 192.168.1.100 and port 80Drop traffic to a web server
src net 10.0.0.0/24Drop traffic from a specific subnet
tcp and not port 53Drop TCP traffic except DNS