networking

Port Forwarding

This is intended as a quick reference for Port Forwarding.

Port Forwarding

Add port forwarding from 443 to 18443 with iptables

iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 18443
iptables -L -t nat

Add port forwarding from 443 to 18443 with firewalld

systemctl start firewalld
systemctl enable firewalld
firewall-cmd --add-forward-port=port=443:proto=tcp:toport=18443
firewall-cmd --runtime-to-permanent
firewall-cmd --list-all

Remove port forwarding from 443 to 18443 with firewalld

firewall-cmd --remove-forward-port=port=443:proto=tcp:toport=18443
firewall-cmd --runtime-to-permanent
firewall-cmd --list-all

References