In this learning activity, you will need to configure port forwarding that will selectively forward web requests from one host to another.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Verify port 80 is open on `Server1` and `Server2`
You will want to verify that content is being served over port 80 on both
Server1
andServer2
.From
Client1
:Once logged into
Client1
, you can verify web content availability fromServer1
andServer2
with these commands:curl 10.0.1.10
curl 10.0.1.20
- Create a Zone named `testing` to Handle the Subnet Requests
On
Server1
:Create a new firewall zone:
firewall-cmd --permanent --new-zone=testing
Reload the configuration, to pick up the new zone:
firewall-cmd --reload
Add the subnet as the source :
firewall-cmd --permanent --zone=testing --add-source=10.0.1.0/24
Make sure http as a service is added:
firewall-cmd --permanent --zone=testing --add-service=http
Reload the configuration to pick up these changes:
firewall-cmd --reload
- Enable Masquerading for the Zone
You will need to enable masquerading for the zone, in order to permit forwarding:
firewall-cmd --permanent --zone=testing --add-masquerade
Reload to pick up the new configuration:
firewall-cmd --reload
- Add the Forwarding Rule to the Zone
You will need to add the rule to forward the traffic coming in to the zone on port 80 out to 10.0.1.20:80:
firewall-cmd --permanent --zone=testing --add-forward-port=port=80:proto=tcp:toport=80:toaddr=10.0.1.20
Reload the configuration:
firewall-cmd --reload
- Confirm the Port is Forwarded
Confirm the port forward by running
curl
on the site fromClient1
:curl 10.0.1.10