Hi all,
I am getting a headache on trying to set pf properly. But first:
Environment:
- A FreeBSD 8.2 box with 5 NICs (em0 to em4).
- em0 and em1 are connected to routers and so parts of two local networks: A 192.168.0.* and B 192.168.1.*
- Each router has its own access to the Internet.
- em2 to em4 are connected to the Internet provider, each receiving its own IP address.
- Several jails are running on the FreeBSD box, each having as IP address an alias on em0 (192.168.0.15* so visible to the A network).
Objectives:
- 1) Give access to the Internet to the jails via A network router.
- 2) Make services in the jails available to A network.
- 3) Make services in the jails available to Internet via A network.
This is my pf.conf:
With this, the jails are getting access to the Internet.
A computer on Network A can access the service on serv1 jail.
A computer from the Internet getting through Network A to serv1 jail hangs until timeout.
This is the output of
So the question is... why does it try to reply on em2 while replying normally on em0 in the case of a PC inside Network A (so with an 192.168.0.* IP)?
Thank you for your help.
I am getting a headache on trying to set pf properly. But first:
Environment:
- A FreeBSD 8.2 box with 5 NICs (em0 to em4).
- em0 and em1 are connected to routers and so parts of two local networks: A 192.168.0.* and B 192.168.1.*
- Each router has its own access to the Internet.
- em2 to em4 are connected to the Internet provider, each receiving its own IP address.
- Several jails are running on the FreeBSD box, each having as IP address an alias on em0 (192.168.0.15* so visible to the A network).
Objectives:
- 1) Give access to the Internet to the jails via A network router.
- 2) Make services in the jails available to A network.
- 3) Make services in the jails available to Internet via A network.
This is my pf.conf:
Code:
net_if0="em0"
net_if1="em1"
ext_if2="em2"
ext_if3="em3"
ext_if4="em4"
net0_addr="192.168.0.90"
serv1="192.168.0.152"
serv2="192.168.0.155"
scrub in all
#Internet for jails through Network A
nat on $net_if0 from {$serv1,$serv2} to any -> ($net_if0)
#Redirect Network A requests to jails
rdr pass log(all) on $net_if0 inet proto { tcp, udp } from any to ($net_if0) port 10090 -> $serv1 port 80
pass in all
pass out all
With this, the jails are getting access to the Internet.
A computer on Network A can access the service on serv1 jail.
A computer from the Internet getting through Network A to serv1 jail hangs until timeout.
This is the output of
tcpdump -n -e -ttt -i pflog0 host IP_OF_PC
:
Code:
00:00:03.026752 rule 0/0(match): rdr in on em0: IP_OF_PC.57069 > 192.168.0.152.80: [|tcp]
00:00:00.000036 rule 0/0(match): rdr out on em2: 192.168.0.90.10090 > IP_OF_PC.57069: [|tcp]
00:00:02.999186 rule 0/0(match): rdr out on em2: 192.168.0.90.10090 > IP_OF_PC.57069: [|tcp]
00:00:05.999998 rule 0/0(match): rdr out on em2: 192.168.0.90.10090 > IP_OF_PC.57069: [|tcp]
00:00:11.999960 rule 0/0(match): rdr out on em2: 192.168.0.90.10090 > IP_OF_PC.57069: [|tcp]
So the question is... why does it try to reply on em2 while replying normally on em0 in the case of a PC inside Network A (so with an 192.168.0.* IP)?
Thank you for your help.