How to change the MAC address of an existing vSRX from openstack CLI commands
Procedure to change the MAC address of an existing vSRX running in openstack environment.
Please follow the below steps.
1.list down the port list
openstack port list
2.stop the VM instance, in this case the vSRX
openstack server stop vm-name
3.Remove the port as keeping the previous port will have neutron dependencies
openstack server remove port VM-name port-id
Example command
openstack server remove port vsrx 33183f58-5056-4b7c-b497-b25a5749b3c1
4. Then create a new port with new MAC. You have to pass correct port-id, network-id and new mac-address.
openstack port create port-id –network network-name –mac-address new mac-address
openstack port create 33183f58-5056-4b7c-b497-b25a5749b3c1
–network 0c1d848d-54c3-4f0b-a65d-034baaf9be45
–mac-address xx:xx:xx
5. Then add the port to the VM (vsrx). Check the name of the port in openstack port list.
openstack server add port vm-name port-id
Example:
openstack server add port vsrx 33183f58-5056-4b7c-b497-b25a5749b3c1
6. Now change the name of the port to match its UUID. This is important as OpenStack internals always use UUIDs and keeping both the same is recommended.
Earlier: In the below output ID and Name are different.
ID | Name | MAC Address | Fixed IP Addresses | Status
1f6c7520-ae1d-4eda-ba8a-f4279ca377f4 | 33183f58-5056-4b7c-b497-b25a5749b3c1 | xx:xx:xx | ip_address=‘x.x.x.’, subnet_id=‘86122f17-b937-459f-a313-25b7617c4c0d’ | ACTIVE
Here we have set the UUID 1f6c7520-ae1d-4eda-ba8a-f4279ca377f4 same as Name which is 33183f58-5056-4b7c-b497-b25a5749b3c1
openstack port set 1f6c7520-ae1d-4eda-ba8a-f4279ca377f4 –name 1f6c7520-ae1d-4eda-ba8a-f4279ca377f4
After change: ID and Name are same.
1f6c7520-ae1d-4eda-ba8a-f4279ca377f4 | 1f6c7520-ae1d-4eda-ba8a-f4279ca377f4 | xx:xx:xx | ip_address=‘x.x.x.x’, subnet_id=‘86122f17-b937-459f-a313-25b7617c4c0d’ | ACTIVE
The UUID and Name are same now.
7. Now start the VM
openstack server start vm-name