APN(专网卡配置流程)
# 如何区分专网卡
根据使用的网络类型来分,sim卡可以分为公网卡和专网卡两种
如何判断sim卡是公网卡还是专网卡,可按照如下顺序确认:
1. 咨询sim卡供应商
2. 如果apn有账号、或者有密码、或者有加密类型,则可以认为是专网卡
# API说明
```
function setAuthApn(prot,apn,user,pwd)
request('AT+CPNETAPN=2,"'..apn..'","'..user..'","'..pwd..'",'..prot)
end
```
参数
| 类型 | 说明 |
| ------ | ---------------------------------------- |
| number | prot,加密方式, 0:不加密 1:PAP 2:CHAP |
| string | apn,apn名称 |
| string | user,apn用户名 |
| string | pwd,apn密码 |
返回值
nil
实例
```
link.setAuthApn(2,"MYAPN","MYNAME","MYPASSWORD")
```
# 常见问题
1. 设置专网卡APN(注意:在main.lua中,尽可能靠前的位置调用此接口)
2. AT+CPNETAPN配置专网卡参数后,会重启协议栈,log如下:

3. 专网卡访问白名单
用定向Ip的物联网卡,需要把域名或IP加入白名单才能使用,下面列出模块会访问的域名或IP服务器。
DNS服务器,可以通过AT+CDNSCFG?查询默认的服务器,如果需要修改,可以通过AT+CDNSCFG=ip1,ip2进行修改。(V3035后续版本支持)
NTP时间同步,会在下面列出的服务器中随机选一下,可以根据需要修改。
| 功能| 地址| 端口 | 协议 |
| --- | --- | --- | --- |
| 远程升级| iot.openluat.com | 80 | http |
| 日志服务|dev_msg1.openluat.com| 12425| udp|
| 基站WIFI定位| bs.openluat.com | 12412和 12411| udp|
| AGPS星历下载| download.openluat.com | 80 | http |
| NTP时间同步| cn.pool.ntp.org | 123 | udp |
| NTP时间同步| edu.ntp.org.cn | 123 | udp |
| NTP时间同步| cn.ntp.org.cn| 123 | udp |
| NTP时间同步| s2c.time.edu.cn| 123 | udp |
| NTP时间同步| time1.aliyun.com | 123 | udp |
| NTP时间同步| tw.pool.ntp.org | 123 | udp |
| NTP时间同步| 0.cn.pool.ntp.org | 123 | udp |
| NTP时间同步| 0.tw.pool.ntp.org | 123 | udp |
| NTP时间同步| 1.cn.pool.ntp.org |123 | udp |
| NTP时间同步| 1.tw.pool.ntp.org | 123 | udp |
| NTP时间同步| 3.cn.pool.ntp.org | 123 | udp |
| NTP时间同步| 3.tw.pool.ntp.org| 123 | udp |