Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jul 2024 19:23:53 +0200
From:      Santiago Martinez <sm@codenetworks.net>
To:        Zhenlei Huang <zlei@FreeBSD.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Multiple Fibs and INET6
Message-ID:  <48536b16-e7f1-49d3-b0ac-37773ac686bf@codenetworks.net>
In-Reply-To: <E2F8E66A-B141-47C4-B4B8-551D22784244@FreeBSD.org>
References:  <da781b66-4ab3-426f-bf56-f453030c6e61@codenetworks.net> <F7B1F9E1-30E0-4BC2-84F8-697A655A2C44@FreeBSD.org> <70305bf3-cfe4-4cdd-8cb8-c03c1a9c2b8f@codenetworks.net> <E2F8E66A-B141-47C4-B4B8-551D22784244@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------0K0uDWZTW2U6ylXmGou9U7nS
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Indeed, ping does work if I ping the "fe80::1%lo1" on FIB 1, which is 
correct.

My script was getting the address from the routing table output (F1) 
which is returning "%lo0" instead of the correct loopback number (lo6 in 
my case) and as a result it was failing.

The routing table should return the correct loop-back interface instead 
of lo0. Not sure how difficult or easy it, i will take a look ( ENOCLUE).

Best regards.

Santi


On 7/18/24 18:15, Zhenlei Huang wrote:
>
>
>> On Jul 19, 2024, at 12:11 AM, Santiago Martinez <sm@codenetworks.net> 
>> wrote:
>>
>> Interesting, I'm running 14.1p2.
>>
>>
>
> Yes, I'm running exactly the same version with you.
>>
>> how does your routing table looks for fib1 ?
>>
>>
>
> ```
> # netstat -6rnF 1
> Routing tables (fib: 1)
>
> Internet6:
> Destination                       Gateway     Flags     Netif Expire
> fe80::%lo1/64                     link#5      U           lo1
> fe80::1%lo0                       link#2      UHS         lo0
> ```
>>
>> 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
>>>>
>>>>
>>>
>>>
>>>
>
>
>
--------------0K0uDWZTW2U6ylXmGou9U7nS
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Indeed, ping does work if I ping the "fe80::1%lo1" on FIB 1, 
      which is correct.</p>
    <p>My script was getting the address from the routing table output 
      (F1) which is returning "%lo0" instead of the correct loopback
      number (lo6 in my case) and as a result it was failing. </p>
    <p>The routing table should return the correct loop-back interface
      instead of lo0. Not sure how difficult or easy it, i will take a
      look ( ENOCLUE).</p>
    <p>Best regards.<br>
    </p>
    <p>Santi</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 7/18/24 18:15, Zhenlei Huang wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:E2F8E66A-B141-47C4-B4B8-551D22784244@FreeBSD.org">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <br class="">
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On Jul 19, 2024, at 12:11 AM, Santiago Martinez
            &lt;<a href="mailto:sm@codenetworks.net"
              class="moz-txt-link-freetext" moz-do-not-send="true">sm@codenetworks.net</a>&gt;
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <meta http-equiv="Content-Type"
              content="text/html; charset=UTF-8" class="">
            <div class="">
              <p class="">Interesting, I'm running 14.1p2.</p>
              <div class=""><br class="">
              </div>
            </div>
          </div>
        </blockquote>
        <div><br class="">
        </div>
        Yes, I'm running exactly the same version with you.<br class="">
        <blockquote type="cite" class="">
          <div class="">
            <div class="">
              <p class="">how does your routing table looks for fib1 ?</p>
              <div class=""><br class="">
              </div>
            </div>
          </div>
        </blockquote>
        <div><br class="">
        </div>
        <div>```</div>
        <div># netstat -6rnF 1</div>
        <div>Routing tables (fib: 1)</div>
        <div><br class="">
        </div>
        <div>Internet6:</div>
        <div>Destination                       Gateway                  
              Flags     Netif Expire</div>
        <div>fe80::%lo1/64                     link#5                  
               U           lo1</div>
        <div>fe80::1%lo0                       link#2                  
               UHS         lo0</div>
        <div>```</div>
        <blockquote type="cite" class="">
          <div class="">
            <div class="">
              <p class="">Santi</p>
              <p class=""><br class="">
              </p>
              <div class="moz-cite-prefix">On 7/18/24 18:09, Zhenlei
                Huang wrote:<br class="">
              </div>
              <blockquote type="cite"
