Skip to content

Commit 04cea93

Browse files
committed
HotsTac(k)os: Enable masquerade on default zone
Enable masquerade on the default zone (typically 'public') to allow provider network traffic to reach the internet. Previously only the hotstack-external zone had masquerade, but that zone is for the hot-ex bridge which has no uplink. Masquerade must be on the zone containing the actual uplink interface for internet access to work from VMs. Also remove redundant masquerade from hotstack-external zone as it serves no purpose there. Assisted-By: Claude (claude-sonnet-4.5) Signed-off-by: Harald Jensås <hjensas@redhat.com>
1 parent 9a18b8e commit 04cea93

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

devsetup/hotstack-os/systemd/hotstack-os-infra-setup.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,11 @@ if command -v firewall-cmd >/dev/null 2>&1; then
130130
fi
131131

132132
# Service is running, configure zones
133-
# Create hotstack-external zone for provider network (with masquerading for VM external access)
133+
# Create hotstack-external zone for provider network
134134
if ! firewall-cmd --get-zones | grep -q hotstack-external; then
135135
firewall-cmd --permanent --new-zone=hotstack-external >/dev/null
136136
firewall-cmd --permanent --zone=hotstack-external --set-target=ACCEPT >/dev/null
137-
firewall-cmd --permanent --zone=hotstack-external --add-masquerade >/dev/null
138-
echo -e " $OK Created hotstack-external firewall zone with masquerading"
137+
echo -e " $OK Created hotstack-external firewall zone"
139138
fi
140139

141140
# Add provider network to hotstack-external zone
@@ -154,6 +153,17 @@ if command -v firewall-cmd >/dev/null 2>&1; then
154153
echo -e " $OK hot-ex interface already in hotstack-external zone"
155154
fi
156155

156+
# Enable masquerade on default zone for internet access from provider network
157+
# The default zone (usually 'public') contains the host's uplink interface
158+
# Masquerade is needed to NAT provider network traffic to the internet
159+
DEFAULT_ZONE=$(firewall-cmd --get-default-zone)
160+
if ! firewall-cmd --zone="$DEFAULT_ZONE" --query-masquerade &>/dev/null; then
161+
firewall-cmd --permanent --zone="$DEFAULT_ZONE" --add-masquerade >/dev/null
162+
echo -e " $OK Enabled masquerade on $DEFAULT_ZONE zone for internet access"
163+
else
164+
echo -e " $OK Masquerade already enabled on $DEFAULT_ZONE zone"
165+
fi
166+
157167
# Reload firewall to apply changes
158168
firewall-cmd --reload >/dev/null
159169
echo -e " $OK Firewall configured for provider network"

0 commit comments

Comments
 (0)