Routers
- Create a router
openstack router create myrouter
- Set the gateway of the router being the floating IPs network with internet connectivity
openstack router set --external-gateway ext-floating1 myrouter
- Plug your subnet hosting you VM to the router
In our case, our VM my-vm-name
is on the subnet mysubnet
taylor@laptop:~$ openstack router add subnet myrouter mysubnet
- Assign the Floating IP
openstack floating ip set --port 64b0655b-d9a7-4712-9b16-1b505b065b89 195.15.240.213
- Verify the NAT association
taylor@laptop:~$ openstack floating ip list
+--------------------------------------+---------------------+------------------+--------------------------------------+--------------------------------------+----------------------------------+
| ID | Floating IP Address | Fixed IP Address | Port | Floating Network | Project |
+--------------------------------------+---------------------+------------------+--------------------------------------+--------------------------------------+----------------------------------+
| 8e6074e7-d581-4869-ac8c-c6207bd17299 | 195.15.240.213 | 10.10.10.127 | 64b0655b-d9a7-4712-9b16-1b505b065b89 | a6cf8d3b-92bc-4a84-ade6-e5c6715c1797 | ac4fafd60021431585bbb23470119557 |
+--------------------------------------+---------------------+------------------+--------------------------------------+--------------------------------------+----------------------------------+
- You should now be able to ssh your VM
taylor@laptop:~$ ssh debian@195.15.240.213
Linux my-vm-name 4.19.0-14-cloud-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Mar 18 11:21:47 2021 from 10.8.2.85
debian@my-vm-name:~$