Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/administrator-manual/firewall/port_forward.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,42 @@ For each port forward the user can also configure the following aspects:
- **Access restriction**: Port forwards can be restricted to specific sources to enhance security. This can be done using the `Restrict access to` field. The field accepts IP addresses, CIDR blocks or an object. All objects are supported, except host sets containing IP ranges or nested objects.
- **Enabling logging**: port forwards can be configured to log incoming traffic for each rule. By enabling the `Log` option, the network administrator can keep track of the traffic passing through the port forward, allowing for monitoring and analysis. By default, logging is limited to 1 entry per second. To change this limit, refer to the [Logging limits](./firewall_rules.md#logging-limits) section.

## Port forwarding for an FTP server in passive mode {#port_forward_ftp-section}

When creating a port forward for TCP port `21` to publish an FTP server located inside the LAN, passive FTP connections may not work correctly with the default configuration.
Passive FTP uses additional dynamically negotiated ports for data connections: to allow NethSecurity 8 to identify these related connections and apply NAT correctly, the Netfilter FTP connection tracking helper must be enabled on the WAN zone.

### Configuration

#### 1. Load the FTP helper modules

From the **NAT helpers** page in the web interface, enable the following kernel modules:

```text
nf_conntrack_ftp
nf_nat_ftp
```

#### 2. Enable the FTP helper on the WAN zone

Connect to the firewall through SSH and run:

```bash
uci set firewall.ns_wan.auto_helper='0'
uci set firewall.ns_wan.helper='ftp'
uci commit firewall
reload_config
```

This configuration disables automatic helper assignment and explicitly enables the FTP helper on the `ns_wan` zone.

:::warning

If the firewall was migrated from NethServer 7, step 1 is not required because the FTP helper modules are already enabled by default for backward compatibility.
However, step 2 is still required: the FTP helper must be explicitly assigned to the `ns_wan` zone also on migrated systems.

:::

## Hairpin NAT {#hairpin-section}

Hairpin NAT, also known as NAT loopback or NAT reflection, is a technique used in networking where internal hosts access a server located within the same local network using the external IP address of the router or firewall. In other words, when internal devices attempt to connect to a server using the public IP address, hairpin NAT ensures that the traffic is routed internally without going out to the internet and then back into the local network.
Expand Down
2 changes: 1 addition & 1 deletion docs/administrator-manual/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ After the changes, devices use shorter names (e.g., `b0`, `b0.20`), compatible w
| DHCP servers and reservations | Migrated with limits | DHCP servers on bond interfaces are not supported. |
| DNS configuration and local hosts | Migrated with limits | TFTP options are migrated, but TFTP content is not. Configure `tftp_root` manually to re-enable it. |
| Static IPv4 routes | Migrated | |
| Port forwards | Migrated | |
| Port forwards | Migrated | If you use port forwarding for an FTP server, you must explicitly enable the FTP conntrack helper on the WAN zone. See [Port Forward](./firewall/port_forward.md) for details. |
| Firewall zones | Migrated | Green → `lan`, red → `wan`, orange → `dmz`, blue → `guest`. If a blue zone existed, DNS and DHCP accept rules are added automatically. |
| Firewall rules | Migrated with conversion | Rules using NDPI services are not supported. Source/destination objects are converted to IP/CIDR values. NAT helpers are loaded automatically. |
| Firewall objects | Not recreated | Objects cannot be reimported automatically. Rules that used objects are converted to the corresponding IP/CIDR values. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,44 @@ Per ogni port forward l'utente può anche configurare i seguenti aspetti:
- **Restrizione dell'accesso**: i port forward possono essere limitati a fonti specifiche per migliorare la sicurezza. Questo può essere fatto utilizzando il campo `Restrict access to`. Il campo accetta indirizzi IP, blocchi CIDR o un oggetto. Tutti gli oggetti sono supportati, ad eccezione dei set di host contenenti intervalli di IP o oggetti annidati.
- **Abilitazione della registrazione**: i port forward possono essere configurati per registrare il traffico in ingresso per ogni regola. Abilitando l'opzione `Log`, l'amministratore di rete può tenere traccia del traffico che passa attraverso il port forward, consentendo il monitoraggio e l'analisi. Per impostazione predefinita, la registrazione è limitata a 1 voce al secondo. Per modificare questo limite, fare riferimento alla sezione [Logging limits](./firewall_rules.md#logging-limits).

## Port forwarding per un server FTP in modalità passiva {#port_forward_ftp-section}

Quando si crea un port forward della porta TCP `21` per pubblicare un server FTP situato nella LAN, le connessioni FTP passive potrebbero non funzionare correttamente con la configurazione predefinita.

L'FTP passivo utilizza porte aggiuntive negoziate dinamicamente per le connessioni dati. Per consentire a NethSecurity 8 di identificare queste connessioni correlate e applicare correttamente il NAT, è necessario abilitare l'helper di connection tracking FTP di Netfilter sulla zona WAN.

### Configurazione

#### 1. Caricare i moduli helper FTP

Dalla pagina **NAT helpers** dell'interfaccia web, abilitare i seguenti moduli del kernel:

```text
nf_conntrack_ftp
nf_nat_ftp
```

#### 2. Abilitare l'helper FTP sulla zona WAN

Connettersi al firewall tramite SSH ed eseguire:

```bash
uci set firewall.ns_wan.auto_helper='0'
uci set firewall.ns_wan.helper='ftp'
uci commit firewall
reload_config
```

Questa configurazione disabilita l'assegnazione automatica degli helper e abilita esplicitamente l'helper FTP sulla zona `ns_wan`.

:::warning

Se il firewall è stato migrato da NethServer 7, il passaggio 1 non è necessario perché, per compatibilità con le versioni precedenti, i moduli helper FTP sono già abilitati per impostazione predefinita.
Il passaggio 2 rimane comunque necessario: anche sui sistemi migrati, l'helper FTP deve essere assegnato esplicitamente alla zona `ns_wan`.

:::


## Hairpin NAT {#hairpin-section}

Hairpin NAT, noto anche come NAT loopback o NAT reflection, è una tecnica utilizzata in rete in cui gli host interni accedono a un server situato all'interno della stessa rete locale utilizzando l'indirizzo IP esterno del router o del firewall. In altre parole, quando i dispositivi interni tentano di connettersi a un server utilizzando l'indirizzo IP pubblico, hairpin NAT garantisce che il traffico sia instradato internamente senza uscire da internet e poi rientrare nella rete locale.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Dopo le modifiche, i dispositivi usano nomi più corti (es. `b0`, `b0.20`), comp
| Server DHCP e prenotazioni | Migrata con limitazioni | I server DHCP su interfacce bond non sono supportati. |
| Configurazione DNS e host locali | Migrata con limitazioni | Le opzioni TFTP sono migrate, ma il contenuto TFTP no. Per riabilitarlo, configura `tftp_root` manualmente. |
| Rotte IPv4 statiche | Migrata | |
| Port forward | Migrata | |
| Port forward | Migrata | Se utilizzi il port forwarding per un server FTP, devi abilitare esplicitamente l’helper conntrack FTP sulla zona WAN. Consulta la sezione [Port Forward](./firewall/port_forward.md) per i dettagli.|
| Zone firewall | Migrata | Green → `lan`, red → `wan`, orange → `dmz`, blue → `guest`. Se esisteva una zona blue, le regole di accettazione DNS e DHCP vengono aggiunte automaticamente. |
| Regole firewall | Migrata con conversione | Le regole che usano servizi NDPI non sono supportate. Gli oggetti sorgente/destinazione vengono convertiti in valori IP/CIDR. |
| Oggetti firewall | Non ricreati | Gli oggetti non possono essere reimportati automaticamente. Le regole che usavano oggetti vengono convertite nei corrispondenti valori IP/CIDR. |
Expand Down