accel-ppp关闭vpn连接

https://serverfault.com/questions/490021/how-to-disconnect-pptp-client

https://zhensheng.im/2017/08/15/3029/MIAO_LE_GE_MI

http://laibulai.iteye.com/blog/1498069

http://www.ttlsa.com/linux/pptpd-vpn-query-online-user/

ou can use accel-ppp, because it has a really powerful cli. And you can disconnect particular user without any problem.

# telnet 127.0.0.1 2000
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
Escape character is '^]'.
accel-ppp version c0b2b260b2c9b8c3375d51e90cd1edf552d7655a
Password: ******

The ip address 127.0.0.1 and port 2000 has been configured through main config file accel-ppp.conf

[cli]
telnet=127.0.0.1:2000
tcp=127.0.0.1:2001
password=1234567

To get current sessions you can use 'show sessions' command

accel-ppp# show sessions
 ifname | username |  calling-sid  |       ip       | type | comp | state  |  uptime
--------+----------+---------------+----------------+------+------+--------+----------
 ppp0   | alex     | 192.168.1.7   | 192.168.216.10 | pptp | mppe | active | 00:32:50
 ppp1   | john     | 192.168.1.100 | 192.168.216.11 | l2tp | mppe | active | 00:00:49

To terminate specific one you can use 'terminate' command

accel-ppp# terminate username john soft

accel-ppp# show sessions
 ifname | username | calling-sid |       ip       | type | comp | state  |  uptime
--------+----------+-------------+----------------+------+------+--------+----------
 ppp0   | alex     | 192.168.1.7 | 192.168.216.10 | pptp | mppe | active | 00:34:57

Terminate command has a lot of options

terminate if <interface> [soft|hard]- terminate session by interface name
        [match] username <username> [soft|hard]- terminate session by username
        ip <addresss> [soft|hard]- terminate session by ip address
        csid <id> [soft|hard]- terminate session by calling station id
        sid <id> [soft|hard]- terminate session by session id
        all [soft|hard]- terminate all sessions

In a log file /var/log/messages you will see

Mar 19 13:10:00 vpn accel-pppd: l2tp: new tunnel 59521-1 created following reception of SCCRQ from 192.168.1.100:1701
Mar 19 13:10:00 vpn accel-pppd: l2tp tunnel 59521-1 (192.168.1.100:1701): established at 192.168.1.6:1701
Mar 19 13:10:00 vpn accel-pppd: l2tp tunnel 59521-1 (192.168.1.100:1701): new session 898-1 created following reception of ICRQ
Mar 19 13:10:03 vpn accel-pppd: ppp1:john: connect: ppp1 <--> l2tp(192.168.1.100:1701 session 59521-1, 898-1)
Mar 19 13:10:03 vpn accel-pppd: ppp1:john: john: authentication succeeded
Mar 19 13:10:03 vpn accel-pppd: ppp1:john: IPV6CP: discarding packet
Mar 19 13:10:03 vpn accel-pppd: ppp1:john: session started over l2tp session 59521-1, 898-1
Mar 19 13:12:39 vpn accel-pppd: l2tp session 59521-1, 898-1: data channel closed, disconnecting session
Mar 19 13:12:39 vpn accel-pppd: l2tp tunnel 59521-1 (192.168.1.100:1701): no m
 

猜你喜欢

转载自blog.csdn.net/ypbsyy/article/details/82143045
ppp