From owner-freebsd-ipfw@freebsd.org Sat Jan 28 13:04:46 2017 Return-Path: Delivered-To: freebsd-ipfw@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82ED5CC3BAA for ; Sat, 28 Jan 2017 13:04:46 +0000 (UTC) (envelope-from freebsd@rakor-net.de) Received: from mail.denkrobat.de (mail.denkrobat.de [176.9.53.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.denkrobat.de", Issuer "StartCom Class 1 DV Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id EA7BA1E2A for ; Sat, 28 Jan 2017 13:04:45 +0000 (UTC) (envelope-from freebsd@rakor-net.de) Received: from martins-mbp.fritz.box (062-142-067-156.ip-addr.inexio.net [156.67.142.62]) by mail.denkrobat.de (OpenSMTPD) with ESMTPSA id c5d25bac TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO for ; Sat, 28 Jan 2017 13:58:01 +0100 (CET) From: Rakor Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: How to use IPFW to filter routing Message-Id: <3C00AFCB-E2EF-4F89-8FBD-181C99DAC1FF@rakor-net.de> Date: Sat, 28 Jan 2017 13:58:01 +0100 To: freebsd-ipfw@FreeBSD.org X-Mailer: Apple Mail (2.3259) X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2017 13:04:46 -0000 Hi there, I have a router from my ISP giving me a connection to the internet ans = SIP. Behind I have a FreeBSD-Box which should route and seperate my = VLANS. The setup is like this: +------------+ +------------+ = +------------+ VLAN1 10.10.10.0/24 | ISP-Router | 192.168.2.0/24 | BSD-Router | Trunk | = L2-SWITCH |----------- Internet---| |------------------| |----------| = VLANS | VLAN2 10.10.20.0/24 | | igb2 | IPFW | igb0 | = |----------- +------------+ +------------+ = +------------+ VLAN3 10.10.30.0/24 = ----------- I can route my VLANs to the Internet and I can route traffic from one = VLAN to another VLAN, all without using IPFW. But I don't know how to = setup my IPFW. Lets say VLAN1 is allowed to communicate with VLAN2 and = with the internet. VLAN3 is allowed to communicate only with the = internet. As far as I know a packet is once scanned by IPFW an then first hit = wins. So, if I set the following a packet coming from VLAN3 for port 80 = is permitted to travel all way it wants, even to VLAN2. Putting an other = rule behind just allowing to travel out using igb2 is not checked, = because the search terminated after first hit. ipfw add allow tcp 10.10.30.0/24 to any 80 setup keep-state If I try the follwing the packets are all rejected. I think the = inspection is done before the routing, so IPFW does not know it should = be forwarded using igb2. ipfw add allow tcp 10.10.30.0/24 to any 80 out via igb2 setup = keep-state So I don=E2=80=99t know how to filter packets that should be routed in a = exact manner. Can you help me? Thanks Rakor=