Setting MAC address of vm in vm.conf with lladdr

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting MAC address of vm in vm.conf with lladdr

Eric Brown-2
Dear List,

I am using the current snapshot (Dec 3 as of this post), and I am trying
to set the MAC address of a vm host in vm.conf.

However, the MAC address reported by ifconfig -a seems to change with
each restart. The lladdr that I had typed in was from a copy/paste of a
random assignment, so I hope that it is valid.

I know that this is still a WIP, but I thought I would ask in case I'm
making a dumb mistake.

Thanks,
Eric


-------------
/etc/vm.conf:

vm "current.ericcbrown.com" {
  memory 2048M
  kernel "/root/vmm/current/bsd"
  disk "/var/vmm/current/disk.img"
  interface tap {
    lladdr fe:e1:ba:d1:77:24
    switch uplink
  }
}

switch uplink {
  add bge0
}

Reply | Threaded
Open this post in threaded view
|

Re: Setting MAC address of vm in vm.conf with lladdr

Reyk Floeter-2
Hi,

you are second person who repots this since Friday,
I will check tomorrow if lladdr in vm.conf got broken.

The config looks OK.

Reyk

> Am 04.12.2016 um 16:55 schrieb Eric Brown <[hidden email]>:
>
> Dear List,
>
> I am using the current snapshot (Dec 3 as of this post), and I am trying
> to set the MAC address of a vm host in vm.conf.
>
> However, the MAC address reported by ifconfig -a seems to change with
> each restart. The lladdr that I had typed in was from a copy/paste of a
> random assignment, so I hope that it is valid.
>
> I know that this is still a WIP, but I thought I would ask in case I'm
> making a dumb mistake.
>
> Thanks,
> Eric
>
>
> -------------
> /etc/vm.conf:
>
> vm "current.ericcbrown.com" {
>  memory 2048M
>  kernel "/root/vmm/current/bsd"
>  disk "/var/vmm/current/disk.img"
>  interface tap {
>    lladdr fe:e1:ba:d1:77:24
>    switch uplink
>  }
> }
>
> switch uplink {
>  add bge0
> }

Reply | Threaded
Open this post in threaded view
|

Re: Setting MAC address of vm in vm.conf with lladdr

Reyk Floeter-2
In reply to this post by Eric Brown-2
On Sun, Dec 04, 2016 at 09:55:32AM -0600, Eric Brown wrote:

> Dear List,
>
> I am using the current snapshot (Dec 3 as of this post), and I am trying
> to set the MAC address of a vm host in vm.conf.
>
> However, the MAC address reported by ifconfig -a seems to change with
> each restart. The lladdr that I had typed in was from a copy/paste of a
> random assignment, so I hope that it is valid.
>
> I know that this is still a WIP, but I thought I would ask in case I'm
> making a dumb mistake.
>
> Thanks,
> Eric
>

I cannot reproduce it, it works as intended.  Are you sure that you
were looking at the MAC address on the "VM guest side" and not on the
host side, as mentioned in vm.conf(5):

             lladdr etheraddr
                     Change the link layer address (MAC address) of the
                     interface on the VM guest side.  If not specified, a
                     randomized address will be assigned by vmd(8).

Can you try with current and run vmd in foreground "vmd -dvv", I added
a debug message that will show more details:

run_vm: initializing hardware for vm openbsd.vm
virtio_init: vm "openbsd.vm" vio0 lladdr 00:01:ba:d0:e8:db
virtio_init: vm "openbsd.vm" vio1 lladdr fe:e1:bb:d2:bc:72
run_vm: starting vcpu threads for vm openbsd.vm

As you see, my test cases uses a fixed lladdr for the first interface;
ifconfig within the guest show the same.

Reyk

>
> -------------
> /etc/vm.conf:
>
> vm "current.ericcbrown.com" {
>   memory 2048M
>   kernel "/root/vmm/current/bsd"
>   disk "/var/vmm/current/disk.img"
>   interface tap {
>     lladdr fe:e1:ba:d1:77:24
>     switch uplink
>   }
> }
>
> switch uplink {
>   add bge0
> }
>

--

Reply | Threaded
Open this post in threaded view
|

Re: Setting MAC address of vm in vm.conf with lladdr

Eric Brown-2
Reyk Floeter <[hidden email]> writes:

> I cannot reproduce it, it works as intended.  Are you sure that you
> were looking at the MAC address on the "VM guest side" and not on the
> host side, as mentioned in vm.conf(5):
>
>              lladdr etheraddr
>                      Change the link layer address (MAC address) of the
>                      interface on the VM guest side.  If not specified, a
>                      randomized address will be assigned by vmd(8).
>
> Can you try with current and run vmd in foreground "vmd -dvv", I added
> a debug message that will show more details:
>
> run_vm: initializing hardware for vm openbsd.vm
> virtio_init: vm "openbsd.vm" vio0 lladdr 00:01:ba:d0:e8:db
> virtio_init: vm "openbsd.vm" vio1 lladdr fe:e1:bb:d2:bc:72
> run_vm: starting vcpu threads for vm openbsd.vm
>
> As you see, my test cases uses a fixed lladdr for the first interface;
> ifconfig within the guest show the same.
>
> Reyk
>

Hi Reyk,

Thank you for your response.  I think you have identified my
misunderstanding of the lladdr setting, which sets the vio0 address on
the inside of the VM just fine.

My interest in this setting is to assign an IP address from a DHCP
server based on MAC address, so that I can e.g. ssh and/or http into
this VM.

I am gathering that this should be done on the host side?

Eric