Network

Resources related to network.

Global Configuration

The GlobalConfiguration resource represents network general settings like default gateway, nameservers, hostname, etc.

List resource

GET /api/v1.0/network/globalconfiguration/

Returns the global configuration dictionary.

Example request:

GET /api/v1.0/network/globalconfiguration/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

  {
          "gc_domain": "local",
          "gc_ipv4gateway": "192.168.3.1",
          "gc_hostname": "freenas",
          "gc_netwait_enabled": false,
          "gc_hosts": "",
          "gc_ipv6gateway": "",
          "gc_netwait_ip": "",
          "gc_nameserver1": "192.168.3.1",
          "gc_nameserver3": "",
          "gc_nameserver2": "",
          "gc_httpproxy": "",
          "id": 1
  }
Response Headers:
 
  • Content-Type – content type of the response
Status Codes:
  • 200 – no error

Update resource

PUT /api/v1.0/network/globalconfiguration/

Update global configuration id.

Example request:

PUT /api/v1.0/network/globalconfiguration/ HTTP/1.1
Content-Type: application/json

  {
          "gc_hosts": "192.168.3.56 myownhost"
  }

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

  {
          "gc_domain": "local",
          "gc_ipv4gateway": "192.168.3.1",
          "gc_hostname": "freenas",
          "gc_netwait_enabled": false,
          "gc_hosts": "192.168.3.56 myownhost",
          "gc_ipv6gateway": "",
          "gc_netwait_ip": "",
          "gc_nameserver1": "192.168.3.1",
          "gc_nameserver3": "",
          "gc_nameserver2": "",
          "gc_httpproxy": "",
          "id": 1
  }
JSON Parameters:
 
  • gc_domain (string) – domain
  • gc_hostname (string) – hostname
  • gc_ipv4gateway (string) – ipv4 address of the gateway
  • gc_ipv6gateway (string) – ipv6 address of the gateway
  • gc_nameserver1 (string) – nameserver address #1
  • gc_nameserver2 (string) – nameserver address #2
  • gc_nameserver3 (string) – nameserver address #3
  • gc_netwait_enabled (boolean) – enable netwait feature
  • gc_netwait_ip (string) – list of IPs to wait before proceed the boot
  • gc_hosts (string) – entries to append to /etc/hosts
  • gc_httpproxy (string) – http_proxy ip:port
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 200 – no error

Interface

The Interface resource represents network interfaces configuration.

List resource

GET /api/v1.0/network/interface/

Returns a list of all interfaces.

Example request:

GET /api/v1.0/network/interface/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

[
  {
          "int_v6netmaskbit": "",
          "int_ipv4address": "192.168.3.20",
          "int_name": "ext",
          "int_ipv6address": "",
          "int_dhcp": false,
          "int_options": "",
          "int_v4netmaskbit": "24",
          "ipv6_addresses": [],
          "int_aliases": [],
          "int_ipv6auto": true,
          "ipv4_addresses": [
                  "192.168.3.20/24",
          ],
          "int_interface": "em0",
          "id": 1
  }
]
Query Parameters:
 
  • offset – offset number. default is 0
  • limit – limit number. default is 20
Response Headers:
 
  • Content-Type – content type of the response
Status Codes:
  • 200 – no error

Create resource

POST /api/v1.0/network/interface/

Creates a new Interface and returns the new Interface object.

Example request:

POST /api/v1.0/network/interface/ HTTP/1.1
Content-Type: application/json

  {
          "int_ipv4address": "192.168.3.20",
          "int_name": "ext",
          "int_v4netmaskbit": "24",
          "int_interface": "em0",
  }

Example response:

HTTP/1.1 201 Created
Vary: Accept
Content-Type: application/json

  {
          "int_v6netmaskbit": "",
          "int_ipv4address": "192.168.3.20",
          "int_name": "ext",
          "int_ipv6address": "",
          "int_dhcp": false,
          "int_options": "",
          "int_v4netmaskbit": "24",
          "ipv6_addresses": [],
          "int_aliases": [],
          "int_ipv6auto": true,
          "ipv4_addresses": [
                  "192.168.3.20/24",
          ],
          "int_interface": "em0",
          "id": 1
  }
