Pejman Moghadam / Slackware

Slackware 12.2 - PPPOE Server and FreeRADIUS Server

Public domain


FreeRADIUS Installation

cd /usr/src
wget -c ftp://ftp.freeradius.org/pub/radius/freeradius-1.1.7.tar.gz
tar zxf freeradius-1.1.7.tar.gz
cd freeradius-1.1.7
./configure --prefix=/usr/local/freeradius && make && make install
if ! grep -q freeradius /etc/ld.so.conf ; then
  echo "/usr/local/freeradius/lib" >> /etc/ld.so.conf
fi
ldconfig
ln -sfn /usr/local/freeradius/etc/raddb /etc/raddb
cp /usr/local/freeradius/etc/raddb/users{,.bak}
egrep -v '^#|^ *$' /usr/local/freeradius/etc/raddb/users.bak  > /usr/local/freeradius/etc/raddb/users
cp /usr/local/freeradius/etc/raddb/radiusd.conf{,.bak}
cd /usr/local/freeradius/etc/raddb/
sed -e 's,#.*,,' -e 's,^[ \t]*$,,' radiusd.conf.bak | egrep -v '^ *$' > radiusd.conf

/usr/local/freeradius/etc/raddb/users

pejman Password := "123456"
        Service-Type = Framed-User,
        Framed-Protocol = PPP,
#        Framed-IP-Address = 172.16.3.33,
#        Framed-IP-Netmask = 255.255.255.0,
#        Framed-Routing = Broadcast-Listen,
#        Framed-Filter-Id = "std.ppp",
#        Framed-MTU = 1500,
        Framed-Compression = Van-Jacobsen-TCP-IP
DEFAULT Auth-Type = System
        Fall-Through = 1
DEFAULT Service-Type == Framed-User
        Framed-IP-Address = 255.255.255.254,
        Framed-MTU = 576,
        Service-Type = Framed-User,
        Fall-Through = Yes
DEFAULT Framed-Protocol == PPP
        Framed-Protocol = PPP,
        Framed-Compression = Van-Jacobson-TCP-IP
DEFAULT Hint == "CSLIP"
        Framed-Protocol = SLIP,
        Framed-Compression = Van-Jacobson-TCP-IP
DEFAULT Hint == "SLIP"
        Framed-Protocol = SLIP

/etc/rc.d/rc.radiusd

#!/bin/sh
#
# /etc/rc.d/rc.radiusd
#

case "$1" in
  'start')
    echo 'Starting radiusd ...'
    PID=$(pgrep '^radiusd$')
    if [ "$PID" == "" ] ; then
      /usr/local/freeradius/sbin/radiusd
    else
      echo 'radiusd is already running !!!'
    fi
    ;;
  'stop')
    echo 'Stoping radiusd ...'
    killall radiusd
    ;;
  'restart')
    echo 'Restarting radiusd ...'
    killall radiusd
    sleep 2
    /usr/local/freeradius/sbin/radiusd $2
    ;;
  'debug')
    echo 'Debuging radiusd ...'
    PID=$(pgrep '^radiusd$')
    if [ "$PID" == "" ] ; then
      /usr/local/freeradius/sbin/radiusd
    else
      echo 'radiusd is already running !!!'
    fi
    ;;
  *)
    echo "Usage: $0 [start|stop|restart|debug]"
    ;;
esac

/etc/radiusclient/dictionary

ATTRIBUTE       CHAP-Challenge          60      string
INCLUDE /etc/radiusclient/dictionary.microsoft

/etc/radiusclient/servers

localhost testing123

Commands

mv /etc/ppp/options{,.bak}
mv /etc/ppp/pppoe-server-options{,.bak}

/etc/ppp/options

lock

/etc/ppp/pppoe-server-options

require-chap
noipdefault
mru 1492
mtu 1492
lcp-max-configure 60
lcp-restart 2
lcp-echo-interval 30
lcp-echo-failure 4
idle 0
noipx
proxyarp
ms-dns 80.191.194.18
plugin radius.so
plugin radattr.so
#debug dump logfd 2 nodetach

/etc/ppp/pppoe.conf

LINUX_PLUGIN=/usr/lib/pppd/2.4.4/rp-pppoe.so

/etc/rc.d/rc.pppoe-server

#!/bin/bash
#
# /etc/rc.d/rc.pppoe-server
#

# Configuration
SRVNAME="Linux-PPPOE-Server"
MAXCON=250
LOCALIP=10.0.0.1
STARTIP=10.0.0.10
USRIF=eth1
HOSTNAME=$(hostname)

start ()
{
  modprobe pppoe
  ifconfig $USRIF up
  /usr/sbin/pppoe-server -k -I $USRIF -N $MAXCON -C $HOSTNAME -S $SRVNAME -L $LOCALIP -R $STARTIP
}

