@@ -28,21 +28,89 @@ the host and other guests.
28
28
To enable ` vde_vmnet ` (in addition the user-mode network), add the following lines to the YAML after installing ` vde_vmnet ` .
29
29
30
30
``` yaml
31
- network :
32
- # The instance can get routable IP addresses from the vmnet framework using
33
- # https://github.com/lima-vm/vde_vmnet. Both vde_switch and vde_vmnet
34
- # daemons must be running before the instance is started. The interface type
35
- # (host, shared, or bridged) is configured in vde_vmnet and not lima.
36
- vde :
37
- # vnl (virtual network locator) points to the vde_switch socket directory,
38
- # optionally with vde:// prefix
39
- - vnl : " vde:///var/run/vde.ctl"
40
- # MAC address of the instance; lima will pick one based on the instance name,
41
- # so DHCP assigned ip addresses should remain constant over instance restarts.
42
- macAddress : " "
43
- # Interface name, defaults to "vde0", "vde1", etc.
44
- name : " "
31
+ networks :
32
+ # vnl (virtual network locator) points to the vde_switch socket directory,
33
+ # optionally with vde:// prefix
34
+ # - vnl: "vde:///var/run/vde.ctl"
35
+ # # VDE Switch port number (not TCP/UDP port number). Set to 65535 for PTP mode.
36
+ # # Default: 0
37
+ # switchPort: 0
38
+ # # MAC address of the instance; lima will pick one based on the instance name,
39
+ # # so DHCP assigned ip addresses should remain constant over instance restarts.
40
+ # macAddress: ""
41
+ # # Interface name, defaults to "lima0", "lima1", etc.
42
+ # interface: ""
45
43
```
46
44
47
45
The IP address range is typically ` 192.168.105.0/24 ` , but depends on the configuration of ` vde_vmnet ` .
48
46
See [ the documentation of ` vde_vmnet ` ] ( https://github.com/lima-vm/vde_vmnet ) for further information.
47
+
48
+ ## Managed VMNet networks (via vde_vmnet)
49
+
50
+ Starting with version v0.7.0 lima can manage the networking daemons automatically. Networks are defined in
51
+ ` $LIMA_HOME/_config/networks.yaml ` . If this file doesn't already exist, it will be created with these default
52
+ settings:
53
+
54
+ ``` yaml
55
+ # Paths to vde executables. Because vde_vmnet is invoked via sudo it should be
56
+ # installed where only root can modify/replace it. This means also none of the
57
+ # parent directories should be writable by the user.
58
+ #
59
+ # The varRun directory also must not be writable by the user because it will
60
+ # include the vde_vmnet pid files. Those will be terminated via sudo, so replacing
61
+ # the pid files would allow killing of arbitrary privileged processes. varRun
62
+ # however MUST be writable by the daemon user.
63
+ #
64
+ # None of the paths segments may be symlinks, why it has to be /private/var
65
+ # instead of /var etc.
66
+ paths :
67
+ vdeSwitch : /opt/vde/bin/vde_switch
68
+ vdeVMNet : /opt/vde/bin/vde_vmnet
69
+ varRun : /private/var/run/lima
70
+ sudoers : /private/etc/sudoers.d/lima
71
+
72
+ group : staff
73
+
74
+ networks :
75
+ shared :
76
+ mode : shared
77
+ gateway : 192.168.105.1
78
+ dhcpEnd : 192.168.105.254
79
+ netmask : 255.255.255.0
80
+ bridged :
81
+ mode : bridged
82
+ interface : en0
83
+ # bridged mode doesn't have a gateway; dhcp is managed by outside network
84
+ host :
85
+ mode : host
86
+ gateway : 192.168.106.1
87
+ dhcpEnd : 192.168.106.254
88
+ netmask : 255.255.255.0
89
+ ` ` `
90
+
91
+ Instances can then reference these networks from their ` lima.yaml` file:
92
+
93
+ ` ` ` yaml
94
+ networks:
95
+ # Lima can manage daemons for networks defined in $LIMA_HOME/_config/networks.yaml
96
+ # automatically. Both vde_switch and vde_vmnet binaries must be installed into
97
+ # secure locations only alterable by the "root" user.
98
+ # - lima: shared
99
+ # # MAC address of the instance; lima will pick one based on the instance name,
100
+ # # so DHCP assigned ip addresses should remain constant over instance restarts.
101
+ # macAddress: ""
102
+ # # Interface name, defaults to "lima0", "lima1", etc.
103
+ # interface: ""
104
+ ` ` `
105
+
106
+ The network daemons are started automatically when the first instance referencing them is started,
107
+ and will stop automatically once the last instance has stopped. Daemon logs will be stored in the
108
+ ` $LIMA_HOME/_networks` directory.
109
+
110
+ Since the commands to start and stop the `vde_vmnet` daemon requires root, the user either must
111
+ have password-less `sudo` enabled, or add the required commands to a `sudoers` file. This can
112
+ be done via :
113
+
114
+ ` ` ` shell
115
+ limactl sudoers | sudo tee /etc/sudoers.d/lima
116
+ ` ` `
0 commit comments