相关项目
https://code.google.com/archive/p/mentohust/
https://github.com/hyrathb/mentohust
https://github.com/updateing/minieap
https://github.com/bitdust/njit8021xclient
https://github.com/KyleRicardo/MentoHUST-OpenWrt-ipk
https://github.com/viseator/mentohust_for_ar71xx

openwrt上使用锐捷认证共享上网方法
http://www.openwrt.org.cn/bbs/forum.php?mod=viewthread&tid=2612&extra=&page=1

借助路由器完成锐捷认证
https://sspai.com/post/41777

LEDE/Openwrt 固件支持校园网锐捷认证 Mentohust
https://www.right.com.cn/forum/forum.php?mod=viewthread&tid=257138&page=1#pid2158973

1. 刷 OpenWRT 固件

2. 安装 MentoHUST

路由器先连上网络,在线安装 libpcap

  1. opkg install libpcap

寻找对应平台的 mentohust.ipk 文件编译好的二进制文件 ,安装完成后,在终端输入 mentohust -h 测试是否安装正常

  1. 欢迎使用MentoHUST 版本: 0.3.1
  2. Copyright (C) 2009-2010 HustMoon Studio
  3. 人到华中大,有甜亦有辣。明德厚学地,求是创新家。
  4. Bug report to http://code.google.com/p/mentohust/issues/list
  5. 用法: mentohust [-选项][参数] [-选项] [参数] [--长选项] [参数]
  6. 选项: --help -h 显示本帮助信息
  7. --kill -k -k(退出程序) 其他(重启程序)
  8. --write -w 保存参数到配置文件
  9. --username -u 用户名
  10. --password -p 密码
  11. --nic -n 网卡名
  12. --ip -i IP[默认本机IP]
  13. --mask -m 子网掩码[默认本机掩码]
  14. --gateway -g 网关[默认0.0.0.0]
  15. --dns -s DNS[默认0.0.0.0]
  16. --ping-host -o Ping主机[默认0.0.0.0,表示关闭该功能]
  17. --auth-timeout -t 认证超时(秒)[默认8]
  18. --heartbeat -e 心跳间隔(秒)[默认30]
  19. --wait-after-fail -r 失败等待(秒)[默认15]
  20. --max-fail -l 允许失败次数[0表示无限制,默认8]
  21. --eap-bcast-addr -a 组播地址: 0(标准) 1(锐捷) 2(赛尔) [默认0]
  22. --dhcp-type -d DHCP方式: 0(不使用) 1(二次认证) 2(认证后) 3(认证前) [默认0]
  23. --daemonize -b 是否后台运行: 0(否) 1(是,关闭输出) 2(是,保留输出) 3(是,输出到文件) [默认0]
  24. --fake-supplicant-version -v 客户端版本号[默认0.00表示兼容xrgsu]
  25. --template-file -f 自定义数据文件[默认不使用]
  26. --dhcp-script -c DHCP脚本[默认dhclient]
  27. --decode-config -q 显示SuConfig.dat的内容(如-q/path/SuConfig.dat)
  28. --service 要登陆到的服务名 [默认internet]
  29. 例如: mentohust -u username -p password -n eth0 -i 192.168.0.1 -m 255.255.255.0 -g 0.0.0.0 -s 0.0.0.0 -o 0.0.0.0 -t 8 -e 30 -r 15 -a 0 -d 1 -b 0 -v 4.10 -f default.mpf -c dhclient
  30. 注意:使用时请确保是以root权限运行!

在 Windows 的锐捷安装目录下,找到 8021x.exeSuConfig.datW32N55.dll 三个文件,将其上传到 OpenWRT 的 /etc/mentohust 目录下
image.png

3. 测试 MentoHUST 的参数

路由器 WAN 口 连到 校园网端口 ,不断调整 mentohust 命令的参数,直到看到 认证成功 的 log

  1. mentohust -uusername -ppassword -neth1 -a1

输入 ifconfigip a 命令查看有没有获取到 ip

  1. eth1 Link encap:Ethernet HWaddr C8:0E:77:58:74:55
  2. inet addr:172.16.202.172 Bcast:172.16.203.255 Mask:255.255.254.0
  3. inet6 addr: fe80::ca0e:77ff:fe58:7455/64 Scope:Link
  4. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  5. RX packets:63081 errors:0 dropped:439 overruns:0 frame:0
  6. TX packets:12631 errors:0 dropped:0 overruns:0 carrier:0
  7. collisions:0 txqueuelen:1000
  8. RX bytes:14468684 (13.7 MiB) TX bytes:2263454 (2.1 MiB)
  9. Interrupt:4

如果没有获取到 ip,原因可能是 udhcpc 默认的网卡不是 路由器 WAN 口 对应的网卡,此时应该再开一个终端,手动获取 ip

  1. udhcpc -i eth1

4. 设置开机自动运行 MentoHUST

  1. vim /etc/init.d/mentohust
  1. #!/bin/sh /etc/rc.common
  2. START=99
  3. STOP=10
  4. start()
  5. {
  6. mentohust -uusername -ppassword -neth1 -a1 -b1 >/dev/null 2>&1
  7. udhcpc -i eth1
  8. }
  9. stop()
  10. {
  11. sync
  12. mentohust -k >/dev/null 2>&1
  13. }
  14. restart()
  15. {
  16. stop
  17. start
  18. }
  1. chmod +x /etc/init.d/mentohust
  2. /etc/init.d/mentohust enable

其他参考文档

openwrt+mentohust交叉编译
https://www.viseator.com/2017/09/05/mr12u_openwrt_mentohust/