Technical Anshu
Tutorials Blog
📡 Firewall Rules

FreeRADIUS Firewall Rules Keep UDP 1812 and 1813 on the LAN Only

A RADIUS server answers login questions for your whole network. Its two UDP ports deserve the same protection as the keys to the building: reachable by your own network devices, invisible to everyone else.

✍️ Technical Anshu🐧 Ubuntu Server📡 FreeRADIUS 3
🎥 Watch the full FreeRADIUS setup in the video, step by step

Most setup guides end at the words it works, and leave the authentication ports open to any address that can reach the server. This page finishes the job properly: restrict UDP 1812 and 1813 to your LAN with Ubuntu's firewall, then audit the router and the client list so the server stays exactly as private as a login system should be.

Terminal — ufw status for the RADIUS server
$ sudo ufw status Status: active To Action From -- ------ ---- 1812/udp ALLOW 192.168.1.0/24 1813/udp ALLOW 192.168.1.0/24 22/tcp ALLOW 192.168.1.0/24
👆 The correct shape: 1812 and 1813 open to the office LAN only, not to the world (panel recreated with the real ufw output layout; addresses are examples)
1

Why These Ports Must Stay on the LAN

FreeRADIUS listens on UDP 1812 (authentication) and 1813 (accounting). Those ports are an open door to your entire login system: anyone who can reach them can attempt logins, probe which usernames exist, and hammer the server. Inside your office LAN, the only things that should ever send packets to these ports are your registered switches, access points and VPN gateways.

There is no legitimate reason for the internet to talk to your RADIUS server directly. Remote sites and home workers reach it through the VPN or site-to-site tunnel — never through a port forward on the router.

2

Allow the LAN, Nothing Else

Using Ubuntu's built-in firewall, open both ports to your LAN range only:

  1. Authentication from the LAN: sudo ufw allow from 192.168.1.0/24 to any port 1812 proto udp
  2. Accounting from the LAN: sudo ufw allow from 192.168.1.0/24 to any port 1813 proto udp
  3. Apply and verify: sudo ufw enable then sudo ufw status

Replace 192.168.1.0/24 with your real office subnet. If your network kit lives on its own management VLAN, allow only that narrower range — the tighter the list of who can even ask, the better.

3

Check the Router Side Too

The server firewall is only half the audit. Also check these three places:

  1. Router port forwarding: confirm there is no forward of 1812 or 1813 to this server — an old test forward left behind is a classic find
  2. Cloud panels: if the server is a cloud VM used for a lab, its security group should restrict 1812/1813 to your office IP at most — and a RADIUS server for real office logins belongs on the office LAN, not the public cloud
  3. The client list: remember clients.conf is a second lock — keep entries to individual device IPs with individual secrets, never 0.0.0.0/0

Firewall rule plus strict client list plus a strong secret is three independent locks on the same door. An attacker has to defeat all of them; your users notice none of them.

🔴 Never expose UDP 1812 or 1813 to the internet. Not for a test, not for an hour, not "temporarily for one remote user". If a person or a branch office needs this server, give them a VPN — the RADIUS traffic rides inside it and the ports stay invisible to the world.

🎥 Watch the Full FreeRADIUS Setup Video

The complete setup on a real Ubuntu server — install, first client, first user and the live test, all shown step by step in the video.

▶️ Watch Full Video
❓ Common Questions (FAQ)

Why is exposing port 1812 to the internet so dangerous?

It gives the entire internet a login oracle for your network: unlimited password guesses against your user list, probes that reveal which usernames exist, and an old UDP protocol that was never designed to face hostile traffic. Attackers scan for open RADIUS ports specifically because a successful guess can mean WiFi or VPN access to the whole office.

My branch office needs this server. How do I connect it safely?

Build a site-to-site VPN between the branch router and the head office, and let the branch access points reach the server through the tunnel using their normal client entries. The RADIUS ports stay closed on every public interface, and the traffic is encrypted by the VPN on the way.

Should I also restrict who can SSH into the server?

Yes, as part of the same habit. The RADIUS server holds your shared secrets and user configuration, so its SSH port should also be limited to your admin machines or management network with ufw, exactly like the RADIUS ports are limited here. One small firewall policy protects the whole box.

This guide is based on the Technical Anshu FreeRADIUS video • Stuck on any step? Ask in the video comments — you will get an answer there 🙏