如何将 pfSense 上的端口 80 和 443 转发到(内部)nginx 网络服务器?

网络工程 防火墙 感知 转发端口 网关
2022-02-16 15:29:51

昨天我们在我们公司做了一个“大爆炸”防火墙切换。我们的新防火墙是 pfSense 服务器。假设我们的外部 ip 是84.1.1.1,pfSense 是192.168.1.1,我们的网络服务器 ip 是192.168.1.2


在我们进行“大切换”之后,pfSense 接口在https://84.1.1.1上响应,这不是我们想要为我们的 Web 服务器使用https://84.1.1.1(端口 443)的目的。出于这个原因,我将 pfSense 端口从 443 更改为 444,这“解决了”这个问题,因为端口 443 现在对其他服务“免费”。

我们根本不允许从我们的外部 IP 访问 pfSense 接口,但这是另一个离题的问题。


现在我想将端口44380以及将来更多)转发到我们网络中的服务器。为此,我首先想解释一下我是如何配置 WAN 连接的,因为我注意到了一些东西。

我尝试从WAN1(我们的 WAN)ping (使用 pfSense ping 诊断工具)到 Web 服务器。这不起作用,这意味着我的端口转发也根本无法工作。我认为 pfSense 尝试通过其网关解决此 ping 请求,因此我尝试设置网关,WAN1从这none一刻起,我可以 ping 网络服务器WAN1(通过 pfSense ping 诊断工具)。

问题:我需要为我们的网关设置网关WAN1吗?我想是的?如果是,我是否需要在某处对内部网络进行一些排除?就像额外的信息一样,也许它是必需的,我们有一个直接挂在 pfSense 上的静态 IP ......

pfSense 配置

WAN INTERFACE
    <wan>
        <if>igb0</if>
        <descr><![CDATA[WAN1]]></descr>
        <alias-address></alias-address>
        <alias-subnet>32</alias-subnet>
        <spoofmac></spoofmac>
        <enable></enable>
        <ipaddr>84.1.1.1</ipaddr>
        <subnet>30</subnet>
        <gateway>WAN1GW</gateway>
    </wan>

GATEWAY
    <gateways>
        <defaultgw4>WAN1GW</defaultgw4>
        <defaultgw6></defaultgw6>
        <gateway_item>
            <interface>wan</interface>
            <gateway>84.1.1.2</gateway>
            <name>WAN1GW</name>
            <weight>1</weight>
            <ipprotocol>inet</ipprotocol>
            <descr><![CDATA[WAN1 gateway]]></descr>
        </gateway_item>
    </gateways>

