HTTP(S) is just an example, I have many other services that wouldn't be able to communicate the real IP via a proxy, therefore PF solution is a must.
I am referring to RDR and NAT as they are understood in the context of pf.conf (i.e. I mean the RDR and NAT statements).
Both my VPS and Home Server (HS) run FreeBSD. The two are connected using the simplest point-to-point OpenVPN setup. The VPS has address 10.8.0.1 and the home server - 10.8.0.2 in this VPN. I would like to redirect HTTP(S) ports from VPS to the home server without using NAT in order not to lose the source IPs.
The following NAT-based setup works:
VPS /etc/pf.conf
HS /etc/pf.conf
127.0.11.1 and 127.0.13.1 are respectively IPs of HTTP/HTTPS jails running on lo1.
The following non-NAT setup results in very slow transfers and ICMP unreachable errors:
VPS /etc/pf.conf
HS /etc/pf.conf
The ICMP errors I am getting on the HS (on the VPS side all looks good but SLOW):
Does anyone have experience in this type of non-NAT redirects from VPS to HS? Thank you in advance.
I am referring to RDR and NAT as they are understood in the context of pf.conf (i.e. I mean the RDR and NAT statements).
Both my VPS and Home Server (HS) run FreeBSD. The two are connected using the simplest point-to-point OpenVPN setup. The VPS has address 10.8.0.1 and the home server - 10.8.0.2 in this VPN. I would like to redirect HTTP(S) ports from VPS to the home server without using NAT in order not to lose the source IPs.
The following NAT-based setup works:
VPS /etc/pf.conf
Code:
rdr on vtnet0 inet proto tcp from any to (vtnet0) port { 80, 443 } -> 10.8.0.2
nat on tun0 from any to 10.8.0.2 port { 80, 443 } -> (tun0)
HS /etc/pf.conf
Code:
rdr pass on tun0 proto tcp from any to 10.8.0.2 port 80 -> 127.0.11.1
rdr pass on tun0 proto tcp from any to 10.8.0.2 port 443 -> 127.0.13.1
127.0.11.1 and 127.0.13.1 are respectively IPs of HTTP/HTTPS jails running on lo1.
The following non-NAT setup results in very slow transfers and ICMP unreachable errors:
VPS /etc/pf.conf
Code:
rdr on vtnet0 proto tcp from any to (vtnet0) port { 80, 443 } -> 10.8.0.2
HS /etc/pf.conf
Code:
rdr on tun0 proto tcp from any to 10.8.0.2 port 80 -> 127.0.11.1
rdr on tun0 proto tcp from any to 10.8.0.2 port 443 -> 127.0.13.1
pass in on tun0 reply-to (tun0 10.8.0.1) proto tcp from any to 127.0.11.1 port 80
pass in on tun0 reply-to (tun0 10.8.0.1) proto tcp from any to 127.0.13.1 port 443
The ICMP errors I am getting on the HS (on the VPS side all looks good but SLOW):
Code:
12:57:55.578405 IP localhost > 10.8.0.2: ICMP another.external.ip.from.outside.both.the.VPN.and.HS.networks unreachable - need to frag (mtu 1500), length 60
Does anyone have experience in this type of non-NAT redirects from VPS to HS? Thank you in advance.