如何从服务器端断开连接到 Cent OS 6.2 服务器的 pptp 客户端?ifdown ppp0 不起作用。
答案1
只需尝试以下任何一种方法。应该可以。这里的 #pid 是 pptp 服务的进程 ID。
`kill $pid` or `killall pppd`
或使用
# kill {pppd-PID}
答案2
你可以使用 accel-ppp,因为它有一个非常强大的 cli。而且你可以毫无问题地断开特定用户的连接。
# 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: ******
已通过主配置文件 accel-ppp.conf 配置了 ip 地址 127.0.0.1 和端口 2000
[cli]
telnet=127.0.0.1:2000
tcp=127.0.0.1:2001
password=1234567
要获取当前会话,您可以使用'显示会话' 命令
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
要终止特定的一个,你可以使用'终止' 命令
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 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
在日志文件 /var/log/messages 中你会看到
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 more session, disconnecting tunnel