Appearance
FreeRADIUS Commands
FreeRADIUS is the authentication server that handles all PPPoE/Hotspot subscriber connections. These commands help you manage the RADIUS service.
🔴 HIGH RISK - CRITICAL SERVICE
FreeRADIUS is the core authentication service. Stopping or restarting it will:
- Disconnect ALL active subscribers immediately
- Prevent new connections until service is restored
- Cause billing/session tracking issues
Only restart during scheduled maintenance windows (e.g., 2-4 AM)
Table of Contents
Service Management
Check FreeRADIUS Status
bash
sudo systemctl status freeradiusPurpose: Shows if FreeRADIUS is running and recent activity.
Start FreeRADIUS
bash
sudo systemctl start freeradiusPurpose: Starts the FreeRADIUS service.
Stop FreeRADIUS
🔴 COMPLETE SERVICE OUTAGE
Stopping FreeRADIUS will immediately disconnect ALL subscribers and prevent any new connections.
bash
sudo systemctl stop freeradiusPurpose: Completely stops the RADIUS service.
When to use:
- Emergency troubleshooting
- Major configuration changes
- Server migration
Restart FreeRADIUS
🔴 SUBSCRIBER DISCONNECTION
Restarting will briefly disconnect all active sessions. New sessions will reconnect automatically.
bash
sudo systemctl restart freeradiusPurpose: Stops and starts FreeRADIUS. Required after configuration changes.
Best Practice:
- Schedule during low-usage hours (2-4 AM)
- Notify subscribers in advance if possible
- Have support ready for reconnection issues
Reload FreeRADIUS
bash
sudo systemctl reload freeradiusPurpose: Attempts graceful reload. Note: Not all config changes support reload.
Enable FreeRADIUS on Boot
bash
sudo systemctl enable freeradiusDebug Mode
Run FreeRADIUS in Debug Mode
🟠 STOP SERVICE FIRST
Debug mode requires stopping the main service. This will disconnect subscribers.
bash
# Stop the service first
sudo systemctl stop freeradius
# Run in debug mode (foreground)
sudo freeradius -XPurpose: Shows detailed authentication process. Essential for troubleshooting.
Press Ctrl+C to stop debug mode, then restart the service:
bash
sudo systemctl start freeradiusDebug with Specific Config
bash
sudo freeradius -X -d /etc/freeradius/3.0/Testing Authentication
Test User Authentication (radtest)
bash
radtest username password localhost 0 testing123Parameters:
username- Subscriber usernamepassword- Subscriber passwordlocalhost- RADIUS server (use actual IP for remote)0- NAS port (usually 0)testing123- RADIUS secret (check your config)
Example:
bash
radtest testuser testpass 127.0.0.1 0 your_radius_secretSuccess Response:
Received Access-Accept Id 123 from 127.0.0.1:1812 to 127.0.0.1:12345 length 20Failure Response:
Received Access-Reject Id 123 from 127.0.0.1:1812 to 127.0.0.1:12345 length 20Test with Attributes
bash
echo "User-Name=testuser,User-Password=testpass" | radclient -x localhost auth testing123Test Accounting
bash
echo "User-Name=testuser,Acct-Status-Type=Start" | radclient -x localhost acct testing123Log Management
View RADIUS Logs (Real-time)
bash
sudo tail -f /var/log/freeradius/radius.logView Detail Logs (Accounting)
bash
sudo tail -f /var/log/freeradius/radacct/*/detail-*Search for Specific User
bash
sudo grep "username" /var/log/freeradius/radius.logCheck Log File Sizes
bash
sudo du -sh /var/log/freeradius/*Clear Old Logs
🟠 CAUTION
This removes log history. Back up if needed for auditing.
bash
# Clear main log
sudo truncate -s 0 /var/log/freeradius/radius.log
# Remove old detail files (older than 30 days)
sudo find /var/log/freeradius/radacct -name "detail-*" -mtime +30 -deleteConfiguration
Configuration Directory
bash
ls -la /etc/freeradius/3.0/Main Configuration Files
bash
# Main config
sudo nano /etc/freeradius/3.0/radiusd.conf
# SQL module (database connection)
sudo nano /etc/freeradius/3.0/mods-available/sql
# Clients (NAS devices)
sudo nano /etc/freeradius/3.0/clients.conf
# Default site (authentication flow)
sudo nano /etc/freeradius/3.0/sites-available/defaultCheck SQL Module is Enabled
bash
ls -la /etc/freeradius/3.0/mods-enabled/ | grep sqlEnable SQL Module
bash
sudo ln -s /etc/freeradius/3.0/mods-available/sql /etc/freeradius/3.0/mods-enabled/Troubleshooting
Common Issues
Authentication Failing
bash
# Run in debug mode to see exact error
sudo systemctl stop freeradius
sudo freeradius -X
# Try to authenticate, watch outputDatabase Connection Issues
bash
# Test MySQL connection
mysql -u radius -p radius -e "SELECT 1"
# Check SQL config
sudo grep -A5 "server = " /etc/freeradius/3.0/mods-available/sqlNAS Not Connecting
bash
# Check clients.conf has correct NAS IP and secret
sudo grep -A5 "client" /etc/freeradius/3.0/clients.conf
# Check if NAS IP can reach RADIUS
sudo tcpdump -i any port 1812 or port 1813Port Already in Use
bash
# Check what's using RADIUS ports
sudo netstat -tlnp | grep -E "1812|1813"
sudo lsof -i :1812Check RADIUS Ports
bash
# Authentication port: 1812
# Accounting port: 1813
# CoA port: 3799
sudo netstat -tlnp | grep -E "1812|1813|3799"Test Database Connectivity
bash
# From RADIUS server
mysql -u radius -p -h localhost radius -e "SELECT COUNT(*) FROM radcheck;"Quick Reference Card
| Action | Command |
|---|---|
| Check status | sudo systemctl status freeradius |
| Start | sudo systemctl start freeradius |
| Stop | sudo systemctl stop freeradius |
| Restart | sudo systemctl restart freeradius |
| Debug mode | sudo freeradius -X |
| Test auth | radtest user pass localhost 0 secret |
| View logs | sudo tail -f /var/log/freeradius/radius.log |
| Config dir | /etc/freeradius/3.0/ |
