Skip to content

ROS接入教程

对接前请保证您的 ROS 版本在 7.0 以上

对 RouterOS 的接入支持为 Web 和 PPPoE 认证,具体如下:

微云间设备设置

一、登录微云间管理平台,进入 场地管理

20250414182749

二、在对应场地点击新增设备,在厂商处下拉选择ROS

企业微信截图_8b75399f-c06d-4a4c-9b07-60a6befabb7d

三、添加设备后,在该设备后方操作处,选择配置

企业微信截图_8794e2e1-3c62-4ff9-bfad-8e062e5832fa

四、在厂商设置处,填写对应路由所需的路由账户路由密码后,点击保存即可

企业微信截图_0fd084b1-8ff7-44ea-b545-c27eeeb3cee3

准备工作

请通过 https://mikrotik.com/download 下载最新的 Winbox,并且通过 Winbox 登录您的路由。

登录后,请在左侧导航栏中找到 New Terminal,点击进入命令行,然后将根据需要,将下面配置中的替换部分替换完成后,右击命令行窗口,点击 Paste 粘贴进命令行执行即可。

参数填写内容
NAS标识符在场地下新增设备后,下属设备列表中,复制标识符并替换
NAS鉴权私钥在下属设备列表找到对应设备,在操作中进入配置,复制鉴权私钥并替换
开启计费的接口名在ROS本地管理软件Winbox中,左侧导航找到Interfaces,进入找到对应接口,复制Name并替换(一般是应用到Web认证端专有的vlan接口上)

基础配置

此部分主要配置了时区、NAS标识符,是公共配置,请务必正确应用。

/system clock set time-zone-name=Asia/Shanghai
/system identity set name={NAS标识符}
/radius add address=118.25.171.18 service=ppp,hotspot secret=weiyunjian require-message-auth=no
/radius incoming set accept=yes

Web 认证配置

仅 Web 认证用户需要配置

此部分是 Web 认证场地需要配置的参数,主要配置了如下内容:

  • 虚拟网络隧道(用于Web认证远程鉴权)
  • 认证网络接口的主网段信息
  • 认证网段下的IP分配池
  • 认证网段下的DHCP配置
  • Web认证服务(Hotspot)的基础资料
  • Web认证白名单以及放行策略
  • 认证初始跳转弹窗复写
/ip/service/set www port=80 disabled=no address=
/interface l2tp-client add connect-to=111.229.252.151 disabled=no name=wyj_vpn use-ipsec=yes ipsec-secret=weiyunjian user={NAS标识符} password={NAS鉴权私钥}
/ip route add disabled=no distance=1 dst-address=10.0.2.0/24 gateway=wyj_vpn pref-src="" routing-table=main scope=30 suppress-hw-offload=no target-scope=10
/ip address add address=172.16.0.1/24 interface={开启计费的接口名} network=172.16.0.0
/ip pool add name=dhcp_webauth_pool ranges=172.16.0.2-172.16.0.254
/ip dhcp-server add address-pool=dhcp_webauth_pool interface={开启计费的接口名} name=dhcp_webauth
/ip dhcp-server network add address=172.16.0.0/24 dns-server=172.16.0.1 gateway=172.16.0.1
/ip hotspot profile add dns-name=172.16.0.1 hotspot-address=172.16.0.1 name=hsprof1 nas-port-type=ethernet use-radius=yes radius-accounting=yes radius-interim-update=15m
/ip hotspot add addresses-per-mac=unlimited disabled=no interface={开启计费的接口名} name=server1 profile=hsprof1
/ip firewall address-list
add address=45.113.40.0/22 list=wyj_whitelist
add address=103.52.196.0/22 list=wyj_whitelist
add address=106.8.0.0/13 list=wyj_whitelist
add address=110.75.0.0/16 list=wyj_whitelist
add address=110.76.0.0/17 list=wyj_whitelist
add address=119.42.224.0/19 list=wyj_whitelist
add address=203.209.224.0/19 list=wyj_whitelist
add address=118.25.171.18 list=wyj_whitelist
/ip hotspot walled-garden
add dst-host=*.alipay.com*
add dst-host=*alipayobjects.com*
add dst-host=*.weixin.qq.com
add dst-host=res.wx.qq.com
add dst-host=wechat.com
add dst-host=*.tenpay.com
add dst-host=*.gtimg.com
add dst-host=portal.ik.weiyunjian.com
add dst-host=image.ik.weiyunjian.com
add dst-host=api-portal.ik.weiyunjian.com
add dst-host=sentry.elemenx.com
add dst-host=stats.elemenx.com
add dst-host=updater.elemenx.com
add dst-host=res.servicewechat.com
add dst-host=launchwxacode.wxqcloud.qq.com.cn
add dst-host=*.jomodns.com
add dst-host=*.tdnsdl1.cn
add dst-host=*.tdnsstic1.cn
add dst-host=*.tdnsvod1.cn
/ip hotspot walled-garden ip
add action=accept disabled=no !dst-address dst-address-list=wyj_whitelist \
    !dst-port !protocol !src-address !src-address-list
/file/set hotspot/login.html contents="<!DOCTYPE html><html><head><title>Redirect...</title><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"></head><body><form name=\"redirect\" action=\"https://portal.ik.weiyunjian.com/v3/\$(identity)\" method=\"get\"><input type=\"hidden\" name=\"mac\" value=\"\$(mac)\"><input type=\"hidden\" name=\"ip\" value=\"\$(ip)\"><input type=\"hidden\" name=\"mobile\" value=\"\$(username)\"></form><script language=\"JavaScript\">document.redirect.submit();</script></body></html>"

PPPoE 认证配置

仅 PPPoE 认证用户需要配置 建议在添加后,进入微云间场地管理,在下属设备/对应设备的配置中,将 关闭密码锁 项打开,避免因为账号锁定问题,导致设备拨号失败。

此部分是 PPPoE 认证场地需要配置的参数,主要配置了如下内容:

  • 认证网段下的IP分配池
  • PPPoE认证服务的基础资料
/ip pool
add name=dhcp_pppoe_pool ranges=10.0.9.2-10.0.9.254
/ppp profile
add dns-server=10.0.9.1 local-address=10.0.9.1 name=PPPoE remote-address=dhcp_pppoe_pool
/interface pppoe-server server
add authentication=pap,chap default-profile=PPPoE disabled=no interface=bridge service-name=service1
/ppp aaa
set use-radius=yes