|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * virt/vm_networking/virt-using-mac-address-pool-for-vms.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="virt-custom-kubemacpool-range_{context}"] |
| 7 | += Customizing the MAC pool range |
| 8 | + |
| 9 | +[role="_abstract"] |
| 10 | +KubeMacPool works by allocating MAC addresses to VMs from a range. The `rangeStart` and `rangeEnd` parameters in the `HyperConverged` custom resource (CR) define the MAC pool range. |
| 11 | + |
| 12 | +As a cluster administrator, you can configure this range to ensure that MAC addresses for VMs hosted on {VirtProductName} do not conflict with other virtualization solutions on the same network. |
| 13 | + |
| 14 | +.Prerequisites |
| 15 | + |
| 16 | +* You have cluster administrator access on an {product-title} cluster. |
| 17 | +* You have installed the {oc-first}. |
| 18 | +
|
| 19 | +.Procedure |
| 20 | + |
| 21 | +. Edit the `HyperConverged` CR by running the following command: |
| 22 | ++ |
| 23 | +[source,terminal,subs="attributes+"] |
| 24 | +---- |
| 25 | +$ oc edit hyperconverged kubevirt-hyperconverged -n {CNVNamespace} |
| 26 | +---- |
| 27 | + |
| 28 | +. Update the `HyperConverged` CR to configure the `rangeStart` and `rangeEnd` parameters that define your required MAC address range: |
| 29 | ++ |
| 30 | +[source,yaml] |
| 31 | +---- |
| 32 | +apiVersion: hco.kubevirt.io/v1beta1 |
| 33 | +kind: HyperConverged |
| 34 | +metadata: |
| 35 | + name: kubevirt-hyperconverged |
| 36 | +spec: |
| 37 | + kubeMacPoolConfiguration: |
| 38 | + rangeStart: "AA:00:00:00:00:00" |
| 39 | + rangeEnd: "FD:FF:FF:FF:FF:FF" |
| 40 | +# ... |
| 41 | +---- |
| 42 | + |
| 43 | +.Verification |
| 44 | + |
| 45 | +. Run the following command and observe the output: |
| 46 | ++ |
| 47 | +[source,terminal,subs="attributes+"] |
| 48 | +---- |
| 49 | +$ oc get hco kubevirt-hyperconverged -n {CNVNamespace} -o=jsonpath='{.spec.kubeMacPoolConfiguration}' |
| 50 | +---- |
| 51 | ++ |
| 52 | +If you have successfully applied the configuration changes, the output shows the new MAC pool range you have configured: |
| 53 | ++ |
| 54 | +Example output: |
| 55 | ++ |
| 56 | +[source,terminal] |
| 57 | +---- |
| 58 | +{ |
| 59 | + "rangeStart": "AA:00:00:00:00:00", |
| 60 | + "rangeEnd": "FD:FF:FF:FF:FF:FF" |
| 61 | +} |
| 62 | +---- |
| 63 | + |
| 64 | +. Optional. Create a new VM and run the following command to check the MAC address of the VM's network interface: |
| 65 | ++ |
| 66 | +[source,terminal] |
| 67 | +---- |
| 68 | +$ oc get vmi <vm-name> -o=jsonpath='{.status.interfaces[0].macAddress}' |
| 69 | +---- |
| 70 | ++ |
| 71 | +Example output: |
| 72 | ++ |
| 73 | +[source,yaml] |
| 74 | +---- |
| 75 | +macAddress: AA:00:00:00:00:04 |
| 76 | +---- |
| 77 | ++ |
| 78 | +If you have successfully applied the configuration changes, the `macAddress` field in the VM interface is within the range you specified in your `kubeMacPoolConfiguration`, between the value of `rangeStart` and `rangeEnd`. |
0 commit comments