Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions api/v1alpha5/virtualmachine_network_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ type VirtualMachineNetworkInterfaceSpec struct {

// MACAddr is the optional MAC address of this interface.
//
// If no MAC address is provided, one will be generated by either the network
// provider or vCenter.
// If no MAC address is provided, one will be generated by either the
// network provider or vCenter.
//
// Please note this field is only supported when the Network API Group is
// crd.nsx.vmware.com.
// Please note, this field is only supported for workloads using VPC
// networking.
//
MACAddr string `json:"macAddr,omitempty"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2321,11 +2321,11 @@ spec:
description: |-
MACAddr is the optional MAC address of this interface.

If no MAC address is provided, one will be generated by either the network
provider or vCenter.
If no MAC address is provided, one will be generated by either the
network provider or vCenter.

Please note this field is only supported when the Network API Group is
crd.nsx.vmware.com.
Please note, this field is only supported for workloads using VPC
networking.
pattern: ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
type: string
mtu:
Expand Down
8 changes: 4 additions & 4 deletions config/crd/bases/vmoperator.vmware.com_virtualmachines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11566,11 +11566,11 @@ spec:
description: |-
MACAddr is the optional MAC address of this interface.

If no MAC address is provided, one will be generated by either the network
provider or vCenter.
If no MAC address is provided, one will be generated by either the
network provider or vCenter.

Please note this field is only supported when the Network API Group is
crd.nsx.vmware.com.
Please note, this field is only supported for workloads using VPC
networking.
pattern: ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
type: string
mtu:
Expand Down
36 changes: 36 additions & 0 deletions docs/concepts/workloads/vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ spec:
network:
interfaces:
- name: eth0
macAddr: "00:11:22:33:44:55"
- name: eth1
```

Expand Down Expand Up @@ -547,13 +548,48 @@ The first two network interfaces in the VM are configured using the VM class. Th
| `eth1` | `VirtualVmxnet2` |
| `eth2` | `VirtualVmxnet3` |

#### MAC Address Configuration

!!! note "VPC Networking Requirement"

The `macAddr` field is only supported when using VPC networking. For other network providers, the MAC address will be automatically generated by the underlying infrastructure.

The `spec.network.interfaces[].macAddr` field allows you to specify a custom MAC address for a network interface. This field is optional and supports the following features:

- **Format**: Must be a valid MAC address in the format `XX:XX:XX:XX:XX:XX` where X is a hexadecimal digit.
- **Auto-generation**: If no MAC address is provided, one will be automatically generated by either the network provider or vCenter.
- **Network Provider Support**: Setting the MAC address is only supported for workloads connected to VPC networking.
- **Immutability**: Once set, the MAC address cannot be changed for an existing interface

Example usage:

```yaml
apiVersion: vmoperator.vmware.com/v1alpha5
kind: VirtualMachine
metadata:
name: my-vm
namespace: my-namespace
spec:
className: my-vm-class
imageName: vmi-0a0044d7c690bcbea
storageClass: my-storage-class
network:
interfaces:
- name: eth0
macAddr: "00:11:22:33:44:55"
- name: eth1
# No MAC address specified - will be auto-generated
```


#### Per-Interface Guest Network Configuration

There are several options which may be used to influence the guest's per-interface networking configuration. Support for these fields depends on the bootstrap provider.

| Field | Description | Cloud-Init | LinuxPrep | Sysprep |
|-------|-------------|:----------:|:---------:|:-------:|
| `spec.network.interfaces[].guestDeviceName` | The name of the interface in the guest | ✓ | | |
| `spec.network.interfaces[].macAddr` | The MAC address of the interface | ✓ | ✓ | ✓ |
| `spec.network.interfaces[].addresses` | The IP4 and IP6 addresses (with prefix length) for the interface | ✓ | ✓ | ✓ |
| `spec.network.interfaces[].dhcp4` | Enables DHCP4 | ✓ | ✓ | ✓ |
| `spec.network.interfaces[].dhcp6` | Enables DHCP6 | ✓ | ✓ | ✓ |
Expand Down