CertGrid CertGrid
Concepts·LPIC-2

Firewalls, SELinux, and service reachability

Most of the time lost configuring a service on the RPM family is not spent on the service. It is spent on a firewall that never opened the port, and a security label that blocked the daemon after the firewall let the packet through. This guide establishes the starting state of both, on both families, so every later page can say which barrier it is dealing with.

Start Here Guide 2 of 29 Intermediate

Two service hosts and a client. Every service here is proven from a machine that is not running it.
Server NameIP AddressOSRolesCPURAMHDD
LPIC2-A01192.168.0.78Ubuntu 26.04 LTSPrimary service host - BIND, Apache, Samba, Postfix. Topic 204 RAID runs on loop devices; this machine has no spare disk2 Core4 GB50 GB
LPIC2-B01192.168.0.79AlmaLinux 10.2Second service host - nginx, NFS, DNS secondary, and the other family's spelling of each service2 Core4 GB50 GB
LPIC2-C01192.168.0.80Ubuntu 26.04 LTSClient - resolves, mounts and connects, so every service is proven from a machine that is not running it2 Core4 GB50 GB

This guide includes

Use this before configuring any service on the RPM family. This matters because the time lost is rarely spent on the service - it goes on the firewall, and on SELinux, which does not announce itself.

Before you start

  1. Two firewalls, in opposite states

    The families do not start from the same place.

    bash Example session
    sudo -n ufw status 2>/dev/null | head -3; echo "--- Debian-family firewall"Status: inactive--- Debian-family firewallsudo -n firewall-cmd --state 2>/dev/null; sudo -n firewall-cmd --get-default-zone 2>/dev/null; sudo -n firewall-cmd --list-services 2>/dev/nullrunningpubliccockpit dhcpv6-client ssh

    Expected resultStatus: inactive on the Debian host; on the RPM host running, default zone public, and services cockpit dhcpv6-client ssh.

    Success conditionYou know which host will silently drop your traffic.

  2. The second barrier, which the firewall does not tell you about

    SELinux is enforcing, and it blocks things the firewall permitted.

    bash Example session
    getenforce; echo "--- and SELinux, which blocks services the firewall let through"Enforcing--- and SELinux, which blocks services the firewall let through

    Expected resultEnforcing.

    Success conditionYou know to check labels as well as ports.

  3. The client can reach both servers, and cannot log into them

    Reachability and trust are separate questions.

    bash Example session
    getent hosts lpic2-a01 2>&1 | tail -1; echo "exit $? - resolved by the search domain, not /etc/hosts"192.168.0.78    lpic2-a01.practicelabpro.localexit 0 - resolved by the search domain, not /etc/hostsfor h in 192.168.0.78 192.168.0.79; do ping -c1 -W2 $h >/dev/null 2>&1 && echo "$h reachable" || echo "$h UNREACHABLE"; done192.168.0.78 reachable192.168.0.79 reachablessh -o BatchMode=yes -o ConnectTimeout=5 192.168.0.78 'echo reached; hostname' 2>&1 | tail -2; echo "--- key auth between lab hosts is NOT configured, and that is deliberate"Host key verification failed.--- key auth between lab hosts is NOT configured, and that is deliberate

    Expected resultThe name resolving through the search domain, both servers reachable, and Host key verification failed when the client tries to SSH.

    Success conditionYou know what the client can and cannot do before any service exists.

Troubleshooting

Official sources