On Sat, 6 Mar 2021 at 05:16, Thomas Lange <[email protected]> wrote:
>
> >>>>> On Fri, 05 Mar 2021 17:58:26 +0000, Matthew Pounsett
> >>>>> <[email protected]> said:
>
> I've made a change in fai-setup to determine the IP of the first
> interface, but this seems to fail with multiple interfaces
> Can you please provide the output of this command:
> ip -br ad show | awk '{print $3}'
Sure (indenting mine):
% ip -br ad show | awk '{print $3}'
127.0.0.1/8
172.16.2.2/30
64.191.0.64/24
192.168.1.64/24
192.168.0.64/24
fe80::fc54:ff:fe78:7dd0/64
fe80::fc54:ff:fe48:106e/64
fe80::fc54:ff:fece:417f/64
If you're using that, you lose information, though. For example, the
only IPv6 addresses you're getting are link-local. Here's the full
output of that command without restricting it to a single column:
% ip -br ad show
lo UNKNOWN 127.0.0.1/8 ::1/128
eno1 UP
eno2 UP
eno3 DOWN
eno4 UP 172.16.2.2/30 fe80::baca:3aff:fef3:7bac/64
enp68s0 UP
br0 UP 64.191.0.64/24 64.191.0.132/24
2620:ff:c000::132/64 2620:ff:c000::64/64 fe80::baca:3aff:fef3:7ba9/64
br1 UP 192.168.1.64/24 fe80::baca:3aff:fef3:7baa/64
br2 UP 192.168.0.64/24 fe80::260:ddff:fe43:99fb/64
vnet0 UNKNOWN fe80::fc54:ff:fe78:7dd0/64
vnet1 UNKNOWN fe80::fc54:ff:fe48:106e/64
vnet2 UNKNOWN fe80::fc54:ff:fece:417f/64
To strip that down, you probably want something more like the output of this:
% ip -br ad show | tr -s '[:blank:]' ' ' | cut -d' ' -f 3-
Since a server may have multiple addresses in the same subnet, you may
also want to de-dupe the output before using it.
>
> Which is the expected interface you want to use in /etc/exports?
That would be system dependent.
I would suggest that what fai-setup should do by default depends on
your intentions. Do you want this to just be an example, or should it
be more like a functional default? If it's the former, then I'd grab
the first IPv4 and IPv6 subnets you find that are not 127/8 (for v4)
or link-local (for v6). If you want it to be fully functional, then
I would grab all such netblocks.
Keeping in mind that the main issue I'm reporting here is a problem
with /etc/exports syntax, not with the netblock selection. The man
page for exports(5) is a little imprecise on this point ... an
export's client list *is* whitespace delimited, and newlines are
ignored, but newlines in the client list seem to be fatal. This
implies they are not ignored mid-export and are not included in this
definition of "whitespace".
But, if you're looking at improving netblock selection as well, my
advice would be to grab all v4 netblocks not in 127/8 and all
non-link-local v6 blocks.
> A workaround is to set the variable SERVERINTERFACE in
> /etc/fai/nfsroot.conf. See nfsroot.conf(5)
I think if that's a thing that needs to be done to get fai-server to
generate valid /etc/exports syntax you should probably mention it in
the docs. My personal workaround is just to fix the syntax of the
exports file after fai-setup writes it.