Firewalld Port Forwarding Example (CentOS/Fedora)

Port forwarding within the same server:

firewall-cmd --add-forward-port=port=port-number:proto=tcp|udp|sctp|dccp:toport=port-number

example:

firewall-cmd --add-forward-port=port=8080:proto=tcp:toport=80

where:

  • port=8080 comes from client: :8080
  • proto=tcp uses tcp as the protocol
  • toport=80 comes to :80

for persistent connection, you must add –runtime-to-permanent option.

firewall-cmd --runtime-to-permanent

check your all firewalld settings to make sure everything is fine

firewall-cmd --list-all

example:

public (active)
target: default
icmp-block-inversion: no
interfaces: eth0 eth1
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports: port=8080:proto=tcp:toport=80:toaddr=
source-ports:
icmp-blocks:
rich rules:

Wagiman Wiryosukiro

Petani Sistem Informasi, tukang las plugin & themes Wordpress. Co-Founder SistemInformasi.biz. Saat ini aktif sebagai Developer & kontributor di OpenMandriva Linux.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: