Configure Ethernet
1. API Description
This API is used to configure Ethernet.
Request mode: POST [ip]/api/network/if-set
Administrator Rights | Logged-in |
---|---|
Yes | Yes |
2. Input Parameters
Name | Required | Type | Description |
---|---|---|---|
iface | Yes | String | The network card name, eth0 |
use-dhcp | Yes | Boolean | Whether to enable DHCP to get IP address true: Yes; false: No |
ipaddr | No | String | The IP address, which must be filled in when use-dhcp is false |
netmask | No | String | The subnet mask, which must be filled in when use-dhcp is false |
gateway | No | String | The gateway address, which must be filled in when use-dhcp is false |
dns1 | No | String | Primary DNS |
dns2 | No | String | Secondary DNS |
3. Output Parameters
Name | Type | Description |
---|---|---|
status | Int | Status code |
code | String | Status description |
4. Example
Configuring Ethernet.
Input Example
{
"iface": "eth0",
"use-dhcp": false,
"ipaddr": "10.10.10.88",
"netmask": "255.255.240.0",
"gateway": "10.10.0.1",
"dns1": "10.10.0.3",
"dns2": "",
}
Output Example
{
"status": 0,
"code": "Success"
}
5. Error Code
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Status | Definition | Description |
---|---|---|
7 | MW_STATUS_INVALID_ARG | Missing required parameters |
31 | MW_STATUS_NOT_PERMITTED | The Ethernet card is missing |