How to configure ufw to forward port 80/443 to internal server hosted on LAN

www.la‮tu‬turi.com
How to configure ufw to forward port 80/443 to internal server hosted on LAN

To configure the Uncomplicated Firewall (ufw) to forward incoming traffic on ports 80 (HTTP) and 443 (HTTPS) to an internal server hosted on the local area network (LAN), you will need to perform the following steps:

  1. Enable the firewall and allow incoming traffic on ports 80 and 443 by running the following commands:
sudo ufw enable
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
  1. Add a rule to forward incoming traffic on ports 80 and 443 to the internal server's IP address and port. For example, if the internal server's IP address is 192.168.1.100 and it is listening on port 8080, you can add the following rule:
sudo ufw route allow in on eth0 to 192.168.1.100 port 8080

Replace eth0 with the name of your external network interface and 192.168.1.100 with the internal server's IP address.

  1. Verify the configuration by checking the firewall rules:
sudo ufw status

This should show you the rules you have added.

Created Time:2017-10-28 21:39:00  Author:lautturi