From nobody Wed Dec 10 15:40:41 2025 X-Original-To: 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 4dRKgY5wcKz6KlVr for ; Wed, 10 Dec 2025 15:40:57 +0000 (UTC) (envelope-from john@sanren.ac.za) Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dRKgX5rckz3Y7g for ; Wed, 10 Dec 2025 15:40:56 +0000 (UTC) (envelope-from john@sanren.ac.za) Authentication-Results: mx1.freebsd.org; none Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-37d056f5703so62320291fa.0 for ; Wed, 10 Dec 2025 07:40:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sanren-ac-za.20230601.gappssmtp.com; s=20230601; t=1765381253; x=1765986053; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=6WHTcSxhSCv7Fvm/+IHt3cMIrS5uUi5BAH1UgLKer2I=; b=tLt6MzQWJw8bgjgRUrGjlVc0CHi4o1wCPAoTbVbuo2IJp4tBodSizR+LCx7ySVLLrY M7ysjSDM6o5N1v9Ag+tN882lz1A1QsV93qply8njpctalfGu8Iy7aWLWy9uZLxKiXM1f FL125lF2e255J70QXSEaWHqXNG4i8kkKfgTOuqOsdfJyBjsFasMphcF3flISFiwFnYhH 4oNcDyqxfbcqz7gqX0Km/JDp3QlfaHsvz7kbvgIvVpHwfcUOkSo6Y3Q+aoSk7538QTEG j2x9DI5u6enq5PHnxkhPZ+1d1X8dok27+qE/fWhpvwgQu+6Y6k0aj7IoOR7gMR9hk9rw piqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765381253; x=1765986053; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6WHTcSxhSCv7Fvm/+IHt3cMIrS5uUi5BAH1UgLKer2I=; b=Hkzc3iAxBvI7MjFMQqr2FykZNW0uyR9hmDItP/OT4sEAZ27tDaqQbDrYlgK75x4chP Xb7ny3ckmUT+dBDiK0SCa0NGBlxy4vd7VpMSO3uzRPLOy0O0Dp3GeAF9ZxVZnLGPvwVR Tw552hWaKATCoXf1RJ1EsX+ggIGfsfWQ9VOnuBQ5HOU49cxOgulRTIZr1Q9arZiMHqcN JQZ48qt1y3KrQobeuI9ychRKPjMW2lSCKZQQRWSXFm0Yw1ZN8W8itYLf/8ZI4r4KMgFH +0XK5gR3mF3Pp0DUvScCwOC3VSkKFBXSXTyuEvqBkB7/DNQ/WiJtNBN1kG0RbdwxQ5SK U7pQ== X-Gm-Message-State: AOJu0Yzsfkklk+6VE63Cu3cZ9l2NoF3TycDPVWOVIEuyypvQipN0r3Rk OkzD8dNXp+hZv3LNaDrrl+KgHSSp9kb9Nn97eAWg8WhzTTxfNXCX5a9IwcxzIDF8Lvf6CtivRt1 yZB4v65jhnuJmX1Mc46xg5v8HhUrW0pbGfXdeKHED2Q== X-Gm-Gg: AY/fxX7k3gFrAJAYFzDVuALV5ahlu/1RWlnA4YT02gLjljuv3DyyJEWZrPvw8wlQZ/N ikj1zszMES/A7OF2g5c85/jjCNbEDKZbOhFqCxo9tNeETVPgibIAr7haDDbdPlnKMhY4atNPaGZ mfinF9WFzn2eeaoAPXXrxyKhjrFd6wczJiKXxyxxMZLMc9byO/ZnZBQS/SuqAFPKcebN4Zmdexz QDzg/lJCykXn5ijIuZKYO+kRFz4z1cVybWVpziLbSGW+Yh0LQsYZsw4LWobZB8NZX8fEKyfQFuC TN0= X-Google-Smtp-Source: AGHT+IFGyx6sVURdmJikY6giOLy68GmFSzlbspb4X/0+xdlU1ZD18SZxQquZvUspCkCB5AYG2Amf5hb2YcowFtuPikI= X-Received: by 2002:a2e:be2c:0:b0:37b:9771:4f41 with SMTP id 38308e7fff4ca-37fb213b94amr8534191fa.37.1765381253039; Wed, 10 Dec 2025 07:40:53 -0800 (PST) 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 References: <3C76FF27-49A7-4C45-8E8F-51C1BBF3C6E0@lysator.liu.se> In-Reply-To: <3C76FF27-49A7-4C45-8E8F-51C1BBF3C6E0@lysator.liu.se> From: John Hay Date: Wed, 10 Dec 2025 17:40:41 +0200 X-Gm-Features: AQt7F2rXsnPfDe1ar_rM8IPDl4xCwVjc_c1_eVAClwqT5cq4wXWiy7P6e4e50UI Message-ID: Subject: Re: Is it possible to force packets to go over a loopback cable? To: Peter Eriksson Cc: "net@freebsd.org" Content-Type: multipart/alternative; boundary="0000000000007b17e106459ada6d" X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4dRKgX5rckz3Y7g --0000000000007b17e106459ada6d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Peter, On Wed, 10 Dec 2025 at 16:25, Peter Eriksson wrote: > I=E2=80=99d like to find some way to force FreeBSD to send a stream of pa= cket 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=E2=80=99ve 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=E2=80=A6 > > Any suggestions? :-) > > - Peter > You can use a jail + vnet. There are examples in this pdf: https://freebsdfoundation.org/wp-content/uploads/2020/03/Jail-vnet-by-Examp= les.pdf I do something similar. There are basically 3 steps. Create the vnet capable jail, move the interface inside, configure the address(es). Here is one half of it: ######## if1=3D"mce0" if1_jail_name=3D"via_mce0" if1_ip=3D"10.0.0.1/24" if1_testip=3D"10.0.0.2" jail -i -c name=3D${if1_jail_name} host.hostname=3D${if1_jail_name} vnet pe= rsist ifconfig ${if1} vnet ${if1_jail_name} jexec ${if1_jail_name} ifconfig ${if1} ${if1_ip} # Check by pinging the other side echo jexec ${if1_jail_name} ping -c 3 ${if1_testip} jexec ${if1_jail_name} ping -c 3 ${if1_testip} ######### John --0000000000007b17e106459ada6d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi=C2=A0Peter,

