Pptp vpn service provided on linux uses chap authentication by default. This authentication method is simple. you only need to use the correct user name and password to connect to an account. you cannot limit the number, traffic, and speed of connections to an account. If you want to implement these restrictions, you can use freeradius certification. However, I personally feel that configuring freeradius is not a very tedious task. after a few hours of a night, I finally gave up... However, there is a simple method to limit the number of connections in the same account. The method provided here is changed from an English website. If you cannot find what you want in Chinese, you may find something new in English. The implementation method is simple. Create a file named auth-up under the/etc/ppp folder. Write the following content in it: Click to closeBASH CODE#!/bin/sh# get the username/ppp line number from the parameters REALDEVICE=$1 USER=$2# create the directory to keep pid files per user mkdir -p /var/run/pptpd-users# if there is a session already for this user, terminate the old one if [ -f /var/run/pptpd-users/$USER ]; then kill -HUP `cat /var/run/pptpd-users/$USER` fi# copy the pid file of current user to /var/run/pptpd-users cp "/var/run/$REALDEVICE.pid" /var/run/pptpd-users/$USER In this way, if an account is connected, it is recorded in the/var/run/pptpd-users directory. Once this account is logged on again, the old connection will be killed. Therefore, the subsequent connections have priority. |