cite="mid:F7B1F9E1-30E0-4BC2-84F8-697A655A2C44@FreeBSD.org" class="">
                <meta http-equiv="Content-Type"
                  content="text/html; charset=UTF-8" class="">
                <br class="">
                <div class=""><br class="">
                  <blockquote type="cite" class="">
                    <div class="">On Jul 13, 2024, at 1:06 AM, Santiago
                      Martinez &lt;<a href="mailto:sm@codenetworks.net"
                        class="moz-txt-link-freetext"
                        moz-do-not-send="true">sm@codenetworks.net</a>&gt;
                      wrote:</div>
                    <br class="Apple-interchange-newline">
                    <div class="">
                      <meta http-equiv="content-type"
                        content="text/html; charset=UTF-8" class="">
                      <div class="">
                        <p class="">Hi Everyone.</p>
                        While adding -F ( fib as used in netstat ) to
                        ping and ping6 I have found something that from
                        my understanding is not correct.<br class="">
                        Please can you advise?<br class="">
                        <p class="">I have the following setup :</p>
                        -- two fibs (0 and 1) <br class="">
                        -- two  loop-backs (lo0 and lo1).<br class="">
                        -- Lo1 has been assigned to fib1<br class="">
                        --<span
                          style="background-color: rgb(255, 255, 255);"
                          class=""> net.add_addr_allfibs = 0</span>
                        <p class=""><span
style="background-color: rgb(255, 255, 255);" class="">My interface
                            output looks like this:<br class="">
                          </span><span style="font-family:monospace"
                            class=""></span></p>
                        <div class=""><span
                            style="font-family:monospace" class=""></span><br
                            class="webkit-block-placeholder">
                        </div>
                        <p class=""><span style="font-family:monospace"
                            class=""><span
style="background-color: rgb(255, 255, 255);" class="">ifconfig lo0 |
                              grep inet6 </span><br class="">
                                   inet6 ::1 prefixlen 128 <br class="">
                                   inet6 fe80::1%lo0 prefixlen 64
                            scopeid 0x2 <br class="">
                          </span></p>
                        <p class=""><span style="font-family:monospace"
                            class="">ifconfig lo1 | grep inet6 <br
                              class="">
                                   inet6 fe80::1%lo1 prefixlen 64
                            scopeid 0x3<br class="">
                            <br class="">
                          </span></p>
                        <p class="">If I do a netstat -rn -6  -F0 I get
                          the following which is was i expected.<br
                            class="">
                        </p>
                        <p class=""><span style="font-family:monospace"
                            class=""><span
style="background-color: rgb(255, 255, 255);" class="">Internet6: </span><br
                              class="">
                            Destination                       Gateway
                                                  Flags     Netif Expire
                            <br class="">
                            ::/96                             link#2
                                                   URS         lo0 <br
                              class="">
                            ::1                               link#2
                                                   UHS         lo0 <br
                              class="">
                            ::ffff:0.0.0.0/96                 link#2
                                                   URS         lo0 <br
                              class="">
                            fe80::%lo0/10                     link#2
                                                   URS         lo0 <br
                              class="">
                            fe80::%lo0/64                     link#2
                                                   U           lo0 <br
                              class="">
                            fe80::1%lo0                       link#2
                                                   UHS         lo0 <br
                              class="">
                            ff02::/16                         link#2
                                                   URS         lo0<br
                              class="">
                            <br class="">
                          </span></p>
                        Now,  netstat -rn -6  -F1 shows  "fe80::1%lo0"
                        which should not be there and "fe80::1%lo1" is
                        missing which should be there.
                        <div class=""><br
                            class="webkit-block-placeholder">
                        </div>
                        <p class=""><span style="font-family:monospace"
                            class=""><span
