📄 sql howto.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0036)http://wiki.freeradius.org/SQL_HOWTO -->
<HTML lang=en xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>SQL HOWTO - FreeRADIUS Wiki</TITLE>
<META http-equiv=Content-type content="text/html; charset=UTF-8">
<META
content="SQL HOWTO,Binary packages,Build,Cisco,NAS,Operators,RADIUS,Rlm sql,Rlm sqlcounter,Rlm sqlippool,SQL"
name=keywords><LINK href="/favicon.ico" rel="shortcut icon"><LINK
title="FreeRADIUS Wiki (English)" href="/opensearch_desc.php"
type=application/opensearchdescription+xml rel=search><LINK media=print
href="SQL HOWTO.files/wikiprintable.css" type=text/css rel=stylesheet>
<SCRIPT type=text/javascript> var skin = "cologneblue"; var stylepath = "/skins"; var wgArticlePath = "/$1"; var wgScriptPath = ""; var wgServer = "http://wiki.freeradius.org"; var wgCanonicalNamespace = ""; var wgNamespaceNumber = 0; var wgPageName = "SQL_HOWTO"; var wgTitle = "SQL HOWTO"; var wgArticleId = 2025; var wgIsArticle = true; var wgUserName = null; var wgUserLanguage = "en"; var wgContentLanguage = "en"; </SCRIPT>
<SCRIPT src="SQL HOWTO.files/wikibits.js" type=text/javascript></SCRIPT>
<STYLE type=text/css>@import url( /skins/common/cologneblue.css?2 );
@import url( /index.php?title=MediaWiki:Common.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000 );
@import url( /index.php?title=MediaWiki:Cologneblue.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000 );
A.new {
COLOR: #cc2200
}
#quickbar A.new {
COLOR: #cc2200
}
#quickbar {
LEFT: 4px; POSITION: absolute
}
#article {
MARGIN-LEFT: 148px; MARGIN-RIGHT: 4px
}
</STYLE>
<META content="MSHTML 6.00.2900.5659" name=GENERATOR></HEAD>
<BODY class="ns-0 ltr" bgColor=#ffffff onload="">
<DIV id=content>
<DIV id=topbar>
<TABLE cellSpacing=0 cellPadding=8 width="100%" border=0>
<TBODY>
<TR>
<TD class=top vAlign=center noWrap align=left><A
href="http://wiki.freeradius.org/Main_Page"><SPAN id=sitetitle>FreeRADIUS
Wiki</SPAN></A></TD>
<TD class=top vAlign=bottom align=right width="100%"><A title="Main Page"
href="http://wiki.freeradius.org/Main_Page">Main Page</A> | <A
title="FreeRADIUS Wiki:About"
href="http://wiki.freeradius.org/FreeRADIUS_Wiki:About">About</A> | <A
title=Help:Contents
href="http://wiki.freeradius.org/Help:Contents">Help</A> | <A
title="FreeRADIUS Wiki:FAQ"
href="http://wiki.freeradius.org/FreeRADIUS_Wiki:FAQ">FAQ</A> | <A
title=Special:Specialpages
href="http://wiki.freeradius.org/Special:Specialpages">Special pages</A> |
<A title=Special:Userlogin
href="http://wiki.freeradius.org/index.php?title=Special:Userlogin&returnto=SQL_HOWTO">Log
in</A></TD></TR>
<TR>
<TD vAlign=top><FONT size=-1><SPAN id=sitesub></SPAN></FONT></TD>
<TD align=right><FONT size=-1><SPAN id=langlinks><BR><A
href="http://wiki.freeradius.org/index.php?title=SQL_HOWTO&printable=yes">Printable
version</A> | <A title="FreeRADIUS Wiki:General disclaimer"
href="http://wiki.freeradius.org/FreeRADIUS_Wiki:General_disclaimer">Disclaimers</A>
| <A title="FreeRADIUS Wiki:Privacy policy"
href="http://wiki.freeradius.org/FreeRADIUS_Wiki:Privacy_policy">Privacy
policy</A></SPAN></FONT></TD></TR></TBODY></TABLE></DIV>
<DIV id=article>
<H1 class=pagetitle>SQL HOWTO</H1>
<P class=subtitle>From FreeRADIUS Wiki</P>
<P>FreeRADIUS Server works out of the box with a <A title="Rlm sql"
href="http://wiki.freeradius.org/Rlm_sql">large list of SQL servers</A>, but
unfortunately there are a number of configuration guides available on the
internet that are either for very old versions of FreeRADIUS Server, or are
wrong, or both. This guide is an attempt to correct some of the misinformation.
</P>
<P><BR></P>
<TABLE class=toc id=toc summary=Contents>
<TBODY>
<TR>
<TD>
<DIV id=toctitle>
<H2>Contents</H2></DIV>
<UL>
<LI class=toclevel-1><A
href="http://wiki.freeradius.org/SQL_HOWTO#System"><SPAN
class=tocnumber>1</SPAN> <SPAN class=toctext>System</SPAN></A>
<LI class=toclevel-1><A
href="http://wiki.freeradius.org/SQL_HOWTO#Before_You_Start"><SPAN
class=tocnumber>2</SPAN> <SPAN class=toctext>Before You Start</SPAN></A>
<LI class=toclevel-1><A
href="http://wiki.freeradius.org/SQL_HOWTO#Getting_Started"><SPAN
class=tocnumber>3</SPAN> <SPAN class=toctext>Getting Started</SPAN></A>
<LI class=toclevel-1><A
href="http://wiki.freeradius.org/SQL_HOWTO#Basic_Configuration"><SPAN
class=tocnumber>4</SPAN> <SPAN class=toctext>Basic
Configuration</SPAN></A>
<LI class=toclevel-1><A
href="http://wiki.freeradius.org/SQL_HOWTO#Setting_up_the_RADIUS_database"><SPAN
class=tocnumber>5</SPAN> <SPAN class=toctext>Setting up the RADIUS
database</SPAN></A>
<UL>
<LI class=toclevel-2><A
href="http://wiki.freeradius.org/SQL_HOWTO#Create_MySQL_Database"><SPAN
class=tocnumber>5.1</SPAN> <SPAN class=toctext>Create MySQL
Database</SPAN></A>
<LI class=toclevel-2><A
href="http://wiki.freeradius.org/SQL_HOWTO#Create_PostgreSQL_Database"><SPAN
class=tocnumber>5.2</SPAN> <SPAN class=toctext>Create PostgreSQL
Database</SPAN></A> </LI></UL>
<LI class=toclevel-1><A
href="http://wiki.freeradius.org/SQL_HOWTO#Configuring_FreeRadius_to_use_SQL"><SPAN
class=tocnumber>6</SPAN> <SPAN class=toctext>Configuring FreeRadius to
use SQL</SPAN></A>
<LI class=toclevel-1><A
href="http://wiki.freeradius.org/SQL_HOWTO#Populating_SQL"><SPAN
class=tocnumber>7</SPAN> <SPAN class=toctext>Populating SQL</SPAN></A>
<LI class=toclevel-1><A
href="http://wiki.freeradius.org/SQL_HOWTO#Test"><SPAN
class=tocnumber>8</SPAN> <SPAN class=toctext>Test</SPAN></A>
<LI class=toclevel-1><A
href="http://wiki.freeradius.org/SQL_HOWTO#Additional_Snippets"><SPAN
class=tocnumber>9</SPAN> <SPAN class=toctext>Additional
Snippets</SPAN></A>
<LI class=toclevel-1><A
href="http://wiki.freeradius.org/SQL_HOWTO#See_Also"><SPAN
class=tocnumber>10</SPAN> <SPAN class=toctext>See Also</SPAN></A>
</LI></UL></TD></TR></TBODY></TABLE>
<SCRIPT type=text/javascript> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </SCRIPT>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A
title="Edit section: System"
href="http://wiki.freeradius.org/index.php?title=SQL_HOWTO&action=edit&section=1">edit</A>]</DIV><A
name=System></A>
<H2>System</H2>
<P>These instructions are for FreeRADIUS Server version 1.1.7 and have been
tested on an openSUSE 10.2 installation. </P>
<P>Also, I tested this instructions on CentOS 5.0 and CentOS 5.1. CentOS 5.x
came with FreeRadius 1.1.3 and you'll need to install freeradius-mysql package
to use SQL function. (FR 1.1.7 or above is recommended) </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A
title="Edit section: Before You Start"
href="http://wiki.freeradius.org/index.php?title=SQL_HOWTO&action=edit&section=2">edit</A>]</DIV><A
name=Before_You_Start></A>
<H2>Before You Start</H2>
<P>Before starting with FreeRADIUS, please make sure your server is up and
configured on your network, that you have your <A title=SQL
href="http://wiki.freeradius.org/SQL">SQL</A> server of choice (MySQL,
Postgresql etc) installed and running, and that your <A title=NAS
href="http://wiki.freeradius.org/NAS">NAS</A> is configured to send <A
title=RADIUS href="http://wiki.freeradius.org/RADIUS">RADIUS</A> requests to
your RADIUS server. </P>
<P>We have some sample configs for <A title=Cisco
href="http://wiki.freeradius.org/Cisco">Cisco</A> <A title=NAS
href="http://wiki.freeradius.org/NAS">NAS</A> <A title=Cisco
href="http://wiki.freeradius.org/Cisco">available here</A>. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A
title="Edit section: Getting Started"
href="http://wiki.freeradius.org/index.php?title=SQL_HOWTO&action=edit&section=3">edit</A>]</DIV><A
name=Getting_Started></A>
<H2>Getting Started</H2>
<P>Firstly, you need to install FreeRADIUS Server on your system. As the
premiere open source RADIUS suite it is included as a <A
title="Standard package"
href="http://wiki.freeradius.org/Standard_package">standard package</A> with
numerous Operating Systems and has <A title="Binary packages"
href="http://wiki.freeradius.org/Binary_packages">binary packages</A> for many
others. Installation is most easily accomplished by installing a binary package
(rpm, deb), but if you have a less well known operating system you may need to
<A title=Build href="http://wiki.freeradius.org/Build">build</A> your own. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A
title="Edit section: Basic Configuration"
href="http://wiki.freeradius.org/index.php?title=SQL_HOWTO&action=edit&section=4">edit</A>]</DIV><A
name=Basic_Configuration></A>
<H2>Basic Configuration</H2>
<P>It's best to start with a simple config using the standard text files, if
only to test that FreeRADIUS is correctly installed and works. </P>
<UL>
<LI>Edit /etc/raddb/clients.conf and enter the details of your NAS unit(s).
There are examples here, so it should be easy. There should already be a
'localhost' NAS preconfigured here for testing purposes (i.e. so you can use
radtest). </LI></UL>
<UL>
<LI>Edit /etc/raddb/users and create an example user account. The file is
commented on how to do this. </LI></UL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -