I'm trying to setup a firewalld rule to forward 80/tcp to 8080-8081, the rule was setup correctly, but seems only partially working.
The problem is that the traffic is always forwarded to 8080 not 8081, is anything wrong ?
Below is my env:
- create two http servers on 192.168.30.30, listening on 8080 and 8081
setup a firewalld rule to do the port forward
firewall-cmd --add-forward-port='port=80:proto=tcp:toport=8080-8081' --permanent
from a client, curl http://192.168.30.30:80 (which always forward to port 8080)
below is my firewalld settings:
firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens160
sources:
services: ssh dhcpv6-client
ports: 80/tcp
protocols:
masquerade: yes
forward-ports: port=80:proto=tcp:toport=8080-8081:toaddr=
source-ports:
icmp-blocks:
rich rules:
sysctl -a | grep ip_forward
net.ipv4.ip_forward = 1
net.ipv4.ip_forward_use_pmtu = 0