style="background-color: rgb(255, 255, 255);" class="">Internet6: </span><br
                              class="">
                            Destination                       Gateway
                                                  Flags     Netif Expire
                            <br class="">
                            fe80::%lo1/64                     link#3
                                                   U           lo1 <br
                              class="">
                            <b class="">fe80::1%lo0
                                                    link#2
                                                     UHS         lo0</b><br
                              class="">
                          </span></p>
                      </div>
                    </div>
                  </blockquote>
                  That seems wrong from my first glance. IIRC, there's
                  HACK ( I'd prefer this ) for loopback route. For
                  example</div>
                <div class="">```</div>
                <div class=""># sysctl net.fibs=3</div>
                <div class="">net.fibs: 2 -&gt; 3</div>
                <div class=""># ifconfig epair create</div>
                <div class=""># <span style="caret-color: rgb(0, 0, 0);"
                    class="">epair0a</span></div>
                <div class=""><span style="caret-color: rgb(0, 0, 0);"
                    class=""># ifconfig </span><span
                    style="caret-color: rgb(0, 0, 0);" class="">epair0a
                    fib 2</span></div>
                <div class=""><span style="caret-color: rgb(0, 0, 0);"
                    class=""># ifconfig </span><span
                    style="caret-color: rgb(0, 0, 0);" class="">epair0a
                    inet6 -ifdisabled up</span></div>
                <div class=""><span style="caret-color: rgb(0, 0, 0);"
                    class=""># netstat -6rnF 2</span></div>
                <div class="">
                  <div class=""><font class=""><span
                        style="caret-color: rgb(0, 0, 0);" class="">Routing
                        tables (fib: 2)</span></font></div>
                  <div class=""><font class=""><span
                        style="caret-color: rgb(0, 0, 0);" class=""><br
                          class="">
                      </span></font></div>
                  <div class=""><font class=""><span
                        style="caret-color: rgb(0, 0, 0);" class="">Internet6:</span></font></div>
                  <div class=""><font class=""><span
                        style="caret-color: rgb(0, 0, 0);" class="">Destination
                                              Gateway                  
                            Flags     Netif Expire</span></font></div>
                  <div class=""><font class=""><span
                        style="caret-color: rgb(0, 0, 0);" class="">fe80::%epair0a/64
                                        link#5                        U
                              epair0a</span></font></div>
                  <div class=""><font class=""><span
                        style="caret-color: rgb(0, 0, 0);" class="">fe80::3b:b3ff:fe8f:9a0a%lo0
                              link#1                        UHS        
                        lo0</span></font></div>
                </div>
                <div class="">```</div>
                <div class=""><br class="">
                </div>
                <div class="">The loopback route always refer the first
                  loop interface, aka lo0.  </div>
                <div class="">
                  <blockquote type="cite" class="">
                    <div class="">
                      <div class="">
                        <p class=""><span style="font-family:monospace"
                            class=""> <br class="">
                          </span></p>
                        What output I was expecting was:
                        <p class=""><span style="font-family:monospace"
                            class=""><span
style="background-color: rgb(255, 255, 255);" class="">Internet6: </span><br
                              class="">
                            Destination                       Gateway
                                                  Flags     Netif Expire
                            <br class="">
                            fe80::%lo1/64                     link#3
                                                   U           lo1 <br
                              class="">
                            <b class="">fe80::1%lo1
                                                    link#3
                                                     UHS         lo1</b></span></p>
                        <p class=""><br class="">
                        </p>
                        <p class="">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.<span style="font-family:monospace"
                            class=""><br class="">
                          </span></p>
                      </div>
                    </div>
                  </blockquote>
                  <div class="">That is interesting. I can ping without
                    failure.</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">```</div>
                  <div class="">
                    <div class=""># setfib 1 ping6 -c3 fe80::1%lo1</div>
                    <div class="">PING(56=40+8+8 bytes) fe80::1%lo1
                      --&gt; fe80::1%lo1</div>
                    <div class="">16 bytes from fe80::1%lo1, icmp_seq=0
                      hlim=64 time=0.050 ms</div>
                    <div class="">16 bytes from fe80::1%lo1, icmp_seq=1
                      hlim=64 time=0.067 ms</div>
                    <div class="">16 bytes from fe80::1%lo1, icmp_seq=2
                      hlim=64 time=0.096 ms</div>
                    <div class=""><br class="">
                    </div>
                    <div class="">--- fe80::1%lo1 ping statistics ---</div>
                    <div class="">3 packets transmitted, 3 packets
                      received, 0.0% packet loss</div>
                    <div class="">round-trip min/avg/max/stddev =
                      0.050/0.071/0.096/0.019 ms</div>
                  </div>
                  <div class="">```</div>
                  <div class=""><br class="">
                  </div>
                  <div class="">
                    <div style="caret-color: rgb(0, 0, 0);" class="">Best
                      regards,</div>
                    <div style="caret-color: rgb(0, 0, 0);" class="">Zhenlei</div>
                  </div>
                  <br class="">
                  <blockquote type="cite" class="">
                    <div class="">
                      <div class="">
                        <div class=""><span
                            style="font-family:monospace" class=""> </span><br
                            class="webkit-block-placeholder">
                        </div>
                        <p class="">Thanks in advance.</p>
                        Santiago
                        <p class=""><span style="font-family:monospace"
                            class=""><br class="">
                          </span></p>
                      </div>
                    </div>
                  </blockquote>
                </div>
                <br class="">
                <div class="">
                  <div class=""><br class="">
                  </div>
                </div>
                <br class="">
              </blockquote>
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
      <div class="">
        <div><br class="">
        </div>
      </div>
      <br class="">
    </blockquote>
  </body>
</html>

--------------0K0uDWZTW2U6ylXmGou9U7nS--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48536b16-e7f1-49d3-b0ac-37773ac686bf>