Re: [bitfolk] Ubuntu 18.04+ and netplan (Was: Re: Network no…

Top Page

Reply to this message
Author: Andy Smith
Date:  
To: users
New-Topics: [bitfolk] netplan and preferred_lft 0 (Was Re: Ubuntu 18.04+ and netplan)
Subject: Re: [bitfolk] Ubuntu 18.04+ and netplan (Was: Re: Network not coming up)
Hello,

On Tue, Nov 13, 2018 at 06:17:26PM +0100, Andreas Olsson wrote:
> tis 2018-11-13 klockan 17:00 +0000 skrev Andy Smith:
> > ...
> > Hmm, there is no DHCP server at BitFolk so either:
> >
> > 1. netplan has limited understanding of /etc/network/interfaces, or
> >
> > 2. netplan writes a default config file based on its network
> >    settings in the installer phase, and ignores
> >    /etc/network/interfaces totally

>
> Yeah, #2 was likely what happened. My guess is that I simply assumed
> DHCP because it showed up in the installer.


The main IPv4 settings are passed on the kernel command line for
these self-installs, as both Debian/Ubuntu installer and CentOS
support that.

For Debian/Ubuntu, a late pressed script writes an
/etc/network/interfaces file that will contain the main IPv4
address, all additional IPv4 addresses, and the main IPv6.

As it seems /etc/network/interfaces is being ignored by netplan, I
think either the script will need to write a better netplan config
or else the installer should force ifupdown.

Which do you think should happen?

> > It's depressing that there's not a single IPv6 example in
> > https://netplan.io/examples
>
> In case it helps anyone, here is my current 01-netcfg.yaml.
>
>   network:
>     version: 2
>     renderer: networkd
>     ethernets:
>       eth0:
>         addresses:
>           - "85.119.82.90/21"
>           - "85.119.83.127/32"
>           - "2001:ba8:1f1:f1d1::22/64"
>           - "2001:ba8:1f1:f1d1::2/64"
>         gateway4: 85.119.80.1
>         gateway6: "2001:ba8:1f1:f1d1::1"


Thanks, that's helpful. Would certainly not be difficult to
construct that sort of thing.

> Above results in a setup where the default outgoing addresses are
> 85.119.82.90 and 2001:ba8:1f1:f1d1::2. Unsure whatever there is a more
> explicit way to set that up.


I have seen various ways to force choice of source address. Some
people say to add the address last, others say to add it as a /128
and then it will always be chosen, and others say to add it as a
deprecated address (preferred_lft 0) then it will never be chosen as
a source address unless forced.

So, personally I prefer the preferred_lft 0 method which in
/etc/network/interfaces file looks like:

iface eth0 inet6 static
    address 2001:ba8:1f1:f019::2
    netmask 64
    gateway 2001:ba8:1f1:f019::1
    post-up /bin/ip -6 addr add 2001:ba8:1f1:f019::80/64 dev $IFACE preferred_lft 0


I will have to look up how to do it with netplan.

Cheers,
Andy

--
https://bitfolk.com/ -- No-nonsense VPS hosting