# Setting up a server firewall

If your game server is protected by a firewall, you must consider the following for ProudNet to perform properly.

> * When the server is started (<mark style="color:orange;">Proud.CNetServer.Start</mark>), the UDP ports specified in <mark style="color:orange;">Proud.CStartServerParameter.m\_tcpPort</mark> (<mark style="color:orange;">Proud.CStartServerParameter.m\_udpPorts</mark>) must be open for both sending and receiving.
> * Unless absolutely necessary, you should disallow sending and receiving ICMP-type IP packets to avoid occasional network failures.

## Setting up a firewall against DDOS attacks

In ProudNet, when a client connects, the server first throws a random packet to the client before any UDP communication, and the client receives it and discards it.

Some server firewalls have the ability to send UDP packets to a client with internet address A first, and then allow A to send UDP packets to the server, but only for a certain amount of time. With this feature turned on, ProudNet can be used to set up a firewall that keeps UDP open but is still secure against DDOS attacks.

If your firewall is capable of this, you can run the server with only the <mark style="color:orange;">Proud.ServerUdpAssignMode\_PerClient</mark> and empty <mark style="color:orange;">Proud.CStartServerParameter.m\_udpPorts</mark> settings, which has the added benefit of minimizing the concurrent connections limit.

{% hint style="success" %}
**Reference**

[**How the server uses UDP port**](https://docs.proudnet.com/proudnet.eng/proudnet/usage_pn/tips#how-the-server-uses-udp-ports)
{% endhint %}

## Setting up an ICMP firewall

If you use <mark style="color:orange;">Proud.ServerUdpAssignMode.ServerUdpAssignMode\_Static</mark> in your server startup options, we recommend that you block receiving <mark style="color:orange;">ICMP host unreachable</mark> packets.

This is an example of how to set it up when using Windows Firewall.

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/nsFYGAGAMDYHo9FGQy4m/firewall1.png" alt=""><figcaption><p>Example of how to enable firewall</p></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/lNzqWYQeIbHZVwoL6bCf/firewall2.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/56tLPjs2lZlp2XPu0un0/firewall3.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/W4bfOhrpDbXD3rXZhOLz/firewall4.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/3a4oWkoIhlQwkoy8i4tc/firewall5.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/R7deqTfakzZ42WsV4IaU/firewall6.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/u6l3VUNhmSH99AMwR2Q7/firewall7.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/1nYMN6vgiODeEqppFnWU/firewall8.png" alt=""><figcaption></figcaption></figure>

From now on, just keep pressing the ‘Next’ button until ‘Finish’ appears.

{% hint style="success" %}
**Reference**

[**How the server uses UDP port**  ](https://docs.proudnet.com/proudnet.eng/proudnet/usage_pn/tips#how-the-server-uses-udp-ports)
{% endhint %}


---

# 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://docs.proudnet.com/proudnet.eng/proudnet-note/notes/setting_firewall.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.
