Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Feb 2007 00:22:22 +0100
From:      Erik Norgaard <norgaard@locolomo.org>
To:        Erik Norgaard <norgaard@locolomo.org>
Cc:        FreeBSD Questions <questions@freebsd.org>
Subject:   Solved: Negation in tables for packet filter
Message-ID:  <45C90DAE.8070104@locolomo.org>
In-Reply-To: <45BCAC1F.80701@locolomo.org>
References:  <45BCAC1F.80701@locolomo.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a cryptographically signed message in MIME format.

--------------ms060004090608010003000202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Erik Norgaard wrote:

> I want to create two tables in my packet filter, the first should match 
> any valid public ip, so I created a table negating anything reserved:
> 
> table <internet> const { !0/8 !10/8 !127/8 !169.254/16 !172.16/12 \
>                     !192.0.2/24 !192.168/16 !198.18/15 !224/4 !240/4 }

Of course, I could do something different here, defining a table for 
<local> networks and negate it. The rest should be caught by the 
filtering rules anyway to block non-routable packets.

> I have three tables with 
> different registered hosts with different access levels, I want to 
> redirect unknown hosts to a page explaining what to do to get registered,
> 
> rdr on $wlan_if proto tcp from { $wlan_net !<super> !<users> !<free> } \
>      to <internet> port http -> 127.0.0.1 port 8000

This one is solved with:

no rdr on $wlan_if proto tcp from { <super> <users> <free> } \
       to <internet> port http
rdr on $wlan_if proto tcp from $wlan_net to !<local> \
       port http -> 127.0.0.1 port 8000

However, it would be nice to know if the documentation is incorrect, or 
there is a difference in how negation is treated in nat and filter 
respectively.

Thanks, Erik
--
Ph: +34.666334818                      web: http://www.locolomo.org

--------------ms060004090608010003000202
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIK6DCC
BXAwggRYoAMCAQICBEVUK6IwDQYJKoZIh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AgDANBggqhkiG9w0DAgIBQDAHBgUrDgMC
BzANBggqhkiG9w0DAgIBKDANBgkqhkiG9w0BAQEFAASBgKYgTrDe/QlLLW5HnAqiQALL3icX
I5iQP+r7R/MZVadit80F0GRiBFg8eJ84TK7/hJE1bb6gL8OKaNtluQXF+CulDd+u9VeyBgwQ
m6nB13NBdzq8ki29XG1Y/zrvtsPtAG3x+cFvEXgc2mkWcILKvuYZg12btqX1P/jXQJapXqxe
AAAAAAAA
--------------ms060004090608010003000202--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45C90DAE.8070104>