Any VNIC that a user creates can only have one MAC address. You can modify the MAC address by using the dladm modify-vnic command. You can configure the VNICs created for kernel zones with one or more MAC addresses.
You can modify the existing MAC address of a VNIC configured on a datalink. You can either modify the MAC addresses of all the VNICs or selectively modify the MAC addresses of the specified VNICs. You can also modify the VLAN ID and the MAC address of a VNIC simultaneously.
To modify the MAC address of a VNIC, use the following command syntax:
$ dladm modify-vnic –m MAC-address VNIC
where MAC-address is the new MAC address that you want to assign to the VNIC.
Example 19 Modifying the MAC Address of a VNICIn this example, vnic0 is assigned a specific MAC address.
$ dladm modify-vnic -m 3:8:20:5f:84:ff vnic0 $ dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE IDS vnic0 net0 1000 3:8:20:5f:84:ff fixed VID:0
To modify the MAC addresses of all the VNICs on a datalink, use the following command syntax:
$ dladm modify-vnic –m random –L link
In this command syntax, the –m random option is equivalent to the –m auto option. The MAC address is assigned automatically to the VNICs on a random basis.
Example 20 Modifying the MAC Addresses of All the VNICs on a DatalinkIn this example, the MAC addresses of all the VNICs configured over the datalink net0 are automatically modified on a random basis.
$ dladm modify-vnic -m random -L net0 $ dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE IDS vnic0 net0 1000 2:8:20:22:9d:bb random VID:0 vnic1 net0 1000 2:8:20:72:2e:9 random VID:0 vnic2 net0 1000 2:8:20:2f:e5:83 random VID:0
To modify the MAC addresses of VNICs on a selective basis, use the following command syntax:
$ dladm modify-vnic –m random VNIC,VNIC,[...]
For both the global and selective modifications, you specify random for the –m option.
Example 21 Modifying the MAC Addresses of VNICs on Selective BasisIn this example, the MAC addresses of vnic0 and vnic2 that are configured over the datalink net0 are selectively modified.
$ dladm modify-vnic -m random vnic0,vnic2 $ dladm show-vnic LINK OVER SPEED MACADDRESS MACADDRTYPE IDS vnic0 net0 1000 2:8:20:2f:e5:83 random VID:0 vnic1 net0 1000 2:8:20:5f:84:ff fixed VID:0 vnic2 net0 1000 2:8:20:2f:e5:83 random VID:0
To modify the VLAN ID and the MAC address of a VNIC simultaneously, use the following command syntax:
$ dladm modify-vnic –m random –v vid VNIC
Caution - Modifying multiple attributes of the VNICs globally might cause unexpected behavior with the VNICs. Instead, modify the multiple attributes of the VNICs separately. |
In this example, the VLAN ID and the MAC address of vnic0 are modified simultaneously.
$ dladm modify-vnic -m random -v 123 vnic0 $ dladm show-vnic vnic0 LINK OVER SPEED MACADDRESS MACADDRTYPE IDS vnic0 net0 1000 2:8:20:2f:e5:83 random VID:123