From nobody Mon Dec 08 13:38:22 2025 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dQ33C0mCFz6Jpcf for ; Mon, 08 Dec 2025 13:38:31 +0000 (UTC) (envelope-from imb@protected-networks.net) Received: from mail.protected-networks.net (mail.protected-networks.net [202.12.127.228]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protected-networks.net", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dQ33B1DLxz3gXk for ; Mon, 08 Dec 2025 13:38:30 +0000 (UTC) (envelope-from imb@protected-networks.net) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=protected-networks.net header.s=201508 header.b=gW1QjuLW; dmarc=pass (policy=reject) header.from=protected-networks.net; spf=pass (mx1.freebsd.org: domain of imb@protected-networks.net designates 202.12.127.228 as permitted sender) smtp.mailfrom=imb@protected-networks.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= protected-networks.net; h=content-transfer-encoding:content-type :content-type:in-reply-to:from:from:content-language:references :subject:subject:user-agent:mime-version:date:date:message-id; s=201508; t=1765201102; bh=x0vrTywFoevwc7uhX9EE59KMAZCt1K8qcdYS mhIjWmg=; b=gW1QjuLWT8NeAIrDzkG8i8FnWaDB4i2UN5KRxKz3LjIL7xX/RYiM KUW7QRzNKAKQ0q6yoQexjX9tbGGIH64ZET9JS4vMikyId/torqcFjIJ3COGvL/Am eZP09e6PNuPTx4trmpXQWUadAS3t4ZMEat08k0xbszo92wmUarMTzWo= Received: from [192.168.1.9] (d5540.auburn.protected-networks.net [192.168.1.9]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: imb@mail.protected-networks.net) by mail.protected-networks.net (Postfix) with ESMTPSA id 5F93BF49D; Mon, 08 Dec 2025 08:38:22 -0500 (EST) Message-ID: <75037780-3748-4cf3-8a44-a0e9c0b76e06@protected-networks.net> Date: Mon, 8 Dec 2025 08:38:22 -0500 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: fib selection and persistence using ipfw To: Rozhuk Ivan Cc: freebsd-current References: <20350073-abc5-4116-9fd7-8e8f708a26d4@protected-networks.net> <20251208031147.393b2391@rimwks.local> Content-Language: en-NZ From: Michael Butler In-Reply-To: <20251208031147.393b2391@rimwks.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Bar: --- X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; DMARC_POLICY_ALLOW(-0.50)[protected-networks.net,reject]; R_SPF_ALLOW(-0.20)[+mx:c]; R_DKIM_ALLOW(-0.20)[protected-networks.net:s=201508]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_ONE(0.00)[1]; BLOCKLISTDE_FAIL(0.00)[202.12.127.228:server fail]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[protected-networks.net:+] X-Rspamd-Queue-Id: 4dQ33B1DLxz3gXk On 12/7/25 20:11, Rozhuk Ivan wrote: > On Sun, 7 Dec 2025 17:28:49 -0500 > Michael Butler wrote: > >> Having two upstream providers, I'm trying to enforce symmetric >> routing which, in OpenBSD's pf config can be implemented using .. >> >> # Inbound control-plane to the firewall itself (per-WAN reply-to for >> symmetry) >> pass in on $wan_a proto { tcp, udp, icmp } to ($wan_a) \ >> reply-to ($wan_a $gw_a) keep state >> pass in on $wan_b proto { tcp, udp, icmp } to ($wan_b) \ >> reply-to ($wan_b $gw_b) keep state >> >> I've tried all manner of ipfw packet tagging in the hope that it >> would yield similar results, e.g. >> >> setfib 1 ip from any to any recv tap0 >> setfib 1 ip from any to any tagged 1 >> count tag 1 ip from any to any recv tap0 >> >> [ .. ] >> >> check-state >> allow ip from .. keep-state >> deny log ip from any to any >> >> Is anyone else doing something like this on -current? > > > Actually no, but: > ifconfig vlan1001 172.16.0.31/24 fib 1 > ifconfig vlan1002 172.16.0.32/24 fib 2 > > Do not forget set fib to network interface like it done in examlpe. > In my case if same IP+mask set on more than one net if - only last one will process packets to sockets. Interface FIBs only work when the connection stays on the same machine. In my case, I want to sustain the routing state for packets traversing it. ISP-A -> Border-GW -> Mail-Server ^ ISP-B-----| Border-GW has multiple FIBs defined and sets the relevant FIB as packets arrive over their respective interfaces. Destination address is the same (Mail-Server). When a connection is established, there is an IPFW state table entry in the kernel on Border-GW and which contains the FIB in ipfw_dyn_rule->id->fib What isn't happening is that replies (e.g. SYN-ACK) don't go out the interface on which the SYN arrived despite having that info :-( Is this possible with IPFW? If not, will it work with PF on FreeBSD? I did see some historical notes about 'reply-to' and don't know if they're relevant, Michael