Change Gateway on the Router

To change the current gateway on the Router from one network to another, you remove the old gateway, and then add the new one. But first you must either disassociate or delete any floating IPs before you can change the gateway.

Step 1: Source Your OpenStack RC File

First, source your OpenStack RC file to set the necessary environment variables for authentication.

sudo -i -u stack
cd ~/devstack
source openrc admin admin

Step 2: List Floating IPs

List all floating IPs to find the ones associated with the current external network.

openstack floating ip list

Step 3: Disassociate Floating IPs

For each floating IP that is associated with the current external network, disassociate it.

openstack floating ip unset --port <FLOATING_IP>

Step 4: Remove the Current Gateway

Once all floating IPs are disassociated, you can remove the existing gateway.

openstack router unset --external-gateway <ROUTER_NAME>

Step 5: Set the New Gateway

Set the new external gateway for the router.

openstack router set --external-gateway <EXTERNAL_NETWORK> <ROUTER_NAME>