OUTBOUND NAT RULES
    <nat>
        <outbound>
            <mode>advanced</mode>
            <rule>
                <source>
                    <network>10.128.10.0/24</network>
                </source>
                <sourceport></sourceport>
                <descr><![CDATA[Auto created rule for ISAKMP - AXN_INTRA to WAN1]]></descr>
                <target></target>
                <targetip></targetip>
                <targetip_subnet></targetip_subnet>
                <interface>wan</interface>
                <poolopts></poolopts>
                <source_hash_key></source_hash_key>
                <staticnatport></staticnatport>
                <disabled></disabled>
                <destination>
                    <any></any>
                </destination>
                <dstport>500</dstport>
                <created>
                    <time>1589543460</time>
                    <username><![CDATA[Manual Outbound NAT Switch]]></username>
                </created>
                <updated>
                    <time>1591883208</time>
                    <username><![CDATA[admin@10.128.10.29 (Local Database)]]></username>
                </updated>
            </rule>
            <rule>
                <interface>wan</interface>
                <source>
                    <network>10.128.11.0/24</network>
                </source>
                <dstport>500</dstport>
                <target></target>
                <destination>
                    <any></any>
                </destination>
                <staticnatport></staticnatport>
                <descr><![CDATA[Auto created rule for ISAKMP - AXN_SRV to WAN1]]></descr>
                <created>
                    <time>1589888715</time>
                    <username><![CDATA[Manual Outbound NAT Switch]]></username>
                </created>
                <disabled></disabled>
            </rule>
            <rule>
                <source>
                    <network>10.128.20.0/24</network>
                </source>
                <sourceport></sourceport>
                <descr></descr>
                <target></target>
                <targetip></targetip>
                <targetip_subnet></targetip_subnet>
                <interface>wan</interface>
                <poolopts></poolopts>
                <source_hash_key></source_hash_key>
                <destination>
                    <any></any>
                </destination>
                <updated>
                    <time>1590582795</time>
                    <username><![CDATA[admin@10.128.10.30 (Local Database)]]></username>
                </updated>
                <created>
                    <time>1590582795</time>
                    <username><![CDATA[admin@10.128.10.30 (Local Database)]]></username>
                </created>
            </rule>
            <rule>
                <source>
                    <network>10.128.10.0/24</network>
                </source>
                <sourceport></sourceport>
                <descr></descr>
                <target></target>
                <targetip></targetip>
                <targetip_subnet></targetip_subnet>
                <interface>wan</interface>
                <poolopts></poolopts>
                <source_hash_key></source_hash_key>
                <destination>
                    <any></any>
                </destination>
                <updated>
                    <time>1591883222</time>
                    <username><![CDATA[admin@10.128.10.29 (Local Database)]]></username>
                </updated>
                <created>
                    <time>1591883222</time>
                    <username><![CDATA[admin@10.128.10.29 (Local Database)]]></username>
                </created>
            </rule>
            <rule>
                <source>
                    <network>10.128.12.0/24</network>
                </source>
                <sourceport></sourceport>
                <descr><![CDATA[Default NAT rule for axn_cloud]]></descr>
                <target></target>
                <targetip></targetip>
                <targetip_subnet></targetip_subnet>
                <interface>wan</interface>
                <poolopts></poolopts>
                <source_hash_key></source_hash_key>
                <destination>
                    <any></any>
                </destination>
                <created>
                    <time>1589896652</time>
                    <username><![CDATA[admin@10.128.10.30 (Local Database)]]></username>
                </created>
                <updated>
                    <time>1590140198</time>
                    <username><![CDATA[admin@10.128.10.30 (Local Database)]]></username>
                </updated>
            </rule>
            <rule>
                <source>
                    <network>10.128.11.0/24</network>
                </source>
                <sourceport></sourceport>
                <descr><![CDATA[Default NAT rule for axn_srv]]></descr>
                <target></target>
                <targetip></targetip>
                <targetip_subnet></targetip_subnet>
                <interface>wan</interface>
                <poolopts></poolopts>
                <source_hash_key></source_hash_key>
                <destination>
                    <any></any>
                </destination>
                <created>
                    <time>1589888715</time>
                    <username><![CDATA[Manual Outbound NAT Switch]]></username>
                </created>
                <updated>
                    <time>1590140250</time>
                    <username><![CDATA[admin@10.128.10.30 (Local Database)]]></username>
                </updated>
            </rule>
        </outbound>
    </nat>

关于转发本身,我是这样配置的:

在此处输入图像描述 正如我在创建时设置的Filter rule association那样,pfSense 会自动在端口上创建相应/所需的防火墙规则。Add associated filter rulePort forwardWAN1

在此处输入图像描述

问题:我是否需要一些额外的配置来转发端口44380靠近我已经做过的配置?(端口转发并创建所需的防火墙规则)

1个回答

我在将证书分发给您的服务的不同服务器上运行相同的 nginx。首先,您需要配置 icmp echo reply,因为为了让 dns 提供商看到您需要该服务,我使用 cloudns,它们很好。其次,在 pfsense 上,您需要将 NAT 配置为工作,然后将 1:1 配置为允许在您的 pfsense 路由器上打开端口 80 和 443。我会在这里停下来了解更多信息,如果这样容易的话,我可以给你我设置的图片。还有更多的步骤来完成配置。