From nobody Tue Oct 12 08:27:37 2021 X-Original-To: freebsd-net@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 3F8F617F0E17 for ; Tue, 12 Oct 2021 08:27:53 +0000 (UTC) (envelope-from shuriku@shurik.kiev.ua) Received: from mail.flex-it.com.ua (mail.flex-it.com.ua [193.239.74.7]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4HT81M6Zqrz3Jdx for ; Tue, 12 Oct 2021 08:27:51 +0000 (UTC) (envelope-from shuriku@shurik.kiev.ua) Received: from mail.lissoft.com.ua ([188.231.181.61] helo=thinkpad.flex-it.com.ua) by mail.flex-it.com.ua with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1maD8R-0002CQ-0r for freebsd-net@freebsd.org; Tue, 12 Oct 2021 11:27:43 +0300 Subject: Re: net.add_addr_allfibs - alternative usecases To: freebsd-net@freebsd.org References: From: Oleksandr Kryvulia Message-ID: <12fee2ec-5a32-48b8-ae85-87472ebab1ad@shurik.kiev.ua> Date: Tue, 12 Oct 2021 11:27:37 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 4HT81M6Zqrz3Jdx X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of shuriku@shurik.kiev.ua designates 193.239.74.7 as permitted sender) smtp.mailfrom=shuriku@shurik.kiev.ua X-Spamd-Result: default: False [-1.89 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[shurik.kiev.ua]; NEURAL_SPAM_MEDIUM(0.41)[0.413]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-0.999]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:35297, ipnet:193.239.72.0/22, country:UA]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N 04.10.21 10:33, Volodymyr Kostyrko пишет: > Hello. > > First of all, I came here not to agitate for any change, I want to > understand how my configuration is inefficient and how I can do that > better. > > I have two outgoing interfaces, if0 and if0. Those are different > internet providers, I even get ipv6 through second one, and that's > nice. I want to automatically fallback to the interface that is > working in case of outage. Also, I want some traffic only on one of > those interfaces. So I got 3 fibs: > > fib 0: default route > fib 1: default route is if0 > fib 2: default route is if1 > > Fibs 1-2 are used for traffic that should only pass through exactly > that interface. Traffic pinning is done with PF: > > pass out on $outside2 inet from ($outside2) queue(in_std2, in_priv2) > modulate state rtable 2 > > For example, I can test connectivity to both sides via: > > setfib 1 ping -qc 5 8.8.8.8 > setfib 2 ping -qc 5 8.8.8.8 > > And in case one of them doesn't work I can switch to other one by > changing routing on fib 0. > > Everything seems to work fine with net.add_addr_allfibs enabled. But > once it was disabled I started wondering whether I'm using the right > tools to solve my problem, or this can be done easier. Disabling > net.add_addr_allfibs means that only assigned interface will provide > default route for correspondent fib, and you can't manually add them > to the other fib. Or maybe I got that part totally wrong? > > Thanks in advance, any bit of knowledge would be appreciated. > Hi Yes, in your current scheme you need net.add_addr_allfibs enabled. As for me fibs are useful when you need to run jails or other local processes with different routing tables. To do PBR you can use pf's route-to/reply-to instead.