Hi,
I have this problem in redirecting traffic from a public IP (host) to an private IP (jail) on port 80. I have several jails, and it works fine if I were to redirect the traffic to a jail that resides on the same host. But if I try to redirect it to a jail outside of the host, it failed.
Both hosts are in the same subnet. Each server has 2 NICs, em0 and em1. em0 is assigned with public IPs, and em1 is assigned with private IPs. Each jail has two IPs, both public and private. I have tried redirecting to the jail's public IP as well but to no avail.
Rule in /etc/pf.conf (web01 is the host public IP, and wj01 is the jail):
tcpdump output when I set the rule to rdr to local jail:
tcpdump output when I set the rule to rdr to external jail:
I'm still playing around with the rules, but to this point nothing seems to work. It's like I'm missing something obvious, but I just can't figure out what it is
.
Appreciate if someone could enlighten me with some points.
Thanks.
I have this problem in redirecting traffic from a public IP (host) to an private IP (jail) on port 80. I have several jails, and it works fine if I were to redirect the traffic to a jail that resides on the same host. But if I try to redirect it to a jail outside of the host, it failed.
Both hosts are in the same subnet. Each server has 2 NICs, em0 and em1. em0 is assigned with public IPs, and em1 is assigned with private IPs. Each jail has two IPs, both public and private. I have tried redirecting to the jail's public IP as well but to no avail.
Rule in /etc/pf.conf (web01 is the host public IP, and wj01 is the jail):
Code:
rdr pass log (all) on $ext_if inet proto tcp from any to $web01 port 80 -> $wj01
tcpdump output when I set the rule to rdr to local jail:
Code:
00:00:00.327793 rule 0..16777216/0(match): rdr in on em0: x.x.x.x.21396 > 192.168.0.21.80: Flags [.], ack 878, win 8280, options [nop,nop,TS val 4847531 ecr 2117623831], length 0
00:00:04.672817 rule 0..16777216/0(match): rdr out on em0: 176.9.77.72.80 > x.x.x.x.21396: Flags [F.], seq 878, ack 722, win 1237, options [nop,nop,TS val 2117628832 ecr 4847531], length 0
00:00:00.228523 rule 0..16777216/0(match): rdr in on em0: x.x.x.x.21396 > 192.168.0.21.80: Flags [.], ack 879, win 8280, options [nop,nop,TS val 4852432 ecr 2117628832], length 0
00:00:00.009993 rule 0..16777216/0(match): rdr in on em0: x.x.x.x.21396 > 192.168.0.21.80: Flags [F.], seq 721, ack 879, win 8280, options [nop,nop,TS val 4852442 ecr 2117628832], length 0
00:00:00.000015 rule 0..16777216/0(match): rdr out on em0: 176.9.77.72.80 > x.x.x.x.21396: Flags [.], ack 723, win 1237, options [nop,nop,TS val 2117629070 ecr 4852442], length 0
00:00:00.468363 rule 0..16777216/0(match): rdr in on em0: x.x.x.x.46103 > 192.168.0.21.80: Flags [S], seq 51293176, win 65535, options [mss 1452,nop,wscale 3,sackOK,TS val 4852910 ecr 0], length 0
tcpdump output when I set the rule to rdr to external jail:
Code:
00:00:00.000000 rule 0..16777216/0(match): rdr in on em0: x.x.x.x.63811 > 192.168.0.30.80: Flags [S], seq 502839335, win 65535, options [mss 1452,nop,wscale 3,sackOK,TS val 5298641 ecr 0], length 0
00:00:00.256880 rule 0..16777216/0(match): rdr in on em0: x.x.x.x.25358 > 192.168.0.30.80: Flags [S], seq 1736699979, win 65535, options [mss 1452,nop,wscale 3,sackOK,TS val 5298892 ecr 0], length 0
00:00:02.741578 rule 0..16777216/0(match): rdr in on em0: x.x.x.x.63811 > 192.168.0.30.80: Flags [S], seq 502839335, win 65535, options [mss 1452,nop,wscale 3,sackOK,TS val 5301641 ecr 0], length 0
00:00:00.258529 rule 0..16777216/0(match): rdr in on em0: x.x.x.x.25358 > 192.168.0.30.80: Flags [S], seq 1736699979, win 65535, options [mss 1452,nop,wscale 3,sackOK,TS val 5301892 ecr 0], length 0
00:00:02.941571 rule 0..16777216/0(match): rdr in on em0: x.x.x.x.63811 > 192.168.0.30.80: Flags [S], seq 502839335, win 65535, options [mss 1452,nop,wscale 3,sackOK,TS val 5304841 ecr 0], length 0
00:00:00.257690 rule 0..16777216/0(match): rdr in on em0: x.x.x.x.25358 > 192.168.0.30.80: Flags [S], seq 1736699979, win 65535, options [mss 1452,nop,wscale 3,sackOK,TS val 5305092 ecr 0], length 0
I'm still playing around with the rules, but to this point nothing seems to work. It's like I'm missing something obvious, but I just can't figure out what it is

Appreciate if someone could enlighten me with some points.
Thanks.