# 前期准备

**总结:** 开启端口 `37015` (UDP) 和 `8081` (TCP)

请确保你已经按照 [基础教程安装了Northstars](/r2northstar-wiki/chinese/installing-northstar/basic-setup.md).

{% hint style="warning" %}
托管您自己的任何类型的服务器都需要计算机网络的基本知识！

例如:如果您不知道“端口转发”是什么意思，只想与朋友一起游玩；这边建议您找一个空的公共服务器，而不是尝试托管您自己的服务器。
{% endhint %}

## 检查您是否可以进行端口转发:

为了让其他人加入你的游戏，他们需要能够联系到你。最有可能的情况是，您的路由器充当NAT，因此您需要将两个端口转发到PC以进行 [NAT穿透](https://en.wikipedia.org/wiki/NAT_traversal).

## CGNAT

首先，我们需要确定您并不处于 [CGNAT](https://zh.wikipedia.org/wiki/%E7%94%B5%E4%BF%A1%E7%BA%A7NAT) 之中，这意味着 [您无法进行端口转发](https://zh.wikipedia.org/wiki/%E7%94%B5%E4%BF%A1%E7%BA%A7NAT#%E7%BC%BA%E7%82%B9).

通过 [这个网站](https://www.whatsmyip.org) 来查询您的公网地址。

然后，hen [打开CMD（命令控制台）](https://www.lifewire.com/how-to-open-command-prompt-2618089#toc-open-command-prompt-in-windows-10) ，并输入以下内容:

```
tracert <你的外网IP地址>
```

如果命令完成时只显示您的外网IP地址，您就可以接着下一步了。

如果显示了两个或更多的条目，你很可能处于 [CGNAT](https://zh.wikipedia.org/wiki/%E7%94%B5%E4%BF%A1%E7%BA%A7NAT) 之中。这种情况下，您唯一的选择是要求您的ISP（运营商）为您提供公网IP地址，或是检查您的IPv6地址是否为公开的。

## 端口转发

通过路由器的web界面进行访问，并转发端口

* `37015` (UDP) 用于游戏验证
* `8081` (TCP) 用于向主服务器提交验证，并在服务器列表中显示您的服务器

到您运行Northstar的电脑。

## 最后一步

为了检查您是否正确设置了所有内容，请通过Northstar开始游戏并进入私人比赛。另一位Northstar用户现在应该能够在服务器列表上看到您的服务器并加入它。\
您还可以使用基于网页的服务器列表，如国际服( [Taskinoz](https://taskinoz.com/northstar/) 或 [cpdt](https://cpdt.dev/northstar/) )/国服([小狼](https://www.wolf109909.top/tf2cnstats/))制作的网页来查看您的服务器是否显示在其中。

您还可以使用第三方站点（例如 [这个网站](https://www.ipfingerprints.com/portscan.php) ）来扫描您的服务器是否在Northstar服务端运行时执行了正确的端口转发。

请注意，在默认情况下，您的服务器名称为`Unnamed Northstar Server`。您可以按照下一页中的说明更改此名称


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://r2northstar.gitbook.io/r2northstar-wiki/chinese/hosting-a-server-with-northstar/prerequisites.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