JSON Parameters:
 
  • int_name (string) – user name for the interface
  • int_interface (string) – name of the physical interface
  • int_ipv4address (string) – main IPv4 address
  • int_v4netmaskbit (string) – number of bits for netmask (1..32)
  • int_ipv6address (string) – main IPv6 address
  • int_v6netmaskbit (string) – number of bits for netmask [0, 48, 60, 64, 80, 96]
  • int_dhcp (boolean) – enable DHCP
  • int_ipv6auto (boolean) – enable auto IPv6
  • int_options (string) – extra options to ifconfig(8)
  • int_aliases (list(string)) – list of IP addresses as aliases
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 201 – no error

Update resource

PUT /api/v1.0/network/interface/(int: id)/

Update Interface id.

Example request:

PUT /api/v1.0/network/interface/1/ HTTP/1.1
Content-Type: application/json

  {
          "int_ipv4address": "192.168.3.21"
  }

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

  {
          "int_v6netmaskbit": "",
          "int_ipv4address": "192.168.3.21",
          "int_name": "ext",
          "int_ipv6address": "",
          "int_dhcp": false,
          "int_options": "",
          "int_v4netmaskbit": "24",
          "ipv6_addresses": [],
          "int_aliases": [],
          "int_ipv6auto": true,
          "ipv4_addresses": [
                  "192.168.3.20/24",
          ],
          "int_interface": "em0",
          "id": 1
  }
JSON Parameters:
 
  • int_name (string) – user name for the interface
  • int_interface (string) – name of the physical interface
  • int_ipv4address (string) – main IPv4 address
  • int_v4netmaskbit (string) – number of bits for netmask (1..32)
  • int_ipv6address (string) – main IPv6 address
  • int_v6netmaskbit (string) – number of bits for netmask [0, 48, 60, 64, 80, 96]
  • int_dhcp (boolean) – enable DHCP
  • int_ipv6auto (boolean) – enable auto IPv6
  • int_options (string) – extra options to ifconfig(8)
  • int_aliases (list(string)) – list of IP addresses as aliases
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 200 – no error

Delete resource

DELETE /api/v1.0/network/interface/(int: id)/

Delete cronjob id.

Example request:

DELETE /api/v1.0/network/interface/1/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 204 No Response
Vary: Accept
Content-Type: application/json
Status Codes:
  • 204 – no error

VLAN

The VLAN resource represents network vlan configuration.

List resource

GET /api/v1.0/network/vlan/

Returns a list of all VLANs.

Example request:

GET /api/v1.0/network/vlan/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

[
  {
          "vlan_description": "",
          "vlan_pint": "em1",
          "vlan_tag": 0,
          "vlan_vint": "vlan0",
          "id": 1
  }
]
Query Parameters:
 
  • offset – offset number. default is 0
  • limit – limit number. default is 20
Response Headers:
 
  • Content-Type – content type of the response
Status Codes:
  • 200 – no error

Create resource

POST /api/v1.0/network/vlan/

Creates a new VLAN and returns the new VLAN object.

Example request:

POST /api/v1.0/network/vlan/ HTTP/1.1
Content-Type: application/json

  {
          "vlan_vint": "vlan0",
          "vlan_pint": "em1",
          "vlan_tag": 0,
  }

Example response:

HTTP/1.1 201 Created
Vary: Accept
Content-Type: application/json

  {
          "vlan_description": "",
          "vlan_pint": "em1",
          "vlan_tag": 0,
          "vlan_vint": "vlan0",
          "id": 1
  }
JSON Parameters:
 
  • vlan_pint (string) – physical interface
  • vlan_vint (string) – virtual interface name, vlanX
  • vlan_description (string) – user description
  • vlan_tag (integer) – vlan tag number
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 201 – no error

Update resource

PUT /api/v1.0/network/vlan/(int: id)/

Update VLAN id.

Example request:

PUT /api/v1.0/network/vlan/1/ HTTP/1.1
Content-Type: application/json

  {
          "vlan_tag": 1
  }

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

  {
          "vlan_description": "",
          "vlan_pint": "em1",
          "vlan_tag": 1,
          "vlan_vint": "vlan0",
          "id": 1
  }
