Question

I am using libpcap to capture GRE packets and forward now, I think the efficiency is not very good.

so I decide to do forwarding with netfilter, but I am new for this. Could someone gives me one

simple example to capture IP or GRE packets with netfilter? thanks!

Was it helpful?

Solution

It's not clear what you're trying to accomplish. Are you trying to capture the packets for analysis (like wireshark or tcpdump), or forward traffic through a GRE tunnel?

If you're trying to capture traffic for analysis, using netfilter doesn't make much sense. It's probably possible, using something like the QUEUE target to pass packets to userspace, but I doubt you'd get better performance than using libpcap with suitable BPF rules.

If you're trying to forward traffic through a GRE tunnel, the normal way to do that is to set up a gre tunnel interface; do man ip and look at the "tunnel" section. The tunnel interface (e.g. gre0) is a normal network interface that the system's routing table can send packets to.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top