为什么 NAT 会导致家庭网络上的服务器 运行 出现问题?

Why is NAT causing problems for server running on the home network?

NAT has enjoyed widespread deployment in recent years. But NAT is not without detractors. First, one might argue that, port numbers are meant to be used for addressing processes, not for addressing hosts. This violation can indeed cause problems for servers running on the home network, since, as we have seen in Chapter 2, server processes wait for incoming requests at well-known port numbers and peers in a P2P protocol need to accept incoming connections when acting as servers.

来自 Kurose & Ross,计算机网络:自上而下的方法, 第 7 名。第 375 页。

不知道大家对NAT了解多少,先简单介绍一下。

NAT,网络地址转换,源于IPV4地址的短缺,它像防火墙一样为家庭用户构建了一个安全的方式。

现在使用的NAT有四种,full cone NAT, restricted NAT, port restricted NAT, symmetric NAT,你可以google了解详情

让我们看看当我们在 NAT 路由器后面构建服务器时会发生什么。

  1. 如果不做NAT穿越,只有服务器先访问客户端,客户端才能访问服务器。

  2. 那如果你做NAT穿越。对于某些类型,它可以工作,但对于其他类型则不能。

  3. 更重要的是,如果你开门成功,那么所有clients/attackers都可以连接到服务器而不需要任何检查。所以你失去了NAT的安全保障,那你就需要自己搭建了。那么,为什么需要NAT呢?

总而言之,NAT对家庭网络中的服务器造成了很多问题,而且不需要。