Re: How to force network packets across network instead of loopback

From: Sad Clouds <cryintothebluesky_at_gmail.com>
Date: Thu, 11 Sep 2025 10:19:40 UTC
On Thu, 11 Sep 2025 10:52:14 +0100
Frank Leonhardt <freebsd-doc@fjl.co.uk> wrote:

> I haven't tested this but like any sane OS it will optimise local 
> traffic this way unless you trick it. One way might be to assign 
> different subnets to each interface. Then add a route between them.

Hi, thanks for the suggestion. I think I tried adding different subnets
and also using multiple routing tables with setfib, but none of that
seemed to work properly. I was trying to avoid using packet filters, as
they probably add overhead and latency to network I/O paths.

Then I setup several VNET jails, and that seems to force packets across
the physical network. So I'll be using this method for performance
testing.

On Solaris this setup is quite easy, just enable symmetric routing:

$ ipadm set-prop -p hostmodel=strong ipv4
$ ipadm set-prop -p hostmodel=strong ipv6

I was hoping for something similar on FreeBSD, but apart from
net.inet.ip.rfc1122_strong_es which doesn't quite achieve the same
effect, I could not find anything.