vmctl.8, vm.conf.5: DHCP is configured on the first interface only

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

vmctl.8, vm.conf.5: DHCP is configured on the first interface only

Klemens Nanni-2
VMs may have multiple interface, but only "the [first]" interface gets
DHCP if `-L'/`local' is specified.

OK?


Index: usr.sbin/vmctl/vmctl.8
===================================================================
RCS file: /cvs/src/usr.sbin/vmctl/vmctl.8,v
retrieving revision 1.70
diff -u -p -r1.70 vmctl.8
--- usr.sbin/vmctl/vmctl.8 15 Sep 2019 12:06:20 -0000 1.70
+++ usr.sbin/vmctl/vmctl.8 13 Feb 2020 18:53:00 -0000
@@ -204,7 +204,7 @@ Number of network interfaces to add to t
 .It Fl L
 Add a local network interface.
 .Xr vmd 8
-will auto-generate an IPv4 subnet for the interface,
+will auto-generate an IPv4 subnet for the first interface,
 configure a gateway address on the VM host side,
 and run a simple DHCP/BOOTP server for the VM.
 See
Index: usr.sbin/vmd/vm.conf.5
===================================================================
RCS file: /cvs/src/usr.sbin/vmd/vm.conf.5,v
retrieving revision 1.51
diff -u -p -r1.51 vm.conf.5
--- usr.sbin/vmd/vm.conf.5 10 Feb 2020 13:18:22 -0000 1.51
+++ usr.sbin/vmd/vm.conf.5 13 Feb 2020 18:53:54 -0000
@@ -272,7 +272,7 @@ Stop the interface from forwarding packe
 .Pp
 A
 .Cm local
-interface will auto-generate an IPv4 subnet for the interface,
+interface will auto-generate an IPv4 subnet for the first interface,
 configure a gateway address on the VM host side,
 and run a simple DHCP/BOOTP server for the VM.
 This option can be used for layer 3 mode without configuring a switch.

Reply | Threaded
Open this post in threaded view
|

Re: vmctl.8, vm.conf.5: DHCP is configured on the first interface only

Theo Buehler-4
On Thu, Feb 13, 2020 at 07:56:27PM +0100, Klemens Nanni wrote:
> VMs may have multiple interface, but only "the [first]" interface gets
> DHCP if `-L'/`local' is specified.
>
> OK?

I don't think this patch is correct.

The vmctl part contradicts the "LOCAL INTERFACES" section, which
explains how the addresses are calculated and also states:

     Multiple -L options can be provided to the 'vmctl start' command,
     if more than one interface is desired.

# rcctl -f start vmd
vmd(ok)
# vmctl start -b /bsd.rd -c -L -L test
[...]
Welcome to the OpenBSD/amd64 6.6 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? s
# dhclient vio0
vio0: 100.64.1.3 lease accepted from 100.64.1.2 (fe:e1:bb:d1:bc:46)
# dhclient vio1
vio1: 100.64.1.5 lease accepted from 100.64.1.4 (fe:e1:bb:d2:3a:8e)

In vm.conf, the 'local' keyword applies per interface. It's perfectly
valid to have several 'local interface' lines for the same VM in vm.conf
and the corresponding vio interfaces will get leases from the built-in
dhcp server.

>
>
> Index: usr.sbin/vmctl/vmctl.8
> ===================================================================
> RCS file: /cvs/src/usr.sbin/vmctl/vmctl.8,v
> retrieving revision 1.70
> diff -u -p -r1.70 vmctl.8
> --- usr.sbin/vmctl/vmctl.8 15 Sep 2019 12:06:20 -0000 1.70
> +++ usr.sbin/vmctl/vmctl.8 13 Feb 2020 18:53:00 -0000
> @@ -204,7 +204,7 @@ Number of network interfaces to add to t
>  .It Fl L
>  Add a local network interface.
>  .Xr vmd 8
> -will auto-generate an IPv4 subnet for the interface,
> +will auto-generate an IPv4 subnet for the first interface,
>  configure a gateway address on the VM host side,
>  and run a simple DHCP/BOOTP server for the VM.
>  See
> Index: usr.sbin/vmd/vm.conf.5
> ===================================================================
> RCS file: /cvs/src/usr.sbin/vmd/vm.conf.5,v
> retrieving revision 1.51
> diff -u -p -r1.51 vm.conf.5
> --- usr.sbin/vmd/vm.conf.5 10 Feb 2020 13:18:22 -0000 1.51
> +++ usr.sbin/vmd/vm.conf.5 13 Feb 2020 18:53:54 -0000
> @@ -272,7 +272,7 @@ Stop the interface from forwarding packe
>  .Pp
>  A
>  .Cm local
> -interface will auto-generate an IPv4 subnet for the interface,
> +interface will auto-generate an IPv4 subnet for the first interface,
>  configure a gateway address on the VM host side,
>  and run a simple DHCP/BOOTP server for the VM.
>  This option can be used for layer 3 mode without configuring a switch.
>

Reply | Threaded
Open this post in threaded view
|

Re: vmctl.8, vm.conf.5: DHCP is configured on the first interface only

Klemens Nanni-2
On Sun, Feb 16, 2020 at 06:35:10AM +0100, Theo Buehler wrote:

> I don't think this patch is correct.
>
> The vmctl part contradicts the "LOCAL INTERFACES" section, which
> explains how the addresses are calculated and also states:
>
>      Multiple -L options can be provided to the 'vmctl start' command,
>      if more than one interface is desired.
>
> # rcctl -f start vmd
> vmd(ok)
> # vmctl start -b /bsd.rd -c -L -L test
> [...]
> Welcome to the OpenBSD/amd64 6.6 installation program.
> (I)nstall, (U)pgrade, (A)utoinstall or (S)hell? s
> # dhclient vio0
> vio0: 100.64.1.3 lease accepted from 100.64.1.2 (fe:e1:bb:d1:bc:46)
> # dhclient vio1
> vio1: 100.64.1.5 lease accepted from 100.64.1.4 (fe:e1:bb:d2:3a:8e)
>
> In vm.conf, the 'local' keyword applies per interface. It's perfectly
> valid to have several 'local interface' lines for the same VM in vm.conf
> and the corresponding vio interfaces will get leases from the built-in
> dhcp server.
Oh, you are correct.

I completely missed that part from vmctl.5's "LOCAL INTERFACES" section.
Reading `-L's description itself and the fact that it functions as a
boolean switch contrary to how `-i' expects a number, I made the wrong
assumption that it can only work for the first interface.

        -L         Add a local network interface.  vmd(8) will auto-
                   generate an IPv4 subnet for the interface, configure a
                   gateway address on the VM host side, and run a simple
                   DHCP/BOOTP server for the VM.  See LOCAL INTERFACES

"a local network interface" and "for the interface" supported my false
believes, so I dismissed the referenced section which goes into all the
details about most but apparently not all details I already know.

My second mistake was to imply analogue behaviour for the configuration.
Now that you stated the obvious about `local' being per `interface' line,
it makes absoloutely no sense to above mentioned behaviour for static VM
definitions.

I will revert my change and think about whether the vmctl(8) bits can be
improved, vm.conf(5) is totally clear.

Thank you Theo and sorry for such sloppiness.