1. 主页
  2. 文档
  3. 解码器系列设备 HTTP API
  4. 6. network网络模块

6. network网络模块

获取网络状态信息

API说明

获取设备网络配置状态信息

Request

  • Method: GET/POST
  • URL: network/get.json
  • Headers:
  • 提交参数: 无

Response

  • Body
{``  "result": "ok",``  "data": [``    {``      "dns": "",``      "dynamic": "n",``      "enable": 1,``      "gw3": "",``      "mask3": "255.255.255.0",``      "ip2": "192.168.1.168",``      "device": "eth0",``      "ip3": "",``      "mask2": "255.255.255.0",``      "ip": "192.168.1.80",``      "mask": "255.255.255.0",``      "state": "down",``      "gw": "192.168.1.1",``      "mac": "64:E8:45:24:14:E4",``      "gw2": ""``    },``    {``      "dns": "",``      "dynamic": "n",``      "enable": 1,``      "gw3": "",``      "mask3": "255.255.255.0",``      "ip2": "192.168.4.168",``      "device": "eth1",``      "ip3": "",``      "mask2": "255.255.255.0",``      "ip": "192.168.4.27",``      "mask": "255.255.255.0",``      "state": "up",``      "gw": "192.168.4.1",``      "mac": "06:56:F3:57:BD:F4",``      "gw2": ""``    }``  ]``}

返回说明:

网络参数数组

字段 类型 说明
device 字符串 网络接口,取值:"eth0"或"eth1"
ip 字符串 ip地址
mask 字符串 子网掩码
mac 字符串 mac地址
gw 字符串 网关IP
dynamic 字符串 是否DHCP,"y"或者"dhcp"时工作在DHCP模式下,"static"为静态IP
dns 字符串 DNS服务器地址
ip2 字符串 ip地址2
mask2 字符串 子网掩码2
gw2 字符串 网关2IP
ip3 字符串 ip地址3
mask3 字符串 子网掩码3
gw3 字符串 网关3IP
enable 数值 状态 1表示启用 0表示禁用

测试接口:

http://192.168.2.123/api/network/get.json

配置网络接口参数

API说明

修改网络配置

Request

  • Method: GET/POST
  • URL: network/modify.json
  • Headers:
  • 提交参数:
字段 类型 说明
device 字符串 网络接口,取值:"eth0"或"eth1"
ip 字符串 ip地址
mask 字符串 子网掩码
mac 字符串 mac地址
gw 字符串 网关IP
dynamic 字符串 是否DHCP,"y"或者"dhcp"时工作在DHCP模式下,"static"为静态IP
dns 字符串 DNS服务器地址
ip2 字符串 ip地址2
mask2 字符串 子网掩码2
gw2 字符串 网关2IP
ip3 字符串 ip地址3
mask3 字符串 子网掩码3
gw3 字符串 网关3 IP地址

Response

  • Body
{``  "result":"ok"``}

测试接口:

http://192.168.2.123/api/network/modify.json?device=eth1&ip=192.168.2.123&gw=192.168.2.1&mask=255.255.255.0&dns=8.8.8.8&dynamic=n&mac=62:87:55:E1:A3:2B

我们要如何帮助您?