Skip to content

Commit c014464

Browse files
committed
Improve whitespace around sections
It is easier to read the source when sections are separated by blank lines. (Automatically formatted by Zed markdown extension). Signed-off-by: Nir Soffer <[email protected]>
1 parent 3f2edea commit c014464

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Unlike `vde_vmnet`, `socket_vmnet` does not depend on VDE.
1212
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1313
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1414

15-
1615
- [Install](#install)
1716
- [From Homebrew](#from-homebrew)
1817
- [From MacPorts](#from-macports)
@@ -47,6 +46,7 @@ brew install socket_vmnet
4746
```
4847

4948
The binaries will be installed onto the following paths:
49+
5050
- `${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet`
5151
- `${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet_client`
5252

@@ -55,6 +55,7 @@ The `${HOMEBREW_PREFIX}` path defaults to `/opt/homebrew` on ARM, `/usr/local` o
5555
The `${HOMEBREW_PREFIX}/opt/socket_vmnet` directory is usually symlinked to `../Cellar/socket_vmnet/${VERSION}`.
5656

5757
Run the following command to start the daemon:
58+
5859
```bash
5960
mkdir -p ${HOMEBREW_PREFIX}/var/run
6061
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
7071

7172
<p>
7273

73-
7474
To install the launchd service:
75+
7576
```bash
7677
brew tap homebrew/services
7778
# sudo is necessary for the next line
@@ -90,6 +91,7 @@ Default configuration:
9091
| Gateway | 192.168.105.1 |
9192

9293
To uninstall the launchd service:
94+
9395
```bash
9496
sudo ${HOMEBREW_PREFIX}/bin/brew services stop socket_vmnet
9597
```
@@ -105,10 +107,12 @@ sudo port install socket_vmnet
105107
```
106108

107109
The binaries will be installed onto the following paths:
110+
108111
- `/opt/local/bin/socket_vmnet`
109112
- `/opt/local/bin/socket_vmnet_client`
110113

111114
Run the following command to start the daemon manually:
115+
112116
```bash
113117
sudo /opt/local/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
114118
```
@@ -120,6 +124,7 @@ sudo /opt/local/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_
120124
<p>
121125

122126
To install the launchd service:
127+
123128
```bash
124129
sudo port load socket_vmnet
125130
```
@@ -136,6 +141,7 @@ Default configuration:
136141
| Gateway | 192.168.105.1 |
137142

138143
To uninstall the launchd service:
144+
139145
```bash
140146
sudo port unload socket_vmnet
141147
```
@@ -155,6 +161,7 @@ sudo make install.bin
155161
```
156162

157163
This installs binaries using `PREFIX=/opt/socket_vmnet`:
164+
158165
- `/opt/socket_vmnet/bin/socket_vmnet`
159166
- `/opt/socket_vmnet/bin/socket_vmnet_client`
160167

@@ -175,8 +182,8 @@ sudo /opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/s
175182

176183
<p>
177184

178-
179185
To install the launchd service:
186+
180187
```bash
181188
sudo make install.launchd
182189
```
@@ -193,6 +200,7 @@ Default configuration:
193200
| Gateway | 192.168.105.1 |
194201

195202
To uninstall the launchd service:
203+
196204
```bash
197205
sudo make uninstall.launchd
198206
```
@@ -208,6 +216,7 @@ sudo make uninstall.launchd
208216
## Usage
209217

210218
### QEMU
219+
211220
Make sure that the `socket_vmnet` daemon is running, and execute QEMU via `socket_vmnet_client` as follows:
212221

213222
```console
@@ -236,7 +245,9 @@ $ limactl start --name=default template://vmnet
236245
See also https://github.com/lima-vm/lima/blob/master/docs/network.md
237246

238247
## Advanced usage
248+
239249
### Multi VM
250+
240251
Multiple VMs can be connected to a single `socket_vmnet` instance.
241252

242253
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
249260
See [`./launchd/io.github.lima-vm.socket_vmnet.bridged.en0.plist`](./launchd/io.github.lima-vm.socket_vmnet.bridged.en0.plist).
250261

251262
Install:
263+
252264
```bash
253265
BRIDGED=en0
254266
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
261273
Use `${HOMEBREW_PREFIX}/var/run/socket_vmnet.bridged.en0` as the socket.
262274

263275
Uninstall:
276+
264277
```bash
265278
BRIDGED=en0
266279
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
294307
Unlike `vde_vmnet`, `socket_vmnet` does not depend on VDE.
295308

296309
### How is socket_vmnet related to QEMU-builtin vmnet support?
310+
297311
QEMU 7.1 added [the built-in support for vmnet](https://github.com/qemu/qemu/blob/v7.1.0/qapi/net.json#L626-L631).
298312

299313
However, QEMU-builtin vmnet requires running the entire QEMU process as root.
300314

301315
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.
302316

303317
### How to use static IP addresses?
318+
304319
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.
305320

306321
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
309324
as non-DHCP static addresses.
310325

311326
### How to reserve DHCP addresses?
327+
312328
- Decide a unique MAC address for the VM, e.g. `de:ad:be:ef:00:01`.
313329

314330
- Decide a reserved IP address, e.g., "192.168.105.100"
315331

316332
- Create `/etc/bootptab` like this. Make sure not to drop the "%%" header.
333+
317334
```
318335
# bootptab
319336
%%
@@ -322,6 +339,7 @@ tmp-vm01 1 de:ad:be:ef:00:01 192.168.105.100
322339
```
323340

324341
- Reload the DHCP daemon.
342+
325343
```
326344
sudo /bin/launchctl kickstart -kp system/com.apple.bootpd
327345
```
@@ -332,14 +350,17 @@ NOTE: don't confuse MAC addresses of VMs with the MAC address of `socket_vmnet`
332350
You do not need to configure (and you can't, currently) the MAC address of `socket_vmnet` itself.
333351

334352
### IP address is not assigned
353+
335354
Try the following commands:
355+
336356
```console
337357
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --remove /usr/libexec/bootpd
338358
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/libexec/bootpd
339359
/usr/libexec/ApplicationFirewall/socketfilterfw --unblock /usr/libexec/bootpd
340360
```
341361

342362
## Links
363+
343364
- https://developer.apple.com/documentation/vmnet
344365
- https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_vm_networking
345366
- [`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

Comments
 (0)