医疗资产方案一本通 >> 05 实施部署 >> 02 基站和定位器上线配置 >> 基站上线配置 >>

原理

    物联网设备LORA基站和IOTP服务器建立的是websoket通道,支持三种方式上线:DHCP的option 224零配置上线、DNS上线、手工静态配置,上线配置的思路和常规的AP一样

其中LORA基站支持wifi和3/4G回传所以手工静态配置有以下几种方式:

1、有线手工配置

2、wifi回传手工配置

3、3/4G回传手工配置

 

优先级:手工静态>Option 224>DNS上线

需注意:设备端配置后需要在IOTP上添加上设备的mac地址才能在IOTP上看到上线具体配置参考2 IOTP上添加物联网设备

 

websoket隧道建立原理:

如右图所示,物联网基站作为client与服务器server建立WebSocket连接,详细步骤如下:

1、Client向Server发起Websocket连接请求,此时物联网基站处于CONNECTING状态;

2、Server收到Client的连接请求后,向Client发送了Websocket连接回复;

3、Client收到Websocket的连接回复后,物联网基站就处于UNAUTHORIZED状态,Client向Server发起设备认证;

4、如果Server上未注册该物联网基站,则物联网基站会一直处于UNAUTHORIZED状态,如果Server上已经注册了该基站设备,则设备认证成功;

5、Client收到认证成功消息后,则说明物联网基站在物联网平台上成功上线,物联网上的连接状态变成SUCCESS状态;

 

配置上线

 

一、通过DHCP上线【设备零配置上线,推荐】

原理:

   通过DHCP给基站和定位器分配ip地址同时配置option 224字段,该字段用来告诉设备IOTP服务器的地址是多少,当设备获取到ip地址和option 224字段后就会和对应的IOTP建立websoket连接,从而实现设备零配置上线

案例:

   锐捷核心5750给基站分配DHCP,IOTP服务器地址为172.18.158.253配置如下:

SW3(config)#ip dhcp pool ap_ruijie

SW3(dhcp-config)# option 224 ip 172.18.158.253      --IOTP地址

SW3(dhcp-config)# network 172.18.158.0 255.255.255.0

SW3(dhcp-config)# dns-server 114.114.114.114

SW3(dhcp-config)# default-router 172.18.158.1

SW3(dhcp-config)# end

 

二、通过DNS上线

原理:

    设备默认就是通过dns上线,因为IOTP自带DNS功能所以只需将DHCP里面的DNS配置成IOTP的地址就可以了

案例:

   锐捷核心5750给基站分配DHCP,IOTP服务器地址为172.18.158.253配置如下:

SW3(config)#ip dhcp pool ap_ruijie

SW3(dhcp-config)# network 172.18.158.0 255.255.255.0

SW3(dhcp-config)# dns-server 172.18.158.253      --IOTP地址

SW3(dhcp-config)# default-router 172.18.158.1

SW3(dhcp-config)# end

 

三、通过手工配置上线

原理:

   某些场景或者环境限制比如没有DHCP服务器或者使用wifi和3/4G做上联这个时候就需要通过手工配置上线,其原理就是手工指定IOTP服务器从而建立隧道

 

1、有线回传手工配置

案例:

   网络种没有dhcp服务器需要手工配置lora基站,ip地址为172.18.158.9/24,IOTP服务器地址为172.18.158.253

1>手工指定服务器:

uci set lora.gateway_param.server_address=172.18.158.253   --配置lorawlan服务器地址

uci set lora.gateway_param.serv_port_up=1700                    --配置lorawlan管理上行端口,默认1700

uci set lora.gateway_param.serv_port_down=1700                --配置lorawlan管理下行端口

uci set lora.netmgr.enable=true    ---开启网管功能

uci set lora.netmgr.port=8083                                   --配置上线端口,默认8083                               

uci set lora.netmgr.ip=172.18.158.253           --配置服务器地址                     

uci commit    --保存配置

reboot  --重启生效

 

2>手工配置设备IP、掩码、网关:

uci set lora.netmode_param.zero_config=false    --关闭零配置上线

uci set network.wan.proto=static    ---wan口改成手工指定

uci set network.wan.ifname=br-lan   ---配置wan口使用的类型为有线lan口,支持3/4G和wifi

uci set network.wan.ipaddr=172.18.158.9

uci set network.wan.netmask=255.255.255.0

uci set network.wan.gateway=172.18.158.1

uci set lora.netmode_param.net_mode=br-lan   ---指定回传方式为有线lan口

uci commit   

reboot

 

3>还原为零配置上线:

方式一:直接恢复出厂输入fistboot 【推荐】

方式二:改为零配置上线

uci set lora.netmode_param.zero_config=true            

uci commit

reboot

 

2、WIFI回传手工配置

注意:

1)目前只支持2.4G

2)服务器配置一样,连接wifi的目的是获取到IP地址可以和服务器通讯支持wifi加密和非加密

3)  wifi只能做上联,不支持当成AP放wifi出来给其他用户使用

1>服务器配置:

uci set lora.gateway_param.server_address=172.18.158.253   --配置lorawlan服务器地址

uci set lora.gateway_param.serv_port_up=1700                    --配置lorawlan管理上行端口,默认1700

uci set lora.gateway_param.serv_port_down=1700                --配置lorawlan管理下行端口

uci set lora.netmgr.enable=true    ---开启网管功能

uci set lora.netmgr.port=8083                                   --配置上线端口,默认8083                               

uci set lora.netmgr.ip=172.18.158.253           --配置服务器地址                     

uci commit    --保存配置

reboot  --重启生效

 

2>连接WIFI配置:

