Network Interfaces
Table 8-9 Network Interface Commands
Request | Append to Path /api/network/v{1|2} | Description |
---|---|---|
POST |
/interfaces |
Create a new network interface |
GET |
/interfaces/interface |
Get the specified network interface properties |
GET |
/interfaces |
List all network interface objects |
PUT |
/interfaces/interface |
Modify the specified network interface object |
DELETE |
/interfaces/interface |
Destroy the specified interface object |
Table 8-10 Network Interface Properties
Property | Description |
---|---|
|
Flag indicating whether administration is allowed on this interface |
|
Class type ("ip", "ipmp") (immutable after create) |
|
Current IP Addresses (immutable) |
|
Flag indicating whether this interface is enabled |
|
User label for interface |
|
Chose a network link for this interface |
|
State of Interface (immutable) |
|
IPv4 Addresses |
|
IPv4 DHCP flag |
|
IPv6 Addresses |
|
IPv6 DHCP flag |
List Network Interfaces
This command lists all of the configured network interfaces.
Example Request:
GET /api/network/v1/interfaces HTTP/1.1 Authorization: Basic Tm8gcGVla2luZyE= Host: zfs-storage.example.com:215 Accept: application/json
Example Result:
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 369 { "interfaces": {[ "href": "/api/network/v1/interfaces/ixgbe0", "v4addrs": ["ipaddr-1"] ... }, { "href": "/api/network/v1/interfaces/ixgbe1", "v4addrs": ["ipaddr-2"] ... }, { "href": "/api/network/v1/interfaces/ixgbe2", "v4addrs": ["ipaddr-3"] ... }, { "href": "/api/network/v1/interfaces/ixgbe3", "v4addrs": ["ipaddr-4"] ... }] }
Get Network Interface
This command gets the full list of properties for a specified network interface.
Example Request:
GET /api/network/v1/interfaces/ixgbe0 HTTP/1.1 Authorization: Basic Tm8gcGVla2luZyE= Host: zfs-storage.example.com:215 Accept: application/json
Example Result:
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 292 { "interface": { "admin": true, "class": "ip", "curaddrs": ["ipaddr-1"], "enable": true, "href": "/api/network/v1/interfaces/ixgbe0", "interface": "ixgbe0", "label": "Untitled Interface", "links": ["ixgbe0"], "state": "up", "v4addrs": ["ipaddr-1"], "v4dhcp": false, "v6addrs": [], "v6dhcp": false } }
Create Network Interface
This command creates a new network interface.
Example Request:
POST /api/network/v1/interfaces HTTP/1.1
Host: zfs-storage.example.com:215
X-Auth-User: root
X-Auth-Key: password
Content-Type: application/json
Content-Length: 78
{
"class": "ip",
"links": ["ixgbe3"],
"v4addrs":"192.0.2.0/24"
}
Example Result:
HTTP/1.1 201 Created X-Zfssa-Appliance-Api: 1.0 Location: /api/network/v1/interfaces/ixgbe3
Modify Network Interface
This command modifies an existing network interface.
Example Request:
PUT /api/network/v1/interfaces/ixgbe3 HTTP/1.1 { "v4addrs": ["192.0.2.0/24"], "interface": "Demo Rest" }
Example Result:
HTTP/1.1 202 Accepted X-Zfssa-Appliance-Api: 1.0 Content-Type: application/json Content-Length: 219 { "admin": true, "class": "ip", "curaddrs": ["192.0.2.0/24"], "enable": true, "href": "/api/network/v1/interfaces/ixgbe3", "interface": "ixgbe3", "label": "Demo Rest", "links": ["ixgbe3"], "state": "failed", "v4addrs": ["192.0.2.0/24"] "v4dhcp": false, "v6addrs": [], "v6dhcp": false }
Delete Network Interface
This command deletes an existing network interface.
Note:
When an interface is deleted, all routes associated with the interface are also removed.Example Request:
DELETE /api/network/v1/interfaces/ixgbe3 HTTP/1.1 Authorization: Basic Tm8gcGVla2luZyE= Host: zfs-storage.example.com:215
Example Result:
HTTP/1.1 204 No Content