Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Feb 2021 11:45:59 +0100
From:      Michael Gmelin <freebsd@grem.de>
To:        Lutz Donnerhacke <lutz@donnerhacke.de>
Cc:        Doug Hardie <bc979@lafn.org>, net@FreeBSD.org
Subject:   Re: accept_rtadv
Message-ID:  <20210228114559.3939258a@bsd64.grem.de>
In-Reply-To: <20210227220740.GA28592@belenus.iks-jena.de>
References:  <BC947075-4292-4C87-902B-DC98B60A548E@lafn.org> <20210227220740.GA28592@belenus.iks-jena.de>

next in thread | previous in thread | raw e-mail | index | archive | help


On Sat, 27 Feb 2021 23:07:40 +0100
Lutz Donnerhacke <lutz@donnerhacke.de> wrote:

> On Sat, Feb 27, 2021 at 12:34:56PM -0800, Doug Hardie wrote:
> > Ahh.  The handbook is needing a note about that.  There should be
> > something similar to what was done for IPv4 where it shows adding
> > additional addresses using:
> > 
> > Ifconfig_bge0_alias0 ...
> > Ifconfig_bge0_alias1 ...
> > 
> > That would be very helpful.  Thanks for the explinations.  
> 
> That's a bad idea. You can't comment out some intermediate line.
> 
> ifconfig_bge0_alias0="inet xxx"
> # ifconfig_bge0_alias1="inet yyy"
> ifconfig_bge0_alias2="inet zzz"
> 
> will result in applying "xxx" only.

Fortunately this is not true anymore since 10.1-RELEASE (r262243):

  r264243 | dteske | 2014-04-08 00:40:29 +0200 (Tue, 08 Apr 2014) | 10
  lines

  Loosen the processing of *_IF_aliasN vars to be less strict.
  Previously, the first alias had to be _alias0 and processing stopped
  at the first non-defined variable (preventing gaps). Allowing gaps
  gives the administrator the ability to group aliases in an adhoc
  manner and also lifts the requirement to renumber aliases simply to
  comment-out an existing one. Aliases are processed in numerical
  ascending order.

  Discussed on:   -rc
  MFC after:      1 week

So you can happily just comment out lines like in your example above. It
seems like the (otherwise great) section on network_interfaces in the
rc.conf(5) man page wasn't adapted to reflect this change.


> 
> but this is even worse:
> 
> ifconfig_bge0_aliases=" \
>   inet xxx \
> #  inet yyy \
>   inet zzz \
> "
> 
> It results in an syntax error.
> 
> So I do use:
> 
> ifconfig_bge0_aliases="${ifconfig_bge0_aliases} inet xxx"
> # ifconfig_bge0_aliases="${ifconfig_bge0_aliases} inet yyy"
> ifconfig_bge0_aliases="${ifconfig_bge0_aliases} inet zzz"
> 
> For _ipv6 it's different, because you need at least one _ipv6.
> ifconfig_bge0_ipv6="inet6 xxx"

Putting "up" in there is just fine.

> ifconfig_bge0_aliases="inet6 yyy"

I usually do something like this (as I like to rename interface based
on their architectural role in my system):

  ifconfig_bge0_name="public"
  ifconfig_public="up"
  ifconfig_public_ipv6="up"

and keep addresses entirely in aliases

  ifconfig_public_aliases="inet 1.2.3.4/32 inet6 2b01:3e1:123:201::2/64"

Cheers,
Michael

-- 
Michael Gmelin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210228114559.3939258a>