Date: Wed, 10 Dec 2025 14:44:38 +0000 From: Tom Smyth <tom.smyth@wirelessconnect.eu> To: Peter Eriksson <pen@lysator.liu.se>, freebsd-net@freebsd.org Subject: Re: Is it possible to force packets to go over a loopback cable? Message-ID: <CAJ3iMJSsRWwNjXvG8_FYy3pBU1R7N468t0oRyG6A=RTZEVTe3g@mail.gmail.com> In-Reply-To: <3C76FF27-49A7-4C45-8E8F-51C1BBF3C6E0@lysator.liu.se> References: <3C76FF27-49A7-4C45-8E8F-51C1BBF3C6E0@lysator.liu.se>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] Hi Peter im guessing Loopback cable as in a cross over cable between two interfaces.. as opposed to a loopback cable plugged into the one interface (ie tx - rx wired together) in principle you want to put the interface you are routing to into a different routing domain... so lets just say you have IP address A on interface A on the loopback cable, and IP address B on the interface B on the loopback cable, put interface B into a different VRF (networking language) / Routing domain Rtable (openbsd terminology) ... run the process you want to send packets inside the VRF listening on IP address B ... and set the default gateway routing out to Interface A ... but that is the approach I would use. which just uses routing and the physical cross over cable between two interfaces... and all that can be done without VRF leaking in the firewall support in PF Im not sure how to do that in FreeBSD... but im sure they support the same functionality ... Tom Smyth On Wed, 10 Dec 2025 at 14:25, Peter Eriksson <pen@lysator.liu.se> wrote: > I’d like to find some way to force FreeBSD to send a stream of packet over > a loopback cable connected between two ethernet ports on the same machine, > but it seems FreeBSD also short-circuits it and handles that traffic > internally in the OS. Which normally is a good thing for speed, but bad > when you are trying to test suspect cables :-) > > I’ve found references that back in the pre-FreeBSD 10 days there used to > exist a sysctl: > > net.link.ether.inet.useloopback > > that could be set to 0 to disable this internal shortcut and force the > packets out onto the cable… > > Any suggestions? :-) > > - Peter > -- Kindest regards, Tom Smyth. [-- Attachment #2 --] <div dir="ltr">Hi Peter <div>im guessing Loopback cable as in a cross over cable between two interfaces.. as opposed to a loopback cable plugged into the one interface (ie tx - rx wired together) </div><div><br></div><div>in principle you want to put the interface you are routing to into a different routing domain... </div><div><br></div><div>so lets just say you have IP address A on interface A on the loopback cable, and IP address B on the interface B on the loopback cable, </div><div><br></div><div>put interface B into a different VRF (networking language) / Routing domain Rtable (openbsd terminology) ...</div><div><br></div><div>run the process you want to send packets inside the VRF listening on IP address B ... and set the default gateway routing out to Interface A ... </div><div><br></div><div><br></div><div>but that is the approach I would use. which just uses routing and the physical cross over cable between two interfaces... </div><div><br></div><div>and all that can be done without VRF leaking in the firewall support in PF </div><div><br></div><div>Im not sure how to do that in FreeBSD... but im sure they support the same functionality ... </div><div><br></div><div><br></div><div>Tom Smyth </div><div><br></div><div><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, 10 Dec 2025 at 14:25, Peter Eriksson <<a href="mailto:pen@lysator.liu.se">pen@lysator.liu.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I’d like to find some way to force FreeBSD to send a stream of packet over a loopback cable connected between two ethernet ports on the same machine, but it seems FreeBSD also short-circuits it and handles that traffic internally in the OS. Which normally is a good thing for speed, but bad when you are trying to test suspect cables :-)<br> <br> I’ve found references that back in the pre-FreeBSD 10 days there used to exist a sysctl:<br> <br> net.link.ether.inet.useloopback<br> <br> that could be set to 0 to disable this internal shortcut and force the packets out onto the cable…<br> <br> Any suggestions? :-)<br> <br> - Peter<br> </blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Kindest regards,<br>Tom Smyth.</div>help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ3iMJSsRWwNjXvG8_FYy3pBU1R7N468t0oRyG6A=RTZEVTe3g>