JSON Parameters:
 
  • vlan_pint (string) – physical interface
  • vlan_vint (string) – virtual interface name, vlanX
  • vlan_description (string) – user description
  • vlan_tag (integer) – vlan tag number
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 200 – no error

Delete resource

DELETE /api/v1.0/network/vlan/(int: id)/

Delete VLAN id.

Example request:

DELETE /api/v1.0/network/vlan/1/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 204 No Response
Vary: Accept
Content-Type: application/json
Status Codes:
  • 204 – no error

LAGG

The LAGG resource represents network LAGG (Link Aggregation) configuration.

List resource

GET /api/v1.0/network/lagg/

Returns a list of all LAGGs.

Example request:

GET /api/v1.0/network/lagg/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

[
  {
          "lagg_interface": "lagg0",
          "id": 1,
          "lagg_protocol": "roundrobin"
  }
]
Query Parameters:
 
  • offset – offset number. default is 0
  • limit – limit number. default is 20
Response Headers:
 
  • Content-Type – content type of the response
Status Codes:
  • 200 – no error

Create resource

POST /api/v1.0/network/lagg/

Creates a new LAGG and returns the new LAGG object.

Example request:

POST /api/v1.0/network/lagg/ HTTP/1.1
Content-Type: application/json

  {
          "lagg_interfaces": ["em1"],
          "lagg_protocol": "roundrobin"
  }

Example response:

HTTP/1.1 201 Created
Vary: Accept
Content-Type: application/json

  {
          "lagg_interface": "lagg0",
          "id": 1,
          "lagg_protocol": "roundrobin"
  }
JSON Parameters:
 
  • lagg_interfaces (list(string)) – list of physical interface names
  • lagg_protocol (string) – failover, fec, lacp, loadbalance, roundrobin, none
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 201 – no error

Delete resource

DELETE /api/v1.0/network/lagg/(int: id)/

Delete LAGG id.

Example request:

DELETE /api/v1.0/network/lagg/1/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 204 No Response
Vary: Accept
Content-Type: application/json
Status Codes:
  • 204 – no error

Static Route

The StaticRoute resource represents network routing tables route(8).

List resource

GET /api/v1.0/network/staticroute/

Returns a list of all static routes.

Example request:

GET /api/v1.0/network/staticroute/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

[
  {
  }
]
Query Parameters:
 
  • offset – offset number. default is 0
  • limit – limit number. default is 20
Response Headers:
 
  • Content-Type – content type of the response
Status Codes:
  • 200 – no error

Create resource

POST /api/v1.0/network/staticroute/

Creates a new static route and returns the new static route object.

Example request:

POST /api/v1.0/network/staticroute/ HTTP/1.1
Content-Type: application/json

  {
          "sr_destination": "192.168.1.0/24",
          "sr_gateway": "192.168.3.1",
          "sr_description": "test route"
  }

Example response:

HTTP/1.1 201 Created
Vary: Accept
Content-Type: application/json

  {
          "sr_description": "test route",
          "sr_destination": "192.168.1.0/24",
          "id": 1,
          "sr_gateway": "192.168.3.1"
  }
JSON Parameters:
 
  • sr_gateway (string) – address of gateway
  • sr_destination (string) – network cidr
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 201 – no error

Update resource

PUT /api/v1.0/network/staticroute/(int: id)/

Update static route id.

Example request:

PUT /api/v1.0/network/staticroute/1/ HTTP/1.1
Content-Type: application/json

  {
          "sr_destination": "192.168.1.0/16"
  }

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

  {
          "sr_description": "test route",
          "sr_destination": "192.168.1.0/16",
          "id": 1,
          "sr_gateway": "192.168.3.1"
  }
JSON Parameters:
 
  • sr_gateway (string) – address of gateway
  • sr_destination (string) – network cidr
Request Headers:
 
  • Content-Type – the request content type
Response Headers:
 
  • Content-Type – the response content type
Status Codes:
  • 200 – no error

Delete resource

DELETE /api/v1.0/network/staticroute/(int: id)/

Delete static route id.

Example request:

DELETE /api/v1.0/network/staticroute/1/ HTTP/1.1
Content-Type: application/json

Example response:

HTTP/1.1 204 No Response
Vary: Accept
Content-Type: application/json
Status Codes:
  • 204 – no error