@@ -12,7 +12,6 @@ Unlike `vde_vmnet`, `socket_vmnet` does not depend on VDE.
12
12
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
13
13
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
14
14
15
-
16
15
- [ Install] ( #install )
17
16
- [ From Homebrew] ( #from-homebrew )
18
17
- [ From MacPorts] ( #from-macports )
@@ -47,6 +46,7 @@ brew install socket_vmnet
47
46
```
48
47
49
48
The binaries will be installed onto the following paths:
49
+
50
50
- ` ${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet `
51
51
- ` ${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet_client `
52
52
@@ -55,6 +55,7 @@ The `${HOMEBREW_PREFIX}` path defaults to `/opt/homebrew` on ARM, `/usr/local` o
55
55
The ` ${HOMEBREW_PREFIX}/opt/socket_vmnet ` directory is usually symlinked to ` ../Cellar/socket_vmnet/${VERSION} ` .
56
56
57
57
Run the following command to start the daemon:
58
+
58
59
``` bash
59
60
mkdir -p ${HOMEBREW_PREFIX} /var/run
60
61
sudo ${HOMEBREW_PREFIX} /opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 ${HOMEBREW_PREFIX} /var/run/socket_vmnet
@@ -70,8 +71,8 @@ sudo ${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.16
70
71
71
72
<p >
72
73
73
-
74
74
To install the launchd service:
75
+
75
76
``` bash
76
77
brew tap homebrew/services
77
78
# sudo is necessary for the next line
@@ -90,6 +91,7 @@ Default configuration:
90
91
| Gateway | 192.168.105.1 |
91
92
92
93
To uninstall the launchd service:
94
+
93
95
``` bash
94
96
sudo ${HOMEBREW_PREFIX} /bin/brew services stop socket_vmnet
95
97
```
@@ -105,10 +107,12 @@ sudo port install socket_vmnet
105
107
```
106
108
107
109
The binaries will be installed onto the following paths:
110
+
108
111
- ` /opt/local/bin/socket_vmnet `
109
112
- ` /opt/local/bin/socket_vmnet_client `
110
113
111
114
Run the following command to start the daemon manually:
115
+
112
116
``` bash
113
117
sudo /opt/local/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
114
118
```
@@ -120,6 +124,7 @@ sudo /opt/local/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_
120
124
<p >
121
125
122
126
To install the launchd service:
127
+
123
128
``` bash
124
129
sudo port load socket_vmnet
125
130
```
@@ -136,6 +141,7 @@ Default configuration:
136
141
| Gateway | 192.168.105.1 |
137
142
138
143
To uninstall the launchd service:
144
+
139
145
``` bash
140
146
sudo port unload socket_vmnet
141
147
```
@@ -155,6 +161,7 @@ sudo make install.bin
155
161
```
156
162
157
163
This installs binaries using ` PREFIX=/opt/socket_vmnet ` :
164
+
158
165
- ` /opt/socket_vmnet/bin/socket_vmnet `
159
166
- ` /opt/socket_vmnet/bin/socket_vmnet_client `
160
167
@@ -175,8 +182,8 @@ sudo /opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/s
175
182
176
183
<p >
177
184
178
-
179
185
To install the launchd service:
186
+
180
187
``` bash
181
188
sudo make install.launchd
182
189
```
@@ -193,6 +200,7 @@ Default configuration:
193
200
| Gateway | 192.168.105.1 |
194
201
195
202
To uninstall the launchd service:
203
+
196
204
``` bash
197
205
sudo make uninstall.launchd
198
206
```
@@ -208,6 +216,7 @@ sudo make uninstall.launchd
208
216
## Usage
209
217
210
218
### QEMU
219
+
211
220
Make sure that the ` socket_vmnet ` daemon is running, and execute QEMU via ` socket_vmnet_client ` as follows:
212
221
213
222
``` console
@@ -236,7 +245,9 @@ $ limactl start --name=default template://vmnet
236
245
See also https://github.com/lima-vm/lima/blob/master/docs/network.md
237
246
238
247
## Advanced usage
248
+
239
249
### Multi VM
250
+
240
251
Multiple VMs can be connected to a single ` socket_vmnet ` instance.
241
252
242
253
Make sure to specify unique MAC addresses to VMs: ` -device virtio-net-pci,netdev=net0,mac=de:ad:be:ef:00:01 ` .
@@ -249,6 +260,7 @@ You do not need to configure (and you can't, currently) the MAC address of `sock
249
260
See [ ` ./launchd/io.github.lima-vm.socket_vmnet.bridged.en0.plist ` ] ( ./launchd/io.github.lima-vm.socket_vmnet.bridged.en0.plist ) .
250
261
251
262
Install:
263
+
252
264
``` bash
253
265
BRIDGED=en0
254
266
sed -e " s@/opt@${HOMEBREW_PREFIX} /opt@g; s@/var@${HOMEBREW_PREFIX} /var@g; s@en0@${BRIDGED} @g" ./launchd/io.github.lima-vm.socket_vmnet.bridged.en0.plist \
@@ -261,6 +273,7 @@ sudo launchctl kickstart -kp system/io.github.lima-vm.socket_vmnet.bridged.${BRI
261
273
Use ` ${HOMEBREW_PREFIX}/var/run/socket_vmnet.bridged.en0 ` as the socket.
262
274
263
275
Uninstall:
276
+
264
277
``` bash
265
278
BRIDGED=en0
266
279
sudo launchctl bootout system /Library/LaunchDaemons/io.github.lima-vm.socket_vmnet.bridged.${BRIDGED} .plist
@@ -294,13 +307,15 @@ See [`./etc_sudoers.d/socket_vmnet`](./etc_sudoers.d/socket_vmnet) to allow runn
294
307
Unlike ` vde_vmnet ` , ` socket_vmnet ` does not depend on VDE.
295
308
296
309
### How is socket_vmnet related to QEMU-builtin vmnet support?
310
+
297
311
QEMU 7.1 added [ the built-in support for vmnet] ( https://github.com/qemu/qemu/blob/v7.1.0/qapi/net.json#L626-L631 ) .
298
312
299
313
However, QEMU-builtin vmnet requires running the entire QEMU process as root.
300
314
301
315
On the other hand, ` socket_vmnet ` does not require the entire QEMU process to run as root, though ` socket_vmnet ` has to run as root.
302
316
303
317
### How to use static IP addresses?
318
+
304
319
When ` --vmnet-gateway=IP ` is set to "192.168.105.1", the whole subnet (192.168.105.2-192.168.105.254) is used as the DHCP range.
305
320
306
321
To use static IP addresses, limit the DHCP range with ` --vmnet-dhcp-end=IP ` .
@@ -309,11 +324,13 @@ For example, `--vmnet-gateway=192.168.105.1 --vmnet-dhcp-end=192.168.105.100` al
309
324
as non-DHCP static addresses.
310
325
311
326
### How to reserve DHCP addresses?
327
+
312
328
- Decide a unique MAC address for the VM, e.g. ` de:ad:be:ef:00:01 ` .
313
329
314
330
- Decide a reserved IP address, e.g., "192.168.105.100"
315
331
316
332
- Create ` /etc/bootptab ` like this. Make sure not to drop the "%%" header.
333
+
317
334
```
318
335
# bootptab
319
336
%%
@@ -322,6 +339,7 @@ tmp-vm01 1 de:ad:be:ef:00:01 192.168.105.100
322
339
```
323
340
324
341
- Reload the DHCP daemon.
342
+
325
343
```
326
344
sudo /bin/launchctl kickstart -kp system/com.apple.bootpd
327
345
```
@@ -332,14 +350,17 @@ NOTE: don't confuse MAC addresses of VMs with the MAC address of `socket_vmnet`
332
350
You do not need to configure (and you can't, currently) the MAC address of ` socket_vmnet ` itself.
333
351
334
352
### IP address is not assigned
353
+
335
354
Try the following commands:
355
+
336
356
``` console
337
357
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --remove /usr/libexec/bootpd
338
358
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
339
359
/usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd
340
360
```
341
361
342
362
## Links
363
+
343
364
- https://developer.apple.com/documentation/vmnet
344
365
- https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_vm_networking
345
366
- [ ` file:///Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/vmnet.framework/Versions/Current/Headers/vmnet.h ` ] ( file:///Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/vmnet.framework/Versions/Current/Headers/vmnet.h )
0 commit comments