On We= d, 10 Dec 2025 at 16:25, Peter Eriksson <pen@lysator.liu.se> wrote:
I=E2=80=99d like to find some way to force FreeBSD= to send a stream of packet over a loopback cable connected between two eth= ernet ports on the same machine, but it seems FreeBSD also short-circuits i= t and handles that traffic internally in the OS. Which normally is a good t= hing for speed, but bad when you are trying to test suspect cables :-)

I=E2=80=99ve found references that back in the pre-FreeBSD 10 days there us= ed to exist a sysctl:

=C2=A0 net.link.ether.inet.useloopback

that could be set to 0 to disable this internal shortcut and force the pack= ets out onto the cable=E2=80=A6

Any suggestions? :-)

- Peter

You can use a jail + vnet. Ther= e are examples in this pdf:
=

I do something similar. There are basically 3 steps. Cr= eate the vnet capable jail, move the interface inside, configure the addres= s(es).

Here is one half of it:
########<= /div>
if1=3D"mce0"
if1_jail_name=3D"via_mce0"if1_ip=3D"10.0.0.1/24"
if1= _testip=3D"10.0.0.2"
jail -i -c name=3D${if1_jail_name}= host.hostname=3D${if1_jail_name} vnet persist
ifconfig ${if1} vn= et ${if1_jail_name}
jexec ${if1_jail_name} ifconfig ${if1} ${if1_= ip}

# Check by pinging the other side
echo jexe= c ${if1_jail_name} ping -c 3 ${if1_testip}
jexec ${if1_jail_name} ping -= c 3 ${if1_testip}
#########

John


--0000000000007b17e106459ada6d--