Set up a VIP (VRRP)

Neutron filters network traffics that do not match known ip/mac pairs. Therefore, assigning an additional IP in a VM as a VIP is impossible without going through neutron. To add a VIP to a machine (and its failover), simply:

  1. reserve an IP for this use by creating a port

    % openstack port create \
    --project $PROJECT_NAME \
    --network $NETWORK_NAME \
    --fixed-ip subnet=$SUBNET_NAME,ip-address=$IP \
    --device-owner compute:None \
    $(uuidgen)
    

    Note that it is not necessary to specify the IP, in this case Neutron will choose one available. All you may need to do is (choosing as an example the project ccin2p3):

    % openstack port create --network ccin2p3 $(uuidgen)
    
  2. find the port assigned to the VM (via its IP)

    % PORT_ID=`openstack port list -f value | awk '/172.17.0.113/{print $1}'`
    
  3. allow the new IP on the port already assigned to the target VM

    % openstack port set \
    --allowed-address ip-address=$IP \
    $PORT_ID