From nobody Thu Jul 18 16:11:53 2024 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 4WPyVn02hvz5RgMx for ; Thu, 18 Jul 2024 16:12:01 +0000 (UTC) (envelope-from sm@codenetworks.net) Received: from relayout02-q04.dominioabsoluto.net (relayout02-q04.dominioabsoluto.net [217.116.26.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4WPyVm0R7hz4Lt7 for ; Thu, 18 Jul 2024 16:12:00 +0000 (UTC) (envelope-from sm@codenetworks.net) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=codenetworks.net header.s=domabs header.b=pXqqU+Is; dmarc=none; spf=pass (mx1.freebsd.org: domain of sm@codenetworks.net designates 217.116.26.80 as permitted sender) smtp.mailfrom=sm@codenetworks.net Received: from relayout02-redir.dominioabsoluto.net (relayout02-redir.dominioabsoluto.net [217.116.26.75]) by relayout02.dominioabsoluto.net (Postfix) with ESMTP id 4WPyVj32YKzlWZq for ; Thu, 18 Jul 2024 18:11:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codenetworks.net; s=domabs; t=1721319117; bh=ruWW9hnNRknvq+pZJnsSQdbbluYOzW3p8tTmKjyRFag=; h=Date:Subject:To:References:From:In-Reply-To:From; b=pXqqU+IszRz0DSGQuxWnu+5y+dn2JuJVTUCJUldAz6FAKcwmYbSfME739ue8j2KUq ObFrVAKmqoQ6uXfPQr53mx5N8MmiN4HR5qLNP4/Ia7d4xewh+mYrxTwuG3DeskxEn6 Dq/bwfgqfEx20PDagC+u/jBhywzRLKEpSV0Vy48I= Received: from [192.168.3.20] (unknown [188.241.98.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sm.codenetworks.net) by relayout02-dsp.dominioabsoluto.net (Postfix) with ESMTPSA id 4WPyVd2VdczlWBJ for ; Thu, 18 Jul 2024 18:11:53 +0200 (CEST) Content-Type: multipart/alternative; boundary="------------KSf0CWNK2xTv00FE0ZzP8ZWu" Message-ID: <70305bf3-cfe4-4cdd-8cb8-c03c1a9c2b8f@codenetworks.net> Date: Thu, 18 Jul 2024 18:11:53 +0200 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 User-Agent: Mozilla Thunderbird Subject: Re: Multiple Fibs and INET6 To: freebsd-net@freebsd.org References: Content-Language: en-US From: Santiago Martinez In-Reply-To: X-PostalOut-Country: IP: 188.241.98.123 | Country: ES X-PostalOut-Information: AntiSPAM and AntiVIRUS on relayout02 X-PostalOut-MsgID: 4WPyVd2VdczlWBJ.AC77B X-PostalOut-SpamCheck: no es spam, clean X-PostalOut-From: sm@codenetworks.net X-PostalOut-Watermark: 1721923916.6966@ey1sAjYEmlW5wXJaio+nTw X-Spam-Status: No X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.77 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.98)[-0.975]; RCVD_IN_DNSWL_LOW(-0.20)[217.116.26.80:from,217.116.26.75:received]; R_SPF_ALLOW(-0.20)[+ip4:217.116.26.0/24:c]; R_DKIM_ALLOW(-0.20)[codenetworks.net:s=domabs]; RWL_MAILSPIKE_GOOD(-0.10)[217.116.26.80:from]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; XM_UA_NO_VERSION(0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:16371, ipnet:217.116.24.0/21, country:ES]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DMARC_NA(0.00)[codenetworks.net]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MLMMJ_DEST(0.00)[freebsd-net@freebsd.org]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[codenetworks.net:+] X-Rspamd-Queue-Id: 4WPyVm0R7hz4Lt7 This is a multi-part message in MIME format. --------------KSf0CWNK2xTv00FE0ZzP8ZWu Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Interesting, I'm running 14.1p2. how does your routing table looks for fib1 ? Santi On 7/18/24 18:09, Zhenlei Huang wrote: > > >> On Jul 13, 2024, at 1:06 AM, Santiago Martinez >> wrote: >> >> Hi Everyone. >> >> While adding -F ( fib as used in netstat ) to ping and ping6 I have >> found something that from my understanding is not correct. >> Please can you advise? >> >> I have the following setup : >> >> -- two fibs (0 and 1) >> -- two  loop-backs (lo0 and lo1). >> -- Lo1 has been assigned to fib1 >> --net.add_addr_allfibs = 0 >> >> My interface output looks like this: >> >> >> ifconfig lo0 | grep inet6 >>        inet6 ::1 prefixlen 128 >>        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 >> >> ifconfig lo1 | grep inet6 >>        inet6 fe80::1%lo1 prefixlen 64 scopeid 0x3 >> >> If I do a netstat -rn -6  -F0 I get the following which is was i >> expected. >> >> Internet6: >> Destination                       Gateway                       Flags >>     Netif Expire >> ::/96                             link#2                        URS >>         lo0 >> ::1                               link#2                        UHS >>         lo0 >> ::ffff:0.0.0.0/96                 link#2                        URS >>         lo0 >> fe80::%lo0/10                     link#2                        URS >>         lo0 >> fe80::%lo0/64                     link#2                        U >>           lo0 >> fe80::1%lo0                       link#2                        UHS >>         lo0 >> ff02::/16                         link#2                        URS >>         lo0 >> >> Now,  netstat -rn -6  -F1 shows  "fe80::1%lo0" which should not be >> there and "fe80::1%lo1" is missing which should be there. >> >> Internet6: >> Destination                       Gateway                       Flags >>     Netif Expire >> fe80::%lo1/64                     link#3                        U >>           lo1 >> *fe80::1%lo0                       link#2                        UHS >>         lo0* >> > That seems wrong from my first glance. IIRC, there's HACK ( I'd prefer > this ) for loopback route. For example > ``` > # sysctl net.fibs=3 > net.fibs: 2 -> 3 > # ifconfig epair create > # epair0a > # ifconfig epair0a fib 2 > # ifconfig epair0a inet6 -ifdisabled up > # netstat -6rnF 2 > Routing tables (fib: 2) > > Internet6: > Destination                     Gateway                       Flags   > Netif Expire > fe80::%epair0a/64                 link#5                        U epair0a > fe80::3b:b3ff:fe8f:9a0a%lo0       link#1                        UHS   >       lo0 > ``` > > The loopback route always refer the first loop interface, aka lo0. >> >> >> What output I was expecting was: >> >> Internet6: >> Destination                       Gateway                       Flags >>     Netif Expire >> fe80::%lo1/64                     link#3                        U >>           lo1 >> *fe80::1%lo1                       link#3                        UHS >>         lo1* >> >> >> This makes the ping -6 -F0 fe80::1%lo0  to work but ping -6 -F1 >> fe80::1%l01 to fail which I wanted to use as test case. >> > That is interesting. I can ping without failure. > > ``` > # setfib 1 ping6 -c3 fe80::1%lo1 > PING(56=40+8+8 bytes) fe80::1%lo1 --> fe80::1%lo1 > 16 bytes from fe80::1%lo1, icmp_seq=0 hlim=64 time=0.050 ms > 16 bytes from fe80::1%lo1, icmp_seq=1 hlim=64 time=0.067 ms > 16 bytes from fe80::1%lo1, icmp_seq=2 hlim=64 time=0.096 ms > > --- fe80::1%lo1 ping statistics --- > 3 packets transmitted, 3 packets received, 0.0% packet loss > round-trip min/avg/max/stddev = 0.050/0.071/0.096/0.019 ms > ``` > > Best regards, > Zhenlei > >> Thanks in advance. >> >> Santiago >> >> > > > --------------KSf0CWNK2xTv00FE0ZzP8ZWu Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Interesting, I'm running 14.1p2.

how does your routing table looks for fib1 ?

Santi


On 7/18/24 18:09, Zhenlei Huang wrote:


On Jul 13, 2024, at 1:06 AM, Santiago Martinez <sm@codenetworks.net> wrote:

Hi Everyone.

While adding -F ( fib as used in netstat ) to ping and ping6 I have found something that from my understanding is not correct.
Please can you advise?

I have the following setup :

-- two fibs (0 and 1) 
-- two  loop-backs (lo0 and lo1).
-- Lo1 has been assigned to fib1
-- net.add_addr_allfibs = 0

My interface output looks like this:


ifconfig lo0 | grep inet6
       inet6 ::1 prefixlen 128
       inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2

ifconfig lo1 | grep inet6
       inet6 fe80::1%lo1 prefixlen 64 scopeid 0x3

If I do a netstat -rn -6  -F0 I get the following which is was i expected.

Internet6:
Destination                       Gateway                       Flags     Netif Expire
::/96                             link#2                        URS         lo0
::1                               link#2                        UHS         lo0
::ffff:0.0.0.0/96                 link#2                        URS         lo0
fe80::%lo0/10                     link#2                        URS         lo0
fe80::%lo0/64                     link#2                        U           lo0
fe80::1%lo0                       link#2                        UHS         lo0
ff02::/16                         link#2                        URS         lo0

Now,  netstat -rn -6  -F1 shows  "fe80::1%lo0" which should not be there and "fe80::1%lo1" is missing which should be there.

Internet6:
Destination                       Gateway                       Flags     Netif Expire
fe80::%lo1/64                     link#3                        U           lo1
fe80::1%lo0                       link#2                        UHS         lo0

That seems wrong from my first glance. IIRC, there's HACK ( I'd prefer this ) for loopback route. For example
```
# sysctl net.fibs=3
net.fibs: 2 -> 3
# ifconfig epair create
epair0a
# ifconfig epair0a fib 2
# ifconfig epair0a inet6 -ifdisabled up
# netstat -6rnF 2
Routing tables (fib: 2)

Internet6:
Destination                       Gateway                       Flags     Netif Expire
fe80::%epair0a/64                 link#5                        U       epair0a
fe80::3b:b3ff:fe8f:9a0a%lo0       link#1                        UHS         lo0
```

The loopback route always refer the first loop interface, aka lo0.  


What output I was expecting was:

Internet6:
Destination                       Gateway                       Flags     Netif Expire
fe80::%lo1/64                     link#3                        U           lo1
fe80::1%lo1                       link#3                        UHS         lo1


This makes the ping -6 -F0 fe80::1%lo0  to work but ping -6 -F1 fe80::1%l01 to fail which I wanted to use as test case.

That is interesting. I can ping without failure.

```
# setfib 1 ping6 -c3 fe80::1%lo1
PING(56=40+8+8 bytes) fe80::1%lo1 --> fe80::1%lo1
16 bytes from fe80::1%lo1, icmp_seq=0 hlim=64 time=0.050 ms
16 bytes from fe80::1%lo1, icmp_seq=1 hlim=64 time=0.067 ms
16 bytes from fe80::1%lo1, icmp_seq=2 hlim=64 time=0.096 ms

--- fe80::1%lo1 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.050/0.071/0.096/0.019 ms
```

Best regards,
Zhenlei

Thanks in advance.

Santiago





--------------KSf0CWNK2xTv00FE0ZzP8ZWu--