iptables rule to submit packets matching a specific negative rule

Posted by Aditya Sehgal on Server Fault See other posts from Server Fault or by Aditya Sehgal
Published on 2010-06-16T16:47:27Z Indexed on 2010/06/16 16:53 UTC
Read the original article Hit count: 319

Filed under:
|

I am using netfilter_queue to pick up certain packets from the kernel and do some processing on them. To, the netfilter queue, I need all packets from a particular source except UDP packets with src port 2152 & dst port 2152.

I try to add the iptable rule as

iptables -A OUTPUT ! s 192.168.0.3 ! -p udp ! --sport 2905 ! --dport 2905 -j NFQUEUE --queue-num 0

iptables throw up an error of Invalid Argument. Querying dmesg, I see the following error print

ip_tables: udp match: only valid for protocol 17

I have tried the following variation with the same error thrown.

iptables -A OUTPUT ! s 192.168.0.3 ! -p udp --sport 2905 --dport 2905 -j NFQUEUE --queue-num 0

Can you please advise on the correct usage of the iptables command for my case.

© Server Fault or respective owner

Related posts about linux

Related posts about iptables