Hi,
given that there's been no further feedback on the "rc" thread, I'm
continuing in posting parts of the work in progress configuration
specification for review.
This thread is for disucssing network configuration, i.e. the "net"
section.
The current work in progress state[1] of the specification for "net"
follows:
----
## net: Network configuration
"net": {
"interfaces": {
"<name>": {
"create": <boolean>,
"addrs": [
<address>,
...
]
},
...
},
"gateways": [
<gateway>,
...
],
"dns": {
"nameservers": [
<ip-address>,
...
],
"search": [
<domain-suffix>,
...
]
}
}
* _interfaces_: Each key configures a single network interface:
* _name_: The name of the network interface, as seen by the rump kernel. (eg.
`vioif0`, `xenif0`)
* _create_: If true, the rump kernel interface is created at boot time.
Required for Xen netback interfaces, otherwise _optional_.
* _address_: Configures a network address to be assigned to the interface.
Refer to protocol families below for supported `<address>` syntax.
_Optional_
* _gateways_: Configures default gateways. Refer to protocol families below for
supported `<gateway>` syntax. At most one `<gateway>` may be configured for
each supported network protocol. _Optional_
* _dns_: Configures the DNS resolver used by the unikernel:
* _nameservers_: A list of IPv4/IPv6 addresses of nameservers to use for
name resolution. (Maximum 3 strings, _Optional_)
* _search_: A list of domain suffixes to search when resolving unqualified
names. (Maximum 6 strings, _Optional_)
### IPv4 configuration
Interface addresses to be configured using IPv4 are specified as follows:
{
"type": "inet",
"method": <string>,
<method-specific configuration>
}
The `method` key must be set to one of the following:
* `dhcp`: Configure the interface using DHCPv4.
* `static`: Configure the interface statically. The following additional keys
must be present:
* `addr`: IPv4 interface address, in CIDR `address/mask` format.
Gateways to be configured using IPv4 are specified as follows:
{
"type": "inet",
"addr": <string>
}
* _addr_: The IPv4 address of the default gateway.
### IPv6 configuration
Interface addresses to be configured using IPv6 are specified as follows:
{
"type": "inet6",
"method": <string>,
<method-specific configuration>
}
The `method` key must be set to one of the following:
* `auto`: Configure the interface using IPv6 stateless autoconfiguration.
* `static`: Configure the interface statically. The following additional keys
must be present:
* `addr`: IPv6 interface address, in `address/prefixlen` format.
Gateways to be configured using IPv6 are specified as follows:
{
"type": "inet6",
"addr": <string>
}
* _addr_: The IPv6 address of the default gateway.
----
Comments?
Open questions from my side:
- How should DHCP/SLAAC and static address/gateway/dns interact, if at all?
Would it be clearer to mandate (and make it explicit in the spec) that an
interface can be configured *either* using static addressing *or*
DHCP/SLAAC? Does anyone see any common use cases for configuring an
interface with a combination of static addressing and DHCP? (For uncommon
use-cases the answer is, "not in the scope of the spec, write custom
code")
For DNS, I don't want to get into "fixing resolv.conf" now as that would
take forever, so I think a good enough answer is to just warn if DHCP and
manually-specified DNS are used in the same configuration, and leave the
behaviour as "undefined" for now.
Martin
[1] As always, the WIP branch can be found here:
https://github.com/rumpkernel/rumprun/tree/mato-wip-rumprun-config and the
full specification text here:
https://github.com/rumpkernel/rumprun/blob/mato-wip-rumprun-config/doc/config.md