case "$1" in
  'start')
    echo 'Starting pppoe-server ...'
    PID=$(pgrep '^pppoe-server$')
    if [ "$PID" == "" ] ; then
      start
    else
      echo 'pppoe-server is already running !!!'
    fi
    ;;
  'stop')
    echo 'Stoping pppoe-server ...'
    killall pppoe-server
    ;;
  'restart')
    echo 'Restarting pppoe-server ...'
    killall pppoe-server
    sleep 2
    start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    ;;
esac

/etc/rc.d/rc.local

# Start FreeRADIUS server:
if [ -x /etc/rc.d/rc.radiusd ]; then
  /etc/rc.d/rc.radiusd start
fi

# Start PPPOE server:
if [ -x /etc/rc.d/rc.pppoe-server ]; then
  /etc/rc.d/rc.pppoe-server start
fi

/etc/rc.d/rc.local_shutdown

#!/bin/bash

# Stop PPPOE server:
if [ -x /etc/rc.d/rc.pppoe-server ]; then
  /etc/rc.d/rc.pppoe-server stop
fi

# Stop FreeRADIUS server:
if [ -x /etc/rc.d/rc.radiusd ]; then
  /etc/rc.d/rc.radiusd stop
fi

Commands

chmod +x /etc/rc.d/rc.local_shutdown
chmod +x /etc/rc.d/rc.radiusd
/etc/rc.d/rc.radiusd start
chmod +x /etc/rc.d/rc.pppoe-server
/etc/rc.d/rc.pppoe-server start
echo User-Name = "pejman", User-Password = "123456" | /usr/local/freeradius/bin/radclient 127.0.0.1 auth testing123
/usr/local/freeradius/bin/radtest pejman  123456 127.0.0.1 10 testing123


Old Stuff : PPPOE Server (Radius) - Slackware 12.0



Radius Client : /etc/radiusclient/servers

localhost testing123

Radius Client : /etc/radiusclient/radiusclient.conf

authserver      localhost
acctserver      localhost

Radius Client : /etc/radiusclient/dictionary

ATTRIBUTE       CHAP-Password           3       string
ATTRIBUTE       CHAP-Challenge          60      string

Backup

mv /etc/ppp/options{,.bak} 
mv /etc/ppp/pppoe-server-options{,.bak}

/etc/ppp/options

#syncmap 0
#crtscts
#lock
#modem

RP-PPPOE Server : /etc/ppp/pppoe.conf

LINUX_PLUGIN=/usr/lib/pppd/2.4.4/rp-pppoe.so

RP-PPPOE Server : /etc/ppp/pppoe-server-options

require-chap
noipdefault
mru 1492
mtu 1492
lcp-max-configure 60
lcp-restart 2
lcp-echo-interval 30
lcp-echo-failure 4
idle 0
noipx
proxyarp
ms-dns 4.2.2.4
plugin radius.so
plugin radattr.so
#debug dump logfd 2 nodetach

/etc/rc.d/rc.pppoe-server

 #!/bin/bash
 #
 # /etc/rc.d/rc.pppoe-server
 #
 # Start/stop/restart the RP-PPPOE server.
 #
 # To make pppoe-server start automatically at boot, make this
 # file executable:  chmod +x /etc/rc.d/rc.pppoe-server
 #

 # Configuration
 SRVNAME="RH-WR"
 MAXCON=250
 LOCALIP=10.0.0.1
 STARTIP=10.0.0.10
 EXTIF=eth0
 USRIF=eth1
 HOSTNAME=$(hostname)

 start ()
 {
   modprobe pppoe
   ifconfig $USRIF 0.0.0.0 up
   /usr/sbin/pppoe-server -k -I $USRIF -N $MAXCON -C $HOSTNAME -S $SRVNAME -L $LOCALIP -R $STARTIP
 }

 case "$1" in
  'start')
    echo 'Starting pppoe-server ...'
    PID=$(pgrep '^pppoe-server$')
    if [ "$PID" == "" ] ; then
      start
    else
      echo 'pppoe-server is already running !!!'
    fi
    ;;
  'stop')
    echo 'Stoping pppoe-server ...'
    killall pppoe-server
    ;;
  'restart')
    echo 'Restarting pppoe-server ...'
    killall pppoe-server
    sleep 2
    start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    ;;
 esac

/etc/rc.d/rc.local

# Start pppoe-server :
if [ -x /etc/rc.d/rc.pppoe-server ]; then
  /etc/rc.d/rc.pppoe-server start
fi

/etc/rc.d/rc.local_shutdown

# Stop pppoe-server :
if [ -x /etc/rc.d/rc.pppoe-server ]; then
  /etc/rc.d/rc.pppoe-server stop
 fi

Startup

chmod +x  /etc/rc.d/rc.local_shutdown
chmod +x  /etc/rc.d/rc.pppoe-server
/etc/rc.d/rc.pppoe-server start

BY: Pejman Moghadam
TAG: freeradius, pppoe-server, radiusclient, radius
DATE: 2009-09-13 10:50:20


Pejman Moghadam / Slackware [ TXT ]