| Port | 11211 |
|---|---|
| Transport | TCP and UDP |
| Service | Memcached — Never expose; UDP used in amplification attacks |
| Category | Databases and caches |
| Range | registered (1024–49151) |
| Encrypted | No, plaintext |
| Exposure | Loopback or the host's own network only |
Port 11211 Memcached · TCP and UDP
Memcached: an in-memory cache with no authentication at all. Reachable from the internet it hands over whatever was cached (sessions, API responses), and its UDP listener was the amplifier behind the record 1.3 Tbps DDoS of 2018 (51,000× amplification).
What runs on port 11211
Memcached: an in-memory cache with no authentication at all. Reachable from the internet it hands over whatever was cached (sessions, API responses), and its UDP listener was the amplifier behind the record 1.3 Tbps DDoS of 2018 (51,000× amplification). Bind to localhost or a private address and disable UDP (-U 0), which is the default since 1.5.6.
Software that uses it: memcached · ElastiCache for Memcached · PHP/Django/Rails session stores
Should port 11211 be open?
Loopback or the host's own network only. The service should listen on 127.0.0.1 (or a Unix socket) and be reached by a reverse proxy or by the application on the same host. If it answers on a public address, that is a misconfiguration.
- echo stats | nc host 11211 from another machine should time out; if it answers, close it.
- OPTIONS="-l 127.0.0.1 -U 0" in /etc/sysconfig/memcached or /etc/memcached.conf.
Check port 11211
# on the host: is anything listening, and which process? ss -ltnp 'sport = :11211' ss -lunp 'sport = :11211' sudo lsof -i :11211 # from another machine: is it reachable? nc -zv host 11211 nmap -p 11211 host nc -zuv host 11211 sudo nmap -sU -p 11211 host curl -v telnet://host:11211 # raw TCP connect test, Ctrl-C to leave
A port that answers from the internet when it should not is the finding; nmap from a machine outside your network (or a VPS) is the honest test, because scans from inside the LAN pass the firewall you are trying to verify.
Allow or block port 11211
# ufw (Ubuntu/Debian)
sudo ufw allow from 10.0.0.0/8 to any port 11211 proto tcp
sudo ufw allow from 10.0.0.0/8 to any port 11211 proto udp
sudo ufw deny 11211/tcp
sudo ufw deny 11211/udp
# nftables
nft add rule inet filter input ip saddr 10.0.0.0/8 meta l4proto { tcp, udp } th dport 11211 accept
nft add rule inet filter input meta l4proto { tcp, udp } th dport 11211 drop
# iptables (legacy)
iptables -A INPUT -p tcp --dport 11211 -s 10.0.0.0/8 -j ACCEPT
iptables -A INPUT -p tcp --dport 11211 -j DROP
iptables -A INPUT -p udp --dport 11211 -s 10.0.0.0/8 -j ACCEPT
iptables -A INPUT -p udp --dport 11211 -j DROP
# firewalld
sudo firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=10.0.0.0/8 port port=11211 protocol=tcp accept' Replace 10.0.0.0/8 with the networks that need access. Allowing by source address is the rule that matters; "allow 11211" with no source is just "open".
Related ports
Part of the port number reference. Ports are 16-bit numbers; see also the subnet calculator and the packet decoder, which shows ports inside TCP and UDP headers.
Questions
Is port 11211 TCP or UDP?
Both. Memcached uses TCP and UDP on 11211: Never expose; UDP used in amplification attacks.
Is port 11211 encrypted?
No, plaintext. Anything sent over it can be read by whoever is on the path, so it belongs on a trusted network or inside a VPN or SSH tunnel.
How do I check whether port 11211 is open?
On the server, ss -ltnp (or -lunp for UDP) shows whether something listens on 11211 and which process. From another machine, nc -zv host 11211 or nmap -p 11211 host tests reachability. "Open" in a scan means something answered; a firewall usually makes the port filtered (no answer) rather than closed (RST).
Can Memcached run on a different port?
Yes; the number is a convention, not a requirement. Changing it reduces log noise from scanners but does not add security, and every client, firewall rule and monitoring check then needs the new number. Keep the default unless you have a concrete reason.