Skip to content

Netfilter Module

zerepolbap edited this page Jun 15, 2026 · 2 revisions

We are using Netfilter Queues, a user-space library providing an API to packets that have been queued by the Linux kernel packet filter. It requires filtering rules to queue the packets coming in or out through a specific route, port or IP. The filtered packets are added to the configured queue and FikoRE decides if they should be accepted, accepted with CE marking, or dropped.

The recommended way to configure Netfilter Queues is the FikoRE NFQUEUE lab described in Run Scripts and NFQUEUE Lab. The lab script creates the namespaces, veth pairs, routes and iptables rules. The .ini file only needs to define real UEs with queue numbers matching the lab plan.

The Netfilter Queue configured ID is given to the specific UE using the configuration file:

[UE]
ue_id: capturedStudy
ue_type: 0
ul_queue_n: 100
dl_queue_n: 101
n_ues: 1

Which define:

  • ue_type: if 0, real IP traffic is assigned to the user, and the configured Netfilter Queues are handled.
  • ul_queue_n / dl_queue_n: unique Netfilter Queue IDs configured for the UL and DL streams.
  • n_ues: number of real UEs created from this group. For a captured UE this is normally 1.

In the default lab topology, UE1 uses queues 100/101, UE2 uses 110/111, and the same pattern continues with a step of 10.

Implementation Flow

FikoRE interfaces with Netfilter Queues through the packet capture module. For every real-traffic UE, each transmission direction uses a captured_packet_handler backed by pkt_capture. Captured packet metadata is converted into virtual packets with the same packet ID, size and ECN state. These virtual packets enter the common PDCP/RLC flow.

Once the emulator has modeled scheduling, HARQ, delay, queueing and potential losses, the captured packet handler applies one of the final verdicts to the original packet:

  • Accept the packet.
  • Accept the packet with CE marking.
  • Drop the packet.

This makes the real traffic experience the emulated radio behavior while keeping the radio and packet-processing logic common between captured and simulated traffic.

Manual Rules

Manual iptables rules are still possible, but they are not the recommended entry point. If you configure them manually, make sure that:

  • The queue numbers match ul_queue_n and dl_queue_n in the .ini.
  • Uplink and downlink traffic are sent to different queues.
  • FikoRE has enough privileges to open the queues and apply verdicts.

For most experiments, use run_scripts/run_fikore_nfqueue_lab.sh or run_scripts/run_emulated.sh instead.

Clone this wiki locally