|
1 | 1 | # Network |
| 2 | + |
| 3 | +IncusOS supports complex network configurations consisting of interfaces, bonds, and VLANs. By default, IncusOS will configure each discovered interface to automatically acquire IPv4/IPv6 addresses, DNS, and NTP information from the local network. More complex network setups can be configured via an [install seed](../seed.md), or post-install via the network API. |
| 4 | + |
| 5 | +Before applying any new/updated network configuration, basic validation checks are performed. If this check fails, or the network fails to come up properly as reported by `systemd-networkd`, the changes will be reverted to minimize the chance of accidentally knocking the IncusOS system offline. |
| 6 | + |
| 7 | +Be aware that changing network configuration may result in a brief period of time when the system is unreachable over the network. |
| 8 | + |
| 9 | +## Configuration options |
| 10 | + |
| 11 | +Interfaces, bonds, and VLANs have a significant number of fields, which are largely self-descriptive and can be viewed in the [API definition](https://github.com/lxc/incus-os/blob/main/incus-osd/api/system_network.go). |
| 12 | + |
| 13 | +One special feature of note is the handling of hardware addresses (MACs). Both interfaces and bonds associate their configuration with the hardware address, which can be specified in two ways: |
| 14 | + |
| 15 | +* Raw MAC: Specify the hardware address directly, such as `10:66:6a:e5:6a:1c`. |
| 16 | + |
| 17 | +* Interface name: If an interface name is provided, such as `enp5s0`, at startup IncusOS will attempt to get its MAC address and substitute that value in the configuration. This is useful when installing IncusOS across multiple physically identical servers with only a single [install seed](../seed.md). |
| 18 | + |
| 19 | +The following configuration options can be set: |
| 20 | + |
| 21 | +* `interfaces`: Zero or more interfaces that should be configured for the system. |
| 22 | + |
| 23 | +* `bonds`: Zero or more bonds that should be configured for the system. |
| 24 | + |
| 25 | +* `vlans`: Zero or more VLANs that should be configured for the system. |
| 26 | + |
| 27 | +* `dns`: Optionally, configure custom DNS information for the system. |
| 28 | + |
| 29 | +* `ntp`: Optionally, configure custom NTP server(s) for the system. |
| 30 | + |
| 31 | +* `proxy`: Optionally, configure a proxy for the system. |
| 32 | + |
| 33 | +### Examples |
| 34 | + |
| 35 | +Configure two network interfaces, one with IPv4 and the other with IPv6: |
| 36 | + |
| 37 | +``` |
| 38 | +{ |
| 39 | + "interfaces": [ |
| 40 | + {"name": "ip4iface", |
| 41 | + "hwaddr": "enp5s0", |
| 42 | + "addresses": ["dhcp4"]}, |
| 43 | + {"name": "ip6iface", |
| 44 | + "hwaddr": "enp6s0", |
| 45 | + "addresses": ["slaac"]} |
| 46 | + ] |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | +Configure a VLAN with ID 123 on top of an active-backup bond composed of two interfaces with MTU of 9000 and LLDP enabled: |
| 51 | + |
| 52 | +``` |
| 53 | +{ |
| 54 | + "bonds": [ |
| 55 | + {"name:", "management", |
| 56 | + "mode": "active-backup", |
| 57 | + "mtu": 9000, |
| 58 | + "lldp": true, |
| 59 | + "members": ["enp5s0", "enp6s0"], |
| 60 | + "roles": ["management", "interfaces"] |
| 61 | + } |
| 62 | + ], |
| 63 | + "vlans": [ |
| 64 | + {"name": "uplink", |
| 65 | + "parent": "management", |
| 66 | + "id": 123, |
| 67 | + "addresses": ["dhcp4", "slaac"] |
| 68 | + } |
| 69 | + ] |
| 70 | +} |
| 71 | +``` |
| 72 | + |
| 73 | +Configure custom DNS and NTP for IncusOS: |
| 74 | + |
| 75 | +``` |
| 76 | +{ |
| 77 | + "dns": { |
| 78 | + "hostname": "server01", |
| 79 | + "domain": "example.com", |
| 80 | + "search_domains": ["example.com", "example.org"], |
| 81 | + "nameservers": ["ns1.example.com", "ns2.example.com"] |
| 82 | + }, |
| 83 | + "ntp": { |
| 84 | + "timeservers": ["ntp.example.com"] |
| 85 | + } |
| 86 | +} |
| 87 | +``` |
0 commit comments