Hello,
I have a server acting as a router. I use FreeBSD 9.1 (i386) and PF on it. It has three network interfaces. Two of them are for WAN and remaining one is for LAN. I have no problem with NAT. It's working without problem. The problem is, I cannot accept incoming TCP connections from the second WAN.
Here's the necessary parts of my pf.conf
The redirection on the port 80 of $wan_2 is not working. The packet reaches to 192.168.0.3 but the reply doesn't reach to the source address. When I disable port forwarding and directly bind httpd to $ip_2 on the router, it still does not reply to the source.
I will be very happy if anyone can help me solve this problem.
Thanks.
I have a server acting as a router. I use FreeBSD 9.1 (i386) and PF on it. It has three network interfaces. Two of them are for WAN and remaining one is for LAN. I have no problem with NAT. It's working without problem. The problem is, I cannot accept incoming TCP connections from the second WAN.
Here's the necessary parts of my pf.conf
Code:
table <network_1> persist { 192.168.0.1, 192.168.0.2, 192.168.0.50, 192.168.0.51, 192.168.0.52, 192.168.0.53 }
table <network_1_area> persist { 192.168.0.0/24 }
table <network_2> persist { 192.168.0.3, 192.168.0.4, 192.168.0.5, 192.168.0.20 }
wan_2_tcp_incoming = "{ 80 }"
icmp_types = "{ echoreq, unreach }"
set block-policy return
set loginterface $wan_1
set state-policy if-bound
set skip on lo0
# NAT
nat on $wan_1 from <network_1> to any -> $ip_1
nat on $wan_2 from <network_2> to any -> $ip_2
rdr pass on $wan_1 proto tcp from any to $ip_1 port 80 -> 192.168.0.2 port 80
rdr pass on $wan_1 proto tcp from any to $ip_1 port 8000 -> 192.168.0.2 port 8000
rdr pass on $wan_1 proto tcp from any to $ip_1 port 443 -> 192.168.0.2 port 443
rdr pass on $wan_1 proto tcp from any to $ip_1 port 2222 -> 192.168.0.1 port 22
rdr pass log on $wan_2 proto tcp from any to $ip_2 port 80 -> 192.168.0.3 port 80 # Not working
pass in on $lan all
block in log on ste0 all
block in log on ste1 all
pass in on $wan_1 inet proto tcp from any to $ip_1 port $wan_1_tcp_incoming
pass in on $wan_1 inet proto udp from any to $ip_1 port $wan_1_udp
# pass in log on $wan_2 reply-to ( $wan_2 $gw_2 ) proto tcp from any to $ip_2 port $wan_2_tcp_incoming
pass in inet proto udp from any port 53 to any
pass inet proto icmp all icmp-type $icmp_types
pass in on $lan route-to ( $wan_1 $gw_1 ) from <network_1> to !<network_1_area> keep state
pass in on $lan route-to ( $wan_2 $gw_2 ) from <network_2> to !<network_1_area> keep state
pass in on $wan_1 route-to ( $wan_2 $gw_2 ) from <network_2> keep state
pass in on $wan_2 route-to ( $wan_1 $gw_1 ) from <network_1> keep state
pass out on $wan_1 route-to ( $wan_2 $gw_2 ) from $wan_2 to any keep state
pass out on $wan_2 route-to ( $wan_1 $gw_1 ) from $wan_1 to any keep state
pass out all
# END
The redirection on the port 80 of $wan_2 is not working. The packet reaches to 192.168.0.3 but the reply doesn't reach to the source address. When I disable port forwarding and directly bind httpd to $ip_2 on the router, it still does not reply to the source.
I will be very happy if anyone can help me solve this problem.
Thanks.