I am having a bit of trouble working out how to solve the issue that I am having and I was hoping someone could point me in the correct direction.
1. I am using multiple jails behind a HTTP proxy to accept traffic and send it to the correct jail.
2. I am using IPFW kernel NAT which is working fine - (https://forums.freebsd.org/threads/nat-and-ipfw-cannot-get-it-to-work.53553/#post-302532)
3. The proxy and the jails share the same public IP.
4. All jails have an IP on the 10.0.0.0/16 subnet using a cloned loopback (lo1)
Everything is working fine except for one issue:
The proxy (nginx) receives traffic for jail1.example.com but jail1.example.com is configured to proxy_pass the traffic to jail2.example.com for this particular url. Nginx (on jail1.example.com) resolves the IP of jail2.example.com (which is the public IP of the proxy and jails) and sends the traffic over to jail2.example.com correctly. The traffic leaves jail1.example.com for jail2.example.com and is intercepted by FreeBSD. This is where is goes bad, FreeBSD sees the traffic as a response to the initial incoming traffic to jail1.example.com instead of new traffic from jail1.example.com to jail2.example.com, so it sends the traffic to jail2.example.com on the same high port it come into jail1.example.com. jail2.example.com can only accept traffic on port 443, so IPFW blocks the traffic as its destination is some high port. I am hoping you understood the explanation, if not I can post some IPFW log traffic to show what is happening.
If you miraculously understood my explanation, do you happen to know how I might fix this issue so that things work correctly?
1. I am using multiple jails behind a HTTP proxy to accept traffic and send it to the correct jail.
2. I am using IPFW kernel NAT which is working fine - (https://forums.freebsd.org/threads/nat-and-ipfw-cannot-get-it-to-work.53553/#post-302532)
3. The proxy and the jails share the same public IP.
4. All jails have an IP on the 10.0.0.0/16 subnet using a cloned loopback (lo1)
Everything is working fine except for one issue:
The proxy (nginx) receives traffic for jail1.example.com but jail1.example.com is configured to proxy_pass the traffic to jail2.example.com for this particular url. Nginx (on jail1.example.com) resolves the IP of jail2.example.com (which is the public IP of the proxy and jails) and sends the traffic over to jail2.example.com correctly. The traffic leaves jail1.example.com for jail2.example.com and is intercepted by FreeBSD. This is where is goes bad, FreeBSD sees the traffic as a response to the initial incoming traffic to jail1.example.com instead of new traffic from jail1.example.com to jail2.example.com, so it sends the traffic to jail2.example.com on the same high port it come into jail1.example.com. jail2.example.com can only accept traffic on port 443, so IPFW blocks the traffic as its destination is some high port. I am hoping you understood the explanation, if not I can post some IPFW log traffic to show what is happening.
If you miraculously understood my explanation, do you happen to know how I might fix this issue so that things work correctly?