User Tools

Site Tools


software:srfirewall:examples:intwebportfw

Port Forwarding To An Internal Web Server

This is an example of how you can port forward a port to an internal machine. In this case, we are port forwarding from the firewall to an Apache web server located on IP 192.168.0.10, with both HTTP and HTTPS services.

Basic Machine Setup

  • eth0: Internet facing interface
  • eth1: LAN facing interface
  • Dynamic IPv4 address from ISP on eth0
  • Internal LAN machines are on private subnet mask 192.168.0.0/24
  • Web server is on 192.168.0.10 with ports 80 and 443 already open
  • A second web server is on 192.168.0.11, which needs to have its port 80 available on 8080 externally

Configuration

Config: etc/srfirewall/ipv4/portfw.conf

portfw.conf
# <port> <protocol> <internal IP> <internal port> <external interface>
80 tcp 192.168.0.10 80 eth0
443 tcp 192.168.0.10 443 eth0
8080 tcp 192.168.0.11 80 eth0