Add an interface to an existing instance
Let's say you want to add an interface to an existing instance on a network that you created newly.
You can create a port on that network which is attached to the instance like this:
openstack port create --network new-network my-interface
openstack server port add <instance-id> my-interface
Now there is a new interface attached to your instance, but it is still in status
To bring the port up do:
sudo ip addr add <ip-cidr> dev ens7
ip link set dev <new-device> up
Now your instance has connectivity on the new network, but this is not persisted.
Depending on your linux distribution, the way persist this may very. On ubuntu, netplan is used by default.
To add the new interface to netplan, create a new file:
sudo nano /etc/netplan/99-config.yaml
Add the following contents to the file and save it,
Reboot the instance.