Redhat / CentOS / Fedora Linux Open TCP/UDP Ports

‮//:sptth‬www.lautturi.com
Redhat / CentOS / Fedora Linux Open TCP/UDP Ports

To open TCP or UDP ports on a Red Hat, CentOS, or Fedora Linux system, you can use the firewall-cmd command.

firewall-cmd is a command-line utility that is used to configure the firewalld firewall on a Linux system. firewalld is a default firewall management tool on Red Hat, CentOS, and Fedora systems.

To open a TCP or UDP port, you can use the --add-port option with the firewall-cmd command. For example, to open TCP port 80, you can use the following command:

sudo firewall-cmd --add-port=80/tcp

To open UDP port 53, you can use the following command:

sudo firewall-cmd --add-port=53/udp

You can also specify a specific network interface to open the port on using the --zone and --interface options. For example, to open TCP port 80 on the eth0 interface, you can use the following command:

sudo firewall-cmd --zone=eth0 --add-port=80/tcp

By default, the changes made with firewall-cmd are not persistent across reboots. To make the changes persistent, you will need to use the --permanent option. For example:

sudo firewall-cmd --permanent --add-port=80/tcp

This will open TCP port 80 permanently on the firewall.

It's important to note that firewall-cmd is just one way to configure the firewall on a Red Hat, CentOS, or Fedora system. You can also use other tools such as iptables or nftables to configure the firewall.

Created Time:2017-10-30 14:27:15  Author:lautturi