Control network traffic by using firewalld
The firewalld package installs a large number of predefined service files and you can add more or customize them. You can then use these service definitions to open or close ports for services without knowing the protocol and port numbers they use.
Control traffic with predefined services using the CLI Copy linkLink copied!
The most straightforward method to control traffic is to add a predefined service to firewalld. This opens all necessary ports and modifies other settings according to the service definition file.
Before you begin Copy linkLink copied!
- The
firewalldservice is running.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- List all permanent firewall rules:
# firewall-cmd --list-all --permanentpublic target: default icmp-block-inversion: no interfaces: sources: services: cockpit dhcpv6-client ssh ports: protocols: forward: no masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:The command displays complete configuration with the permanent firewall rules of the default firewall zone (
public).
Enable services on the firewall by using the web console Copy linkLink copied!
By default, services are added to the default firewall zone. If you use more firewall zones on multiple network interfaces, you must select a zone first and then add the service with its corresponding port.
Before you begin Copy linkLink copied!
- You have installed the RHEL 10 web console.
For instructions, see Installing and enabling the web console.
- You enabled Administrative access in the web console.
- The
firewalldservice is running.
About this task Copy linkLink copied!
The RHEL 10 web console displays predefined firewalld services, and you can add them to active firewall zones.
The RHEL 10 web console configures the firewalld service.
The web console does not allow generic firewalld rules that are not listed in the web console.
Procedure Copy linkLink copied!
- Log in to the RHEL 10 web console.
- Click Networking.
- Click the button.
- In the Firewall section, select a zone for which you want to add the service and click Add Services.
- In the Add Services dialog box, find the service you want to enable in the firewall.
- Enable services according to your scenario:
- Click Add Services.
Configure custom ports by using the web console Copy linkLink copied!
You can add custom ports for services through the RHEL web console.
Before you begin Copy linkLink copied!
- You have installed the RHEL 10 web console.
For instructions, see Installing and enabling the web console.
- You enabled administrative access in the web console.
- The
firewalldservice is running.