Configure node networking to connect a VM to an additional network, and then connect the VM to an external web server on the additional network.
Outcomes
Create a node network configuration policy that configures a Linux bridge where DHCP is enabled on an identified node interface.
Create a network attachment definition for the Linux bridge.
Attach a secondary interface with a custom MAC address on a virtual machine.
Verify communication between the VM and resources on the additional network.
As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.
[student@workstation ~]$ lab start multihomed-review
Instructions
The dev-external VM in the multihomed-review project requires access to an Apache HTTP instance on server.srv.example.com.
That Apache server accepts requests only from a specific IP on the external network within the 192.168.51.0/24 IP range.
A DHCP server on the external network provides the required static IP to the 00:00:00:00:00:02 MAC address.
The VM needs an additional network interface that is connected to the external network with the right IP to communicate with the Apache HTTP server.
As the admin user, label the nodes worker01 and worker02 with the external-network=true label.
Configure a Linux bridge named br0 on the worker01 and worker02 nodes, and then create a network attachment definition named br0-network in the multihomed-review project.
For creating those resources from the command line, you can find partial resource YAML files in the ~/DO316/labs/multihomed-review/ path.
Before attaching the second network interface, connect to server.srv.example.com on the dev-external VM and confirm that a warning is displayed about permissions to the Apache instance.
Attach an additional network interface to the VM that uses the br0-network network attachment definition, and specify 00:00:00:00:00:02 as the MAC address for the interface.
Finally, test connectivity to server.srv.example.com from the VM.
Confirm that the response is a Hello, World! message.
As the OpenShift admin user, label the nodes worker01 and worker02 with the external-network=true label.
Open a web browser and navigate to https://console-openshift-console.apps.ocp4.example.com
Click and log in as the admin user with redhatocp as the password.
Navigate to → , click the vertical ellipsis icon next to worker01, and then click .
Type external-network=true in the field and click .
Repeat this step with the worker02 node.
On the → page, select from the drop-down menu, type external in the field, and select the external-network=true label.
![]() |
Verify that the node list contains only the worker01 and worker02 nodes.
Create a Linux bridge network on the worker01 and worker02 nodes with the following requirements:
| Parameter | Value |
|---|---|
| Name | br0-ens4-policy |
| Interface name | br0 |
| Interface type | Bridge |
| IPv4 | Enabled |
| DHCP | Enabled |
| Bridge port | ens4 |
| Node Selector |
external-network=true
|
Navigate to → and click .
Complete the form with the provided specifications.
Select the checkbox to open the node selector.
Click , and type external-network as the key and true as the value.
Click and then click to create the node network configuration policy.
Confirm that the policy is successfully configured on the nodes by verifying its status on the → page.
Wait until the node network state is 2 Available.
![]() |
Create a network attachment definition in the multihomed-review project with the following requirements:
| Parameter | Value |
|---|---|
| Name | br0-network |
| Namespace | multihomed-review |
| Network Type | CNV Linux bridge |
| Bridge Name | br0 |
From the console of the dev-external VM, use the curl command to connect to server.srv.example.com, and then confirm that you do not have permission to access the site.
The server.srv.example.com fully qualified domain name also resolves with the server hostname for resources in the 192.168.51.0/24 network.
Navigate to → .
Select the multihomed-review project from the list.
Click the VM and select the tab to open the VM's console.
Click to display the credentials of the VM, and then use those credentials to log in to the VM.
![]() |
Test the connectivity to the Apache HTTP instance on server.srv.example.com with the curl server command.
Confirm that you receive a warning that you do not have permission to access the resource.
[developer@dev-external ~]$curl server<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>403 Forbidden</title> </head><body> <h1>Forbidden</h1> <p>You don't have permission to access this resource.</p> </body></html>
Attach a secondary network interface to the dev-external VM with the following information:
| Parameter | Value |
|---|---|
| Name | Leave the default name |
| Model | virtio |
| Network | br0-network |
| Type | Bridge |
| MAC Address | 00:00:00:00:00:02 |
The custom MAC address, 00:00:00:00:00:02, is required for the VM to receive the 192.168.51.20/24 static IP address from the DHCP server in the Linux bridge network.
On the VM page, click the tab and then click to display the network interfaces that are connected to the VM.
Click to create an interface on the VM. Modify the parameters to match the specifications from the table. Click to attach the interface.
Restart the VM to apply the pending changes. Click → , and then click to confirm the action.
Wait until the VM is in the running state.
From the console of the dev-external VM, use the curl command to connect to server.srv.example.com, and confirm that you receive a Hello, World! response.
Click the tab to access the VM's console. Click to display the credentials of the VM and then use those credentials to log in to the VM.
Connect to the Apache HTTP instance on server.srv.example.com with the curl server command.
Confirm that you receive a Hello, World! response.
[developer@dev-external ~]$ curl server
Hello, World!