Source address is always originate from gateway when using /29 subnetting public IP for hosts behind pfsense
-
I subscribe a fixed IP package from ISP. They assign me a range of public IP in
/29subnet.As example to describe my issue, I use
123.123.123.184/29subnet.They are 8 addresses in this subnet and their purpose:
IP Address Usage 123.123.123.184 Subnet address 123.123.123.185 Gateway 123.123.123.186 Public IP 123.123.123.187 Public IP 123.123.123.188 Public IP 123.123.123.189 Public IP 123.123.123.190 Public IP 123.123.123.191 Subnet broadcast address Besides the gateway
123.123.123.185, there are 5 usable public IP addresses.The pfSense documentation do mention how to use those public IP address either by
1:1 NATor set public IP as destination in forward rule. However, I am planning to assign these public IP to backend host directly.The ISP does not allow me to set the public IP address as static IP address in WAN connection. Instead, it shall authenticate via PPPoE service first, and it will return the gateway IP address:
123.123.123.185upon success authentication. Furthremore, pfSense doesn't allow us to add PPPoE interface as member in a bridge interface, so I am not able to use other public IP address in host directly.I activate another port
OPT1in pfSense node:- Set IPv4 static IP address to
OPT1:192.168.50.1/24. - Define a virtual IP for interface
OPT1with one public IP address123.123.123.190/29. - Add a
PASSrule in Firewall forOPT1interface for all traffics. - Add a
PASSrule in Firewall forWANinterface destine to123.123.123.184/29network for ingress traffic.
I then configure my other host with this IP address:
IP Address:
123.123.123.186
Subnet mask:255.255.255.248
Gateway:123.123.123.190This host can now send outbound and receive inbound requests in both directions. So far so good. This method sacrifice one public IP address, but I think it is better solution compare to
1:1 NAT.However, I notice the outbround traffic from the host are originated from gateway instead of it's own public IP address. This is what I try to send an outbound request:
$ curl -s http://ipecho.net/plain 123.123.123.185I expect the source of request should be
123.123.123.186.If I change the static IP address setting in
OPT1to DHCP (there is no DHCP server inOPT1network), both inbound and outbound still work as is. And I try$ curl -s http://ipecho.net/plain 123.123.123.186So surprise, the source of request is
123.123.123.186.I don't understand why it work but setting DHCP for the
OPT1without DHCP server answer the requests do take longer time to boot the pfSense machine. I am sure there are many DHCP lease requests send fromOPT1frequently.Is this a good way to use PPPoE based subnetting public address in hosts behind pfSense? And is there any way to avoid the DHCP setting in
OPT1interface? - Set IPv4 static IP address to