I have one public static IP address.
I have my main domain register at local Internet provider and their DNS.
My main router is pfSense and behind it i have my local network.
My WEB server is in local LAN and pfSense doing NAT (port redirect) WEB traffic to local server.
Now I need one more web server inside my LAN (on another local IP address) (etc mail server) and I need another domain or subdomain.
Can I register a new domain pointed to the same public IP address, and tell pfSense to do different redirecting of traffic according to domain? I am planing to use both domains under HTTP (80) port.
Is it possible to pFsense redirect to one local IP when request calling domain.com and to do different port forwarding when request on the same public IP adders calling subdomain.domain.com ?
If this is possible which one of Pfsense modules I should I install and configure, and how?
This can be done with the squid3 package. squid3 includes a Reverse Proxy server
Install the squid3 package...
After installation go to Services > Reverse Proxy
Under the General tab...
Under the Web Servers tab, add the (internal) IP of each of your servers
Under the Mappings tab, add the domain name for each of your servers
Finally, under Firewall > Rule, create rule to direct traffic to the reverse proxy server
This rule should be LAST if you have other rules configured forwarding from the outside in.
Any names you use must be registered to point to your external IP-- so if your domain name is example.com, in order to create subdomains in pfsense you will need to setup a record with your domain registrar point *.example.com.
I learned from this helpful tutorial: http://sdrv.ms/V8qLfK
You can't do this with NAT because NAT only cares about IP Addresses and Ports (Layer 3 + 4). The HTTP
Host
header is above that so NAT implementations are never aware of it.To achieve what you are looking for, you need a Reverse Proxy. (Apache, Squid, nginx, lighttpd etc). A reverse proxy is capable of examining the
Host
header in the HTTP request and forwarding the traffic to the appropriate server.This is possible! I've successfully done something very similar using squid reverse proxy. There are guides on setting it up, but it is pretty easy. Start by installing it via the pfsense package manager, then configure some servers and mappings.
How this works:
It basically starts a web server on port 80, or 443 if you use the https option. You can then define subdomains, like "web.mydomain.com" and "portal.mydomain.com", etc, and configure where they forward to on the internal network.
Then, it will parse the request url and pass it to the appropriate server. I am taking this one step further and running two https based services on one server, using different ports. service1.mydomain.com will connect to https:// server :8443, while service2.mydomain.com will connect to https:// server :8444
FYI, My subdomains on the domain registrar's dns all point to the same "external facing" WAN IP on the pfsense box.
Does this help?
You have to add dnsmasq package. Get details here:
http://hubpages.com/hub/Port-Forwarding-in-pfSense-How-to-Configure-NAT# http://east82.com/howto/dns_forwarding/configure_DNS_forwarding_pfsense.htm