Contents
describe
- WAN interface
Interface version
Version number | Maker | Date of formulation | Revision date |
---|---|---|---|
1.0 | alan | 2022-07-26 |
POST request address
http://192.168.1.1/api
API List
Name | Description |
---|---|
set | Set WAN Internet access mode |
get | Get WAN configuration |
get_runtime | Get the real-time status of WAN |
1、set
wan is set to static Internet access parameters
{ "version": "1.0", "sid": "5bdd8aec153a8ff183387bfcea40e3aa", "module":"wan", "api":"set", "param": { "proto":"static", "static": { "ipv4addr": "192.168.18.100", "ipv4mask": "255.255.255.0", "ipv4gateway": "192.168.18.1", "ipv4dns1": "114.114.114.114" } }}
Wan set to dhcp Internet access parameters
{ "version": "1.0", "sid": "5bdd8aec153a8ff183387bfcea40e3aa", "module":"wan", "api":"set", "param": { "proto":"dhcp", "dhcp":{ "peerdns":"0", "ipv4dns1":"114.114.114.114", "ipv4dns2":"8.8.8.8" } }}
Wan set to pppoe Internet access parameters
{ "version": "1.0", "sid": "5bdd8aec153a8ff183387bfcea40e3aa", "module":"wan", "api":"set", "param": { "proto": "pppoe", "pppoe": { "username": "cHBwb2V0ZXN0", "password": "cHBwb2V0ZXN0", "peerdns": "1", "advance": "0" } }}
Request parameter description
Parameter name | type | description |
---|---|---|
ver | string | API version |
sid | string | session id returned after logging |
module | string | requested module |
api | string | requested api interface |
param.proto | string | Set the WAN port Internet access method, dhcp, pppoe, static |
param.dhcp.peerdns | string | dhcp is manually set to DNS, 0 identification is manually set, parameters need to have ipv4dns1 and ipv4dns2 |
param.dhcp.ipv4dns1 | string | peerdns is set to 0, manually set the first dns |
param.dhcp.ipv4dns2 | string | peerdns is set to 0, manually set the second dns |
param.static.ipv4addr | string | IP address of static Internet access WAN port |
param.static.ipv4mask | string | Mask of static Internet WAN port |
param.static.ipv4gateway | string | Gateway IP of static Internet access WAN port |
param.static.ipv4dns1 | string | first dns set manually, optional settings |
param.static.ipv4dns2 | string | Second DNS set manually, optional settings |
param.pppoe.username | string | pppoe’s dialing username, base64 encrypted ciphertext |
param.pppoe.password | string | pppoe’s dialing password, base64 encrypted ciphertext |
param.pppoe.peerdns | string | Whether to set dns manually, if it is 0, you need to set ipv4dns1 and ipv4dns2 |
param.pppoe.advance | string | Whether advanced settings are required, if it is 1, you need to set the mtu parameters |
param.pppoe.mtu | string | advance is set to 1 |
param.pppoe.ipv4dns1 | string | peerdns is set to 0, manually set the first dns |
param.pppoe.ipv4dns2 | string | peerdns is set to 0, manually set the second dns |
Return to the example
{ "module": "wan", "version": "1.0", "api": "set", "errcode": 0, "result": {}, "sid": "9f871caadd083d82cefa516de04ac31a"}
Return to parameter description
Parameter name | type | description |
---|---|---|
module | string | requested module |
version | string | api version |
api | string | requested api interface |
errcode | string | Returned error code |
sid | string | requested sid |
2、get
Get the configuration request format of the wan port
{ "version": "1.0", "sid": "3675428b10de8a6c06ac67d5f33db45a", "module": "wan", "api": "get"}
Request parameter description
Parameter name | type | description |
---|---|---|
version | string | API version |
sid | string | session id returned after logging |
module | string | requested module |
api | string | requested api interface |
Return to the example
{ "module": "wan", "version": "1.0", "api": "get", "errcode": 0, "result": { "config": { "dhcp": { "ipv4dns1": "114.114.114.114", "peerdns": "0", "ipv4dns2": "8.8.8.8", "mtu": "1500" }, "static": { "mtu": "1500", "ipv4dns1": "114.114.114.114", "ipv4gateway": "192.168.18.1", "ipv4mask": "255.255.255.0", "ipv4addr": "192.168.18.100" }, "pppoe": { "username": "cHBwb2V0ZXN0", "special_dial": "0", "advance": "0", "mtu": "1480", "peerdns": "1", "password": "cHBwb2V0ZXN0" } }, "proto": "dhcp" }, "sid": "3675428b10de8a6c06ac67d5f33db45a"}
Return to parameter description
Parameter name | type | description |
---|---|---|
module | string | requested module |
version | string | api version |
api | string | requested api interface |
errcode | string | Returned error code |
sid | string | requested sid |
result.config.proto | string | current wan working mode |
result.config.dhcp | string | Configuration when wan port is used for dhcp, subfields refer to set interface |
result.config.static | string | Configuration when wan port is static, subfields refer to set interface |
result.config.pppoe | string | wan port configuration when using pppoe, subfield reference set interface |
3、get_runtime
Request parameter description
{ "version": "1.0", "sid": "49bb324560eb4eaf3c6d9ed652ca1e8c", "module": "wan", "api": "get_runtime", "param": {}}
Request parameter description
Parameter name | type | description |
---|---|---|
version | string | API version |
sid | string | session id returned after logging |
module | string | requested module |
api | string | requested api interface |
Return to the example
{ "module": "wan", "version": "1.0", "api": "get_runtime", "errcode": 0, "result": { "status": { "cable": true, "ipv4dns2": "8.8.8.8", "up": true, "ipv4dns1": "114.114.114.114", "ipv4gateway": "192.168.18.1", "ipv4mask": "255.255.255.0", "ipv4addr": "192.168.18.248" }, "proto": "dhcp" }, "sid": "9f667090acfa315b0e797cd8d28fc6f0"}
Return to parameter description
Parameter name | type | description |
---|---|---|
module | string | requested module |
version | string | api version |
api | string | requested api interface |
errcode | string | Returned error code |
sid | string | requested sid |
result.proto | string | current wan working mode |
result.status.cable | string | Wan port network cable is connected |
result.status.up | string | Wand port is getting the IP address |
result.status.ipv4addr | string | wan port’s ip address |
result.status.ipv4mask | string | wan port subnet mask |
result.status.ipv4gateway | string | wan port gateway address |
result.status.ipv4dns1 | string | first dns address of wan port |
result.status.ipv4dns2 | string | The second dns address of wan port |