[Snort-users] bpf filter to filter on *starting* port?

Rich Graves rgraves at ...15021...
Tue Feb 8 15:44:41 EST 2011

> I could use "not port 9000" - but that will match
>> - so I'd end up throwing away good data

not (src port 9000 and src net 1.2.3 and tcp[tcpflags] != tcp-syn) and not (dst port 9000 and dst net 1.2.3 and tcp[tcpflags] != (tcp-syn|tcp-ack))

This would log the syn and syn-ack packets of any outbound connection with source 9000. Payload, you still don't get, but at least you'll know that you missed something.

Depending on your ultimate goal, you might consider having your firewall or border router reject syns from source port 9000. Any client that happens to choose that source port will retry. Make sure you send unreachables/resets from your interior interface -- best practice is to turn them off for outside.

More information about the Snort-users mailing list