ndsctl是通过unix socket与nodogsplash之间通过socket来实现进程之间的通信。ndsctl的主要作用如下:
root@DayDream:/# ndsctl
Usage: ndsctl [options] command [arguments]
options:
-s <path> Path to the socket
-h Print usage
commands:
status View the status of nodogsplash
clients Display machine-readable client list
stop Stop the running nodogsplash
auth ip Authenticate user with specified ip
deauth mac|ip Deauthenticate user with specified mac or ip
block mac Block the given MAC address
unblock mac Unblock the given MAC address
allow mac Allow the given MAC address
unallow mac Unallow the given MAC address
trust mac Trust the given MAC address
untrust mac Untrust the given MAC address
loglevel n Set logging level to n
password pass Set gateway password
username name Set gateway username
命令详解:
1.ndsctl status
查看nodog当前的运行状态
root@DayDream:/# ndsctl status
==================
NoDogSplash Status
====
Version: 0.9_beta9.9.9
Uptime: 0d 0h 23m 21s
Gateway Name: NoDogSplash
Managed interface: br-lan
Managed IP range: 0.0.0.0/0
Server listening: 192.168.20.1:2050
Splashpage: /etc/nodogsplash/htdocs/splash.html
Redirect URL: http://www.csdn.net/
Traffic control: no
Total download: 7203 kByte; avg: 41.1314 kbit/s
Total upload: 533 kByte; avg: 3.04544 kbit/s
====
Client authentications since start: 3
Current clients: 1
Client 0
IP: 192.168.20.171 MAC: 38:bc:1a:10:bd:75
Added: Thu Jul 9 02:24:18 2015
Active: Thu Jul 9 02:28:27 2015
Active duration: 0d 0h 4m 9s
Added duration: 0d 0h 4m 28s
Token: 2ea483c0
State: Authenticated
Download: 874 kByte; avg: 26.1069 kbit/s
Upload: 105 kByte; avg: 3.15487 kbit/s
====
Blocked MAC addresses: none
Allowed MAC addresses: N/A
Trusted MAC addresses: none
========
可以看到当前连接该热点的主机数量是 1 个,IP为 192.168.20.171 MAC地址为:38:bc:1a:10:bd:75
Download: 874 kByte; avg: 26.1069 kbit/s
Upload: 105 kByte; avg: 3.15487 kbit/s
使用的流量情况 速度等。
2 ndsctl clients
查看所有已连接设备的情况
root@DayDream:/# ndsctl clients
1
client_id=0
ip=192.168.20.171
mac=38:bc:1a:10:bd:75
added=1436408658
active=1436409168
duration=510
token=2ea483c0
state=Authenticated
downloaded=2026
avg_down_speed=31.7866
uploaded=366
avg_up_speed=5.75354
3 ndsctl stop
停止运行
4 ndsctl auth ip
放行某个IP地址,即认证通过
root@DayDream:/# ndsctl auth 192.168.20.171
Client 192.168.20.171 authenticated.
5 ndsctl deauth mac|ip
强制禁止某个IP或者MAC。
root@DayDream:/# ndsctl deauth 192.168.20.171
Client 192.168.20.171 deauthenticated.
6 ndsctl block MAC
阻止某个 MAC地址的主机访问网络
root@DayDream:/# ndsctl block 38:bc:1a:10:bd:75
MAC 38:bc:1a:10:bd:75 blocked.
7 ndsctl unblock MAC
运行某个 MAC 地址的主机访问网络
root@DayDream:/# ndsctl unblock 38:bc:1a:10:bd:75
MAC 38:bc:1a:10:bd:75 unblocked.