I have 3 virtualbox FreeBSD vm servers running inside a pcbsd host:
..............Public IP Address..............
.....................|.......................
...................gateway/modem...................
................192.168.1.254................
.....................|.......................
...................pc-bsd....................
..............(virtualbox host)..............
................192.168.1.10.................
.....................|.......................
............192.168.1.20 (nic le0)...........
..............reverse proxy (vm1)............
.............192.168.1.30 (nic le1)..........
.....................|.......................
...........--------------------..............
..........|.....................|............
.....web server (vm2)....email server (vm3)..
......192.168.1.140.......192.168.1.150......
Currently - the reverse proxy vm isn't a gateway - only nginx is redirecting traffic - and just port 80 traffic to the web server and port 443 traffic to the email server. I ssh directly to each vm from the host pcbsd or another box in the same subnet 192.168.1.0/24.
Now - I want to tighten security and force all network traffic to go through the reverse proxy server so that the web and email servers are behind it. But I don't want this to be 'transparent' - I want pf rules to decide what goes through nic 2 (le1) to the email and web servers.
The nginx reverse proxy will still listen on port 80 and nic 1 (elo0) and redirect traffic to the web server - but now through nic 2 (le1).
And now all ssh to the web and email servers should be through the reverse proxy, using pf to ssh portforward/tunnel to them.
In /etc/rc.conf
My Questions:
1 - If I want to redirect traffic in pf between 2 nics, do I need to use NAT in /etc/pf.conf?
2 - And if so, in /etc/rc.conf do I need to use:
and in /etc/syctl.conf use:
but have /etc/pf.conf 'intercept' this traffic forwarding from nic 1 (le0) to nic 2 (le1)?
3 - If I have to use NAT, how may this affect the nginx reverse proxy that current listens on port 80 and redirects to the web server?
4 - How is traffic passed/forwarded back from the web and email servers through nic 2 to nic 1 on the reverse proxy and then to the gateway? I would prefer it did this because at some point in the future I want to set up a firewall vm and have all outbound traffic from vm servers go through this to the internet (not through the reverse proxy).
Sorry for all the noob questions - but I feel I'm making progress
..............Public IP Address..............
.....................|.......................
...................gateway/modem...................
................192.168.1.254................
.....................|.......................
...................pc-bsd....................
..............(virtualbox host)..............
................192.168.1.10.................
.....................|.......................
............192.168.1.20 (nic le0)...........
..............reverse proxy (vm1)............
.............192.168.1.30 (nic le1)..........
.....................|.......................
...........--------------------..............
..........|.....................|............
.....web server (vm2)....email server (vm3)..
......192.168.1.140.......192.168.1.150......
Currently - the reverse proxy vm isn't a gateway - only nginx is redirecting traffic - and just port 80 traffic to the web server and port 443 traffic to the email server. I ssh directly to each vm from the host pcbsd or another box in the same subnet 192.168.1.0/24.
Now - I want to tighten security and force all network traffic to go through the reverse proxy server so that the web and email servers are behind it. But I don't want this to be 'transparent' - I want pf rules to decide what goes through nic 2 (le1) to the email and web servers.
The nginx reverse proxy will still listen on port 80 and nic 1 (elo0) and redirect traffic to the web server - but now through nic 2 (le1).
And now all ssh to the web and email servers should be through the reverse proxy, using pf to ssh portforward/tunnel to them.
In /etc/rc.conf
Code:
ifconfig_le0="inet 192.168.1.20 netmask 0xffffff00"
ifconfig_le1="inet 192.168.1.30 netmask 0xffffff00"
defaultrouter="192.168.1.254"
gateway_enable="YES"
My Questions:
1 - If I want to redirect traffic in pf between 2 nics, do I need to use NAT in /etc/pf.conf?
2 - And if so, in /etc/rc.conf do I need to use:
Code:
gateway_enable="YES"
and in /etc/syctl.conf use:
Code:
sysctl net.inet.ip.forwarding=1
but have /etc/pf.conf 'intercept' this traffic forwarding from nic 1 (le0) to nic 2 (le1)?
3 - If I have to use NAT, how may this affect the nginx reverse proxy that current listens on port 80 and redirects to the web server?
4 - How is traffic passed/forwarded back from the web and email servers through nic 2 to nic 1 on the reverse proxy and then to the gateway? I would prefer it did this because at some point in the future I want to set up a firewall vm and have all outbound traffic from vm servers go through this to the internet (not through the reverse proxy).
Sorry for all the noob questions - but I feel I'm making progress