情况一:wifi不加密

例:连接到wifi名称为test,不加密

uci set lora.netmode_param.zero_config=false    --固定配置

uci set network.wan.ifname=ath0    --固定配置

uci set network.wan.proto=dhcp    --固定配置

uci set wireless.@wifi-iface[0].mode=sta   --固定配置

uci set wireless.@wifi-iface[0].network=wan   --固定配置

uci set wireless.@wifi-iface[0].ssid=test           ---配置需要连接的2.4gwifi名称ssid为test

uci set wireless.@wifi-iface[0].encryption=none     --ssid不加密

uci set lora.netmode_param.net_mode=ath0   --固定配置

uci commit  --保存配置

wifi reload   --重启wifi模块后理解生效

 

情况二:wifi使用psk加密

例:连接到加密wificeshi  密码为:1234567890  加密类型wap2

uci set lora.netmode_param.zero_config=false

uci set network.wan.ifname=ath0

uci set network.wan.proto=dhcp

uci set wireless.@wifi-iface[0].mode=sta

uci set wireless.@wifi-iface[0].network=wan

uci set wireless.@wifi-iface[0].ssid=ceshi         ---配置需要连接的wifi名称ssid为ceshi               

uci set wireless.@wifi-iface[0].encryption=psk-mixed  -----配置上联的APwifi加密方式为wap2(none对应非加密、wep 对应WEP加密、psk-mixed对应WPA-PSK + WPA2-PSK)

uci set wireless.@wifi-iface[0].key=1234567890   ---配置wifi密码为1234567890

uci set lora.netmode_param.net_mode=ath0

uci commit 

wifi reload

 

3、3/4G回传手工配置

注意点:

1)电信/移动/联通三大运行商的3/4G卡我司都支持,其中电信3/4G配置的时候有点区别其他运行商3/4G模板配置一样

2)上行为3/4G卡其目的就是为了让设备可以和IOTP通讯

 

1>服务器配置

uci set lora.gateway_param.server_address=172.18.158.253   --配置lorawlan服务器地址

uci set lora.gateway_param.serv_port_up=1700                    --配置lorawlan管理上行端口,默认1700

uci set lora.gateway_param.serv_port_down=1700                --配置lorawlan管理下行端口

uci set lora.netmgr.enable=true    ---开启网管功能

uci set lora.netmgr.port=8083                                   --配置上线端口,默认8083                               

uci set lora.netmgr.ip=172.18.158.253           --配置服务器地址                     

uci commit    --保存配置

reboot  --重启生效

 

2>设备端3/4G配置

    3/4G配置比较简单模板比较固定不需要单独去配置手机号等信息,不同的运行商按照如下的模板一模一样刷配置即可,电信3/4G比较特殊配置模板不一样

移动3/4G卡配置:

uci set lora.netmode_param.zero_config=false    --固定配置

uci set network.wan=interface    --固定配置

uci set network.wan.ifname=ppp0     --固定配置

uci set network.wan.device=/dev/ttyUSB1    --固定配置

uci set network.wan.apn=cmwap      --固定配置,不同运行商不一样

uci set network.wan.service=umts     --移动3/4G固定配置,电信3G为evdo其余为 umts

uci set network.wan.dialnumber=*99#    --固定配置

uci set network.wan.proto=3g      --固定配置3/4G一样配置

uci set lora.netmode_param.net_mode=3g-wan      --固定配置,配置上联网络类型:有线:br-lan 3/4G:3g-wan Wifi:ath0

uci set wireless.@wifi-iface[0].network=lan      --固定配置

uci commit     --保存配置

reboot          --重启生效

 

联通3/4G卡配置:

uci set lora.netmode_param.zero_config=false

uci set network.wan=interface

uci set network.wan.ifname=ppp0

uci set network.wan.device=/dev/ttyUSB1

uci set network.wan.apn=3gnet      --联通3/4G固定配置,不同运行商不一样

uci set network.wan.service=umts   --移动3/4G固定配置,电信3G为evdo其余为 umts

uci set network.wan.dialnumber=*99#

uci set network.wan.proto=3g

uci set lora.netmode_param.net_mode=3g-wan

uci set wireless.@wifi-iface[0].network=lan

uci commit

reboot

 

电信3/4G卡配置

》》电信3G卡上网

uci set lora.netmode_param.zero_config=false

uci set network.wan=interface

uci set network.wan.ifname=ppp0

uci set network.wan.device=/dev/ttyUSB1

uci set network.wan.apn=ctnet   --联通3/4G固定配置,不同运行商不一样

uci set network.wan.service=evdo  --固定配置,电信3G为evdo其余为 umts

uci set network.wan.maxwait=0      --固定配置

uci set network.wan.username=CARD    --固定配置,电信特殊配置,一般不用改动

uci set network.wan.password=CARD     --固定配置,无需改动

uci set network.wan.proto=3g

uci set lora.netmode_param.net_mode=3g-wan

uci set wireless.@wifi-iface[0].network=lan

uci commit

relood

 

》》电信4G卡上网

uci set lora.netmode_param.zero_config=false

uci set network.wan=interface

uci set network.wan.ifname=ppp0

uci set network.wan.device=/dev/ttyUSB1

uci set network.wan.apn=ctnet

uci set network.wan.service=umts   --固定配置,电信3G为evdo其余为 umts

uci set network.wan.maxwait=0

uci set network.wan.username=CARD

uci set network.wan.password=CARD

uci set network.wan.proto=3g

uci set lora.netmode_param.net_mode=3g-wan

uci set wireless.@wifi-iface[0].network=lan

uci commit

relood