Setting up the netcup firewall in the SCP (with the stateless-UDP trick)
Set up the netcup firewall as network protection in front of the server: composable policy templates in the SCP – with the trick for stateless UDP (DNS & NTP).
Table of contents
netcup comes with a firewall in front of your server – in the Server Control Panel, before a packet even reaches the operating system. Built correctly, it’s a strong shield. But there’s a trick many people fail at: the netcup firewall is stateless for UDP. This tutorial shows you a clean, reusable firewall – and why DNS and NTP otherwise suddenly get stuck.
What are we building?
In the netcup SCP we build a network firewall from composable policy templates: a base template (that every server needs), one for SSH, and one for web (HTTP/HTTPS). You assign these building blocks to your server as needed – a web server gets base + SSH + web, a server without a website only base + SSH. By the end, everything inbound is blocked except what you deliberately allow.
A netcup-specific detail makes the difference: for UDP the firewall works statelessly – which is why services like DNS and NTP need their own inbound rule, otherwise they suddenly get stuck. Why that is and how the base template solves it is shown in step 2.
Network firewall ≠ host firewall
Prerequisites
- A netcup server, e.g. your first VPS.
- Your SCP credentials (customer number + SCP password from the netcup welcome email – different from your SSH login).
- Clarity about your SSH port: the default is
22, and it stays that way when hardening SSH. If you changed it elsewhere, use your real port – otherwise you lock yourself out when activating.
VPS 1000 G12
4 vCores · 8 GB RAM · 256 GB NVMe
from €10.36/month
The firewall is included in the SCP with every netcup server.
💶 5 € voucher for new netcup customers:
36nc17844976032
(new customers only, no domains)
Step by step
Step 1: Open Firewall Policies in the SCP
Log into the Server Control Panel and open the Firewall Policies menu item at the top. Here you create reusable rule sets (“policies”) – independent of the individual server. You only assign them later.
Step 2: Build the base template
Click Create firewall policy, give it the name Serverküche Base and, via Add
rule, create these four rules – all INBOUND and ACCEPT:
| Description | Protocol | Source port (Src) | Destination port (Dst) |
|---|---|---|---|
| DNS replies (stateless) | UDP | 53 | any |
| NTP replies (stateless) | UDP | 123 | any |
| ICMP (ping/PMTU) | ICMP | – | – |
| ICMPv6 (Neighbor Discovery) | ICMPv6 | – | – |

Two things that make the difference here:
- DNS/NTP via the
Src Port, not the destination port. Your server queries DNS/NTP (outbound); the reply comes back from port 53 or 123. Because UDP is stateless, you need this inbound rule – otherwise there’s no name resolution and no time synchronization, even though “everything else” seems to work. - Never forget ICMPv6. Without Neighbor Discovery, IPv6 breaks completely. ICMP (v4) on top is useful for ping and path MTU discovery. netcup’s default policy “Ping allow” does already cover ICMP – it’s deliberately in the base template again so your foundation stays complete even if you ever remove the netcup defaults.
As soon as one rule exists, netcup blocks the rest automatically
Does your server use DHCP?
iface … inet static) – then there’s
nothing to do here. netcup’s network does run a DHCP server, but because UDP is stateless,
the DHCP reply (source port 67) is discarded by the whitelist. If your server is
exceptionally configured via DHCP, add INBOUND · UDP · ACCEPT · Src 67 to the base
template (for DHCPv6 additionally Src 547) – otherwise it loses its IP at the next lease
renewal.Step 3: Small building blocks for SSH and web
Instead of one big rule monolith, you create atomic templates that you freely combine. Create two more policies following the same pattern:
Serverküche SSH– one rule: INBOUND, TCP, ACCEPT, destination port 22.Serverküche Web– two rules: INBOUND, TCP, ACCEPT, destination port 80 and 443.

The gain: the base rules appear only once, not duplicated in every policy. If a service is added later (e.g. a mail server or WireGuard), you build another small template for it and plug it in – without touching the existing ones.
Step 4: Assign templates to the server
Switch to Server → your server → “Firewall” tab and click Edit firewall policies.
Move the appropriate ones from Available firewall policies to Selected: for a web
server Serverküche Base + Serverküche SSH + Serverküche Web.

Confirm with Apply and then Save. Check that the “Firewall active” switch is turned on. The assigned rules now appear in the list – together with netcup’s default policies (more on those below).

Don't lock yourself out
Step 5: Ready-made templates for common services
Exactly following the pattern from step 3, here are ready-made templates for the most
common self-hosting services. Each is its own small template, all rules are INBOUND
and ACCEPT. Build only the ones you really need and plug them, as in step 4, into
Serverküche Base + Serverküche SSH.
For UDP services: destination port, not source port
Mail server (mailcow & co.)
| Description | Protocol | Source port (Src) | Destination port (Dst) |
|---|---|---|---|
| SMTP (mail acceptance from others) | TCP | – | 25 |
| Submission (STARTTLS) | TCP | – | 587 |
| Submission (implicit TLS) | TCP | – | 465 |
| IMAP (STARTTLS) | TCP | – | 143 |
| IMAPS | TCP | – | 993 |
| POP3 (STARTTLS) | TCP | – | 110 |
| POP3S | TCP | – | 995 |
| ManageSieve (filter rules) | TCP | – | 4190 |
Two things that additionally belong to a mail server:
- Web UI and certificates: mailcow needs
80/443for the web interface and the Let’s Encrypt retrieval – just assign theServerküche Webtemplate along with it. - Enable outbound SMTP: a mail server must be able to deliver on port 25 outbound. netcup blocks that with the default policy “netcup Mail block” – you have to remove it on the server (see “When things go wrong”). And without a correct PTR/reverse-DNS entry your mails land in spam.
WireGuard VPN
| Description | Protocol | Source port (Src) | Destination port (Dst) |
|---|---|---|---|
| WireGuard | UDP | – | 51820 |
51820 is the usual default – use the value from your ListenPort. Only this one inbound
rule is needed; the replies to the clients go out outbound.
OpenVPN
| Description | Protocol | Source port (Src) | Destination port (Dst) |
|---|---|---|---|
| OpenVPN (UDP, default) | UDP | – | 1194 |
| OpenVPN (TCP fallback) | TCP | – | 1194 |
The default is UDP 1194. The TCP rule only if you deliberately run OpenVPN over TCP
(some additionally put it on TCP 443 to get through restrictive foreign networks) –
otherwise leave it out.
Zabbix monitoring
Here it depends on the server’s role:
| Role | Description | Protocol | Destination port (Dst) |
|---|---|---|---|
| Monitored host (Zabbix agent) | passive checks from the server | TCP | 10050 |
| Zabbix server | trapper (active agents/proxies) | TCP | 10051 |
The Zabbix server additionally needs 80/443 for the web frontend (Serverküche Web). If
you run active checks, the agent connects outbound to the server on 10051 – for that,
no inbound rule is needed on the agent host.
Checkmk
| Role | Description | Protocol | Destination port (Dst) |
|---|---|---|---|
| Monitored host (agent) | agent controller, pull mode | TCP | 6556 |
| Checkmk server (optional) | agent receiver (push/registration) | TCP | 8000 |
| Checkmk server (optional) | Livestatus (distributed monitoring) | TCP | 6557 |
In the default pull mode, the Checkmk server fetches the data actively – so it connects
outbound to 6556 of the agents. Inbound, therefore, only the monitored host needs port
6556. The Checkmk server itself gets by with 80/443 (Serverküche Web); 8000 and
6557 only if you use push mode or distributed monitoring.
Coturn / TURN server (Nextcloud Talk, Matrix)
| Description | Protocol | Source port (Src) | Destination port (Dst) |
|---|---|---|---|
| STUN/TURN | TCP | – | 3478 |
| STUN/TURN | UDP | – | 3478 |
| STUN/TURN over TLS | TCP | – | 5349 |
| STUN/TURN over TLS | UDP | – | 5349 |
| Media relay (audio/video) | UDP | – | 49152–65535 |
The large UDP relay range is the default – the actual audio/video streams run over it. You
can narrow it in the coturn configuration (min-port/max-port) and then set the firewall
rule to the same, smaller range.
Your own DNS server (AdGuard Home, Pi-hole, Unbound)
| Description | Protocol | Source port (Src) | Destination port (Dst) |
|---|---|---|---|
| DNS queries | UDP | – | 53 |
| DNS queries (large replies/TCP) | TCP | – | 53 |
| DNS-over-TLS (DoT) | TCP | – | 853 |
Careful, this is exactly the opposite direction to the base template: there Src 53
allows the replies to your own DNS queries; here Dst 53 allows the queries of foreign
clients to your DNS server. Both exist side by side without problems.
No open resolver
53 “just quickly” for the whole
world.Remote database access (emergency only)
| Description | Protocol | Source port (Src) | Destination port (Dst) |
|---|---|---|---|
| PostgreSQL | TCP | – | 5432 |
| MySQL / MariaDB | TCP | – | 3306 |
Databases don't belong on the open internet
ssh -L 5432:localhost:5432 …). If you must open the port anyway, then only
with a source address restricted to your fixed admin IP in the netcup rule – never for
everyone.When things go wrong
After activating, name resolution stops working (apt update hangs, ping domain.de
fails, but ping 1.1.1.1 works). The DNS replies are being blocked. Check the rule in
the base template INBOUND UDP ACCEPT, Src port 53. Important: source port, not
destination port.
The clock drifts, or TLS certificates are rejected due to the wrong time. The NTP replies are missing. Add INBOUND UDP ACCEPT, Src port 123.
IPv6 no longer works (v4 does). The ICMPv6 rule is missing. Without Neighbor Discovery, the server can’t even find its neighbor (router) over IPv6.
After activating, you can no longer get in via SSH. The SSH rule is missing or names the wrong port. Via the VNC console (SCP → Display) you can still reach the server; correct the policy and save again. That’s exactly what the “keep a second session open” rule above helps against.
The server can’t send emails (outbound port 25 doesn’t work). That’s not an error in your policy, but netcup’s default policy “netcup Mail block” – it blocks outbound SMTP (ports 25/465/587) as spam protection. For real mail sending you have to disable this netcup template on the server.
The server initially runs normally and is suddenly offline after one or two weeks. If
the server uses DHCP, the lease renewal is blocked by the whitelist – the DHCP reply
comes from UDP source port 67, which no rule allows, and UDP is stateless. Add INBOUND · UDP · ACCEPT · Src 67 to the base template. Statically configured netcup VPS (the
default) aren’t affected.
Maintenance & backups
- Test access after every change. Firewall rules are the classic way to lock yourself out. Keep a second session open, check a new connection, only then finish.
- New services = new template. If you later need another port (game server, WireGuard VPN over UDP, database), create a small template of your own and assign it additionally. The existing building blocks stay untouched.
- Mind the order. netcup evaluates the rules top to bottom; the first matching rule wins. For pure ACCEPT rules that doesn’t matter – but as soon as you use your own DROP rules, watch the order relative to the ACCEPTs.
- Know netcup’s default policies. “netcup Mail block” (outbound SMTP on ports 25/465/587 blocked) and “netcup Ping allow” are predefined. Via Restore default policies you can, in an emergency, get back to a known, working baseline if you locked yourself out with your own rules – together with the VNC console, your second safety net.
Last updated: Jul 19, 2026
Send feedback: feedback@serverkueche.de
You might also like

netcup snapshots & the Server Control Panel (SCP)
Use the netcup Server Control Panel & snapshots properly: a safety net before risky changes – and why it's no substitute …

CrowdSec: modern, collaborative intrusion prevention
Set up CrowdSec with the Traefik bouncer: detect attacks from the access logs, block attackers with a 403 and benefit …

Hardening & optimizing Nextcloud: clear every warning (part 2)
Get your Nextcloud admin overview green: set up HSTS headers, email sending, enforced two-factor auth and brute-force …