Well, in fact, 192.168.100.200 has pf and acts as a router, and it also has 192.168.100.1 as its gw.
Based upon your questions and answers so far, I do not believe this network structure which you intend to build gets you the behavior you intend. If I understand correctly, you want a structure that supports a modem that forwards all WAN traffic to an inside device which acts as a gateway and allows some network traffic (on specific ports) into and out of two interior devices: Web Server and maybe SQL Server? You didn’t specify the latter as reachable by the internet (I’d advise against this, but I’m leaving it open that you might).
However, in the structure you’ve created everything lives on the 192.168.100/24 subnet. Gateways move Layer 3 packets between subnets, not within a subnet. Usually, that interior gateway would be set up such that it and the modem share one subnetwork (192.168.100/24) and it would sit on another subnetwork (eg. 192.168.125/24) and forward and filter packets between them. However, you don’t have two isolated networks connected via a gateway, you have one unified network (192.168.100/24) and the “interior” devices aren’t really interior because you’ve placed them on the modem side of the gateway; they are reachable directly from the modem.
gpw928 is correct, you have two gateways on the 192.168.100/0 subnet.
I’m not enough of an expert to predict how this structure behaves, but I suspect your interior gateway won’t forward layer 3 packets back onto the network from which they originated. That is, when it is contacted by the Web Server (192.168.100.205) it won’t forward them to the modem (192.168.100.1) because they both live on the 192.168.100/24) subnet. I could be wrong about this.
Most importantly, you’ve gotten the network you intended to set up because you’re the one doing all the address assignments, but you didn’t get the network behavior you’ve intended because you set it up incorrectly for that purpose. This is why I said we might have an XY problem. You’re asking about how to do X, but you really want Y.
Your options are to (a) dig in and investigate why the gateway is or is not routing packets (tcpdump and pflog0 would help with this) or (b) reconfigure your network to the way other people do it and likely have a satisfactory result. I do believe you’ll learn something doing (a). Although I don’t know, I suspect you'll never get (a) working the way you want from a behavior perspective.
So, setup (b) and place the inside (jail) devices on a separate subnet (eg 192.168.125/24), create a bridge and attach one epair per jail to the bridge and also give the bridge an IP on that separate subnet. Then, your gateway can route packets between the two subnetworks (between the interface with the modem and the bridge interface).
You’ll have to take one more step and make it possible for internal addresses in 192.168.125/24 to be handled properly when entering the external network (192.168.100/24). If you don't, your modem won’t know what to do with them. At the moment, it only knows how to handle 192.168.100/24. You have two options.
- You can use NAT and RDR on the interior gateway:
Code:
rdr on $ext_if proto tcp from any to port 80 -> $web_server
nat log on $ext_if -> ($ext_if)
- If your modem has the feature, you can create a static route on it. I don’t know the exact method, but the static route would tell the modem that when it sees packets addressed to/from 192.168.125/24, the device at 192.168.100.200 knows how to handle them, so send them there.
#2 is better, if available, because it won’t double NAT your network. #1 will be double NAT and you also must have the redirect rule (RDR) to ensure outside ports make it through to the inside machines. If you leave the NATing up to the modem (with its static route), then there’s no address translation at the interior gateway and you don’t have to worry about synchronizing any modem side pinholes with the gateway pinholes.
I'm fairly certain I got all of that right, but others may correct me.