In this exercise, you will create and configure a router using the command line and the Dashboard, and create a set of floating IP addresses and allocate them to an instance.
Outcomes
You should be able to:
Create and manage a router.
Verify the connectivity of the router.
Create and manage floating IP addresses.
Verify the external connectivity of an instance.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command ensures that all resources required for the exercise are present.
[student@workstation ~]$ lab public-routers start
Procedure 7.2. Instructions
This guided exercise is in two parts. In part 1 you use the CLI, and in part 2 you use the Dashboard.
As the developer1 user in the finance project, create a new router and verify the resources. Use the values in the following table:
| Setting | Router |
|---|---|
| Router Name |
finance-router1
|
| External network |
provider-datacentre
|
| Network subnet |
finance-subnet3
|
On workstation, source the identity environment file for the developer1 user in the finance project.
[student@workstation ~]$ source ~/developer1-finance-rcUse the openstack router create command to create the finance-router1 router.
[student@workstation ~(developer1-finance)]$openstack router create \>finance-router1+-------------------------+------------------------------------------------------+ | Field | Value | +-------------------------+------------------------------------------------------+ | admin_state_up | UP | | availability_zone_hints | None | | availability_zones | None | | created_at | 2020-07-14T16:00:45Z | | description | | | external_gateway_info | null | | flavor_id | None | | id | 6ea98144-c243-41cc-8064-c8281821c6d0 | | location | cloud='', project.domain_id=, | | | project.domain_name='Example', | | | project.id='f76fd09fa0b14a678b5b61f9e3ec3c87', | | | project.name='finance', region_name='regionOne', | | | zone= | | name | finance-router1 | | project_id | f76fd09fa0b14a678b5b61f9e3ec3c87 | | revision_number | 0 | | routes | | | status | ACTIVE | | tags | | | updated_at | 2020-07-14T16:00:45Z | +-------------------------+------------------------------------------------------+
List the available routers to confirm that the finance-router1 has been created.
[student@workstation ~(developer1-finance)]$ openstack router list
+--------------------+-----------------+--------+-------+---------------------+
| ID | Name | Status | State | Project |
+--------------------+-----------------+--------+-------+---------------------+
| 6ea98144-c243-41cc | finance-router1 | ACTIVE | UP | f76fd09fa0b14a678b5 |
| -8064-c8281821c6d0 | | | | b61f9e3ec3c87 |
+--------------------+-----------------+--------+-------+---------------------+Connect the router to the finance-subnet3 subnet.
[student@workstation ~(developer1-finance)]$openstack router add subnet \>finance-router1 finance-subnet3
Set the external network provider-datacentre as the gateway for the router.
[student@workstation ~(developer1-finance)]$openstack router set \>--external-gateway provider-datacentre \>finance-router1
Test the routing from finance-server1.
Retrieve the console URL for the finance-server1 instance.
[student@workstation ~(developer1-finance)]$openstack console url show \>finance-server1+-------+------------------------------------------------------------------------+ | Field | Value | +-------+------------------------------------------------------------------------+ | type | novnc | | url | http://172.25.250.50:6080/vnc_auto.html?path=%3Ftoken%3Df541d3ea- | | | af9b-4e6c-9881-a9604a9e87e1 | +-------+------------------------------------------------------------------------+
Open a browser and navigate to the console URL previously obtained.
Log in to finance-server1 using root as the user name and redhat as the password.
Use the ping command to verify workstation server connectivity.
[root@finance-server1 ~]# ping -c3 workstation
PING workstation (172.25.250.9) 56(84) bytes of data.
64 bytes from workstation.lab.example.com (172.25.250.9): icmp_seq=1 ttl=63 time=2.48 ms
64 bytes from workstation.lab.example.com (172.25.250.9): icmp_seq=2 ttl=63 time=2.82 ms
64 bytes from workstation.lab.example.com (172.25.250.9): icmp_seq=3 ttl=63 time=1.31 ms
--- workstation ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 9ms
rtt min/avg/max/mdev = 1.310/2.203/2.817/0.646 msLog out from finance-server1.
[root@finance-server1 ~]# logoutIn the workstation terminal, associate a floating IP address to the finance-server1 instance and verify it.
Use the openstack floating ip create command to create one floating IP address in the provider-datacentre external network.
Your floating IP address may differ from the one shown below.
[student@workstation ~(developer1-finance)]$openstack floating ip create \>provider-datacentre+---------------------+----------------------------------------------------------+ | Field | Value | +---------------------+----------------------------------------------------------+ | created_at | 2020-07-14T16:48:40Z | | description | | | dns_domain | | | dns_name | | | fixed_ip_address | None | | floating_ip_address |172.25.250.125| | floating_network_id | ef95203b-7c9f-46c0-b328-e51aa7729798 | | id | cda15c6c-3325-49f5-a05a-740761aec953 | | location | Munch({'cloud': '', 'region_name': 'regionOne', 'zone': | | | None, 'project': Munch({'id': | | | 'f76fd09fa0b14a678b5b61f9e3ec3c87', 'name': 'finance', | | | 'domain_id': None, 'domain_name': 'Example'})}) | | name | 172.25.250.125 | | port_details | None | | port_id | None | | project_id | f76fd09fa0b14a678b5b61f9e3ec3c87 | | qos_policy_id | None | | revision_number | 0 | | router_id | None | | status | DOWN | | subnet_id | None | | tags | [] | | updated_at | 2020-07-14T16:48:40Z | +---------------------+----------------------------------------------------------+
Associate the floating IP address with the finance-server1 instance.
[student@workstation ~(developer1-finance)]$openstack server add floating ip \>finance-server1 172.25.250.125
Verify that the floating IP address has been attached to the finance-server1 instance.
[student@workstation ~(developer1-finance)]$openstack server list \>-c Name -c Networks+-----------------+------------------------------------------------+ | Name | Networks | +-----------------+------------------------------------------------+ | finance-server2 | finance-network4=192.168.4.68 | | finance-server1 | finance-network3=192.168.3.151,172.25.250.125| +-----------------+------------------------------------------------+
Now you can log in using SSH to the finance-server1 instance from workstation.
[student@workstation ~(developer1-finance)]$ssh -i .ssh/example-keypair \>cloud-user@172.25.250.125Activate the web console with: systemctl enable --now cockpit.socket This system is not registered to Red Hat Insights. See https://cloud.redhat.com/ To register this system, run: insights-client --register Last login: Tue Jul 14 13:11:09 2020 from 172.25.250.9 [cloud-user@finance-server1 ~]$
Log out from finance-server1.
[cloud-user@finance-server1 ~]$ logout
Connection to 172.25.250.125 closed.
[student@workstation ~(developer1-finance)]$Disassociate the floating IP address from the finance-server1 instance and release the floating IP address.
Disassociate the 172.25.250. floating IP address from the Nfinance-server1 instance.
Remember to use the floating IP address value from your output.
[student@workstation ~(developer1-finance)]$openstack server remove floating ip \>finance-server1 172.25.250.125
Release the 172.25.250. floating IP address.N
[student@workstation ~(developer1-finance)]$openstack floating ip delete \>172.25.250.125
List the available floating IP addresses to confirm the deletion of 172.25.250..N
[student@workstation ~(developer1-finance)]$ openstack floating ip listDisconnect and remove the finance-router1 router.
Disconnect the router from the finance-subnet3 subnet.
[student@workstation ~(developer1-finance)]$openstack router remove subnet \>finance-router1 finance-subnet3
Remove the external provider-datacentre network as the gateway for the router.
[student@workstation ~(developer1-finance)]$openstack router unset \>--external-gateway finance-router1
Delete the finance-router1 router.
[student@workstation ~(developer1-finance)]$openstack router delete \>finance-router1
Verify that the finance-router1 router has been deleted.
[student@workstation ~(developer1-finance)]$ openstack router listUse the Dashboard to perform the following steps.
In the Dashboard as developer1, create a router and then verify the resources. Use the values in the following table:
| Setting | Router |
|---|---|
| Router name |
finance-router2
|
| External network |
provider-datacentre
|
| Network subnet |
finance-subnet4
|
Log in to the Dashboard at http://dashboard.overcloud.example.com using Example as the domain, developer1 as the user, and redhat as the password. Confirm that the selected project is finance.
Navigate to → → and click to create a new router.
Enter finance-router2 as the router name. From the list, select and then click .
Click the name of the router, , to access its details. Click the tab to manage the interfaces for the router.
Click to add a new interface. From the list, select finance-network4: 192.168.4.0/24 (finance-subnet4) as the subnet and click .
To verify the resources have been created, navigate to → → .
Create and associate a floating IP address with the finance-server2 instance.
Navigate to → → and click .
Ensure that is set as the Pool, and then click .
Click in the row of the floating IP address. When the window opens, select from the list. Click .
Navigate to → →
Review the IP Address column and notice the IP address for finance-server2.
Disassociate the floating IP address from the finance-server2 instance and release the floating IP.
Navigate to → → , and click the arrow next to the button for the row labeled finance-server2.
Select to disassociate the floating IP address from the instance. In the window, click .
Navigate to → → , and click the arrow next to the button for the floating IP address row.
Select to return the floating IP address to the pool. In the window, click .
Disconnect and delete the finance-router2 router.
Navigate to → → .
Click the name of the router, , to access its details. Click the tab to manage the interfaces for the router.
Click to remove the interface. In the window, click .
Click to remove the external provider-datacentre network as the gateway for the router. In the window, click .
Click the arrow next to the button for the finance-router2 row, and then click . In the window, click .
Log out of the Dashboard by clicking the menu in the upper-right corner, and then choose .
This concludes the guided exercise.