radtest / radclient Builder
Build the exact radtest and radclient commands to test RADIUS authentication, accounting and CoA against a server, with the right auth type and port.
Result
radtest testuser 'testpass' 127.0.0.1:1812 0 testing123echo "User-Name = "testuser", Acct-Status-Type = Start, Acct-Session-Id = "nv-1ksew48", NAS-Port = 0, NAS-Port-Type = Ethernet, Service-Type = Framed-User, Framed-Protocol = PPP, Framed-IP-Address = 10.64.0.100" | \
radclient -x 127.0.0.1:1813 acct testing123echo "User-Name = \"testuser\", Acct-Status-Type = Stop, Acct-Session-Id = \"nv-1ksew48\", Acct-Session-Time = 3600, Acct-Input-Octets = 12345678, Acct-Output-Octets = 87654321" | \
radclient -x 127.0.0.1:1813 acct testing123# Run the server in the foreground with full debug
radiusd -X
# or, on Debian/Ubuntu packages
freeradius -X
# Watch the raw packets
tcpdump -ni any -vv port 1812 or port 1813About radtest / radclient Builder
radtest is the fastest way to prove whether a RADIUS problem is the server, the NAS or the credentials. This builds the command with the correct ports, auth type and attribute syntax, plus the accounting and debugging commands you will want next.
Reading the response
Access-Accept means the credentials and policy are fine - if the NAS still rejects the user, the problem is between NAS and server, not in the user record. Access-Reject means the server made a decision: run radiusd -X and read the policy trace. No response at all means UDP is not arriving, or the client is not defined in clients.conf - a server drops packets from unknown clients silently, by design.
Auth types and what they need
PAP requires the server to hold or be able to derive the cleartext password. CHAP and MS-CHAPv2 require cleartext or NT-hash storage respectively - you cannot serve MS-CHAPv2 from bcrypt or SHA hashes, no matter how the documentation is worded. Pick storage to match the protocols your NAS will use, not the other way round.
Common use cases
- Proving a new NAS shared secret before pointing a live BNG at it.
- Testing accounting start and stop while building a billing integration.
- Reproducing an authentication failure with a controlled request.
Edge cases and gotchas
- Ports 1812/1813 are the standard; 1645/1646 are the legacy Cisco pair still found in old configuration.
- A silent timeout almost always means the source IP is not listed in clients.conf on the server.
- The password appears in your shell history - clear it or use a leading space if the shell is configured to skip those.