-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kairvee Vaswani <[email protected]>
- Loading branch information
1 parent
0582803
commit fdaeeb0
Showing
4 changed files
with
112 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
title: Network | ||
weight: 30 | ||
--- | ||
|
||
See the following flowchart to choose the best network for you: | ||
```mermaid | ||
flowchart | ||
connect_to_vm_via{"Connect to the VM via"} -- "localhost" --> default["Default"] | ||
connect_to_vm_via -- "IP" --> connect_from{"Connect to the VM IP from"} | ||
connect_from -- "Host" --> vm{"VM type"} | ||
vm -- "vz" --> vzNAT["vzNAT (see the VMNet page)"] | ||
vm -- "qemu" --> shared["socket_vmnet (shared)"] | ||
connect_from -- "Other VMs" --> userV2["user-v2"] | ||
connect_from -- "Other hosts" --> bridged["socket_vmnet (bridged)"] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
title: Lima user-v2 network | ||
weight: 32 | ||
--- | ||
|
||
## Lima user-v2 network | ||
|
||
| ⚡ Requirement | Lima >= 0.16.0 | | ||
|-------------------|----------------| | ||
|
||
user-v2 network provides a user-mode networking similar to the [default user-mode network](#user-mode-network--1921685024-) and also provides support for `vm -> vm` communication. | ||
|
||
To enable this network mode, define a network with `mode: user-v2` in networks.yaml | ||
|
||
By default, the below network configuration is already applied (Since v0.18). | ||
|
||
```yaml | ||
... | ||
networks: | ||
user-v2: | ||
mode: user-v2 | ||
gateway: 192.168.104.1 | ||
netmask: 255.255.255.0 | ||
... | ||
``` | ||
|
||
Instances can then reference these networks from their `lima.yaml` file: | ||
|
||
{{< tabpane text=true >}} | ||
{{% tab header="CLI" %}} | ||
```bash | ||
limactl start --network=lima:user-v2 | ||
``` | ||
{{% /tab %}} | ||
{{% tab header="YAML" %}} | ||
```yaml | ||
networks: | ||
- lima: user-v2 | ||
``` | ||
{{% /tab %}} | ||
{{< /tabpane >}} | ||
An instance's IP address is resolvable from another instance as `lima-<NAME>.internal.` (e.g., `lima-default.internal.`). | ||
|
||
_Note_ | ||
|
||
- Enabling this network will disable the [default user-mode network](#user-mode-network--1921685024-) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: Default user-mode network | ||
weight: 30 | ||
|
||
--- | ||
|
||
## Default user-mode network (192.168.5.0/24) | ||
|
||
By default Lima only enables the user-mode networking aka "slirp". | ||
|
||
### Guest IP (192.168.5.15) | ||
|
||
The guest IP address is set to `192.168.5.15`. | ||
|
||
This IP address is not accessible from the host by design. | ||
|
||
Use VMNet (see below) to allow accessing the guest IP from the host and other guests. | ||
|
||
### Host IP (192.168.5.2) | ||
|
||
The loopback addresses of the host is `192.168.5.2` and is accessible from the guest as `host.lima.internal`. | ||
|
||
### DNS (192.168.5.3) | ||
|
||
If `hostResolver.enabled` in `lima.yaml` is true, then the hostagent is going to run a DNS server over tcp and udp - each on a separate randomly selected free port. This server does a local lookup using the native host resolver, so it will deal correctly with VPN configurations and split-DNS setups, as well as mDNS, local `/etc/hosts` etc. For this the hostagent has to be compiled with `CGO_ENABLED=1` as default Go resolver is [broken](https://github.com/golang/go/issues/12524). | ||
|
||
These tcp and udp ports are then forwarded via iptables rules to `192.168.5.3:53`, overriding the DNS provided by QEMU via slirp. | ||
|
||
Currently following request types are supported: | ||
|
||
- A | ||
- AAAA | ||
- CNAME | ||
- TXT | ||
- NS | ||
- MX | ||
- SRV | ||
|
||
For all other queries hostagent will redirect the query to the nameservers specified in `/etc/resolv.conf` (or, if that fails - to `8.8.8.8` and `1.1.1.1`). | ||
|
||
DNS over tcp is rarely used. It is usually only used either when user explicitly requires it, or when request+response can't fit into a single UDP packet (most likely in case of DNSSEC), or in the case of certain management operations such as domain transfers. Neither DNSSEC nor management operations are currently supported by a hostagent, but on the off chance that the response may contain an unusually long list of records - hostagent will also listen for the tcp traffic. | ||
|
||
During initial cloud-init bootstrap, `iptables` may not yet be installed. In that case the repo server is determined using the slirp DNS. After `iptables` has been installed, the forwarding rule is applied, switching over to the hostagent DNS. | ||
|
||
If `hostResolver.enabled` is false, then DNS servers can be configured manually in `lima.yaml` via the `dns` setting. If that list is empty, then Lima will either use the slirp DNS (on Linux), or the nameservers from the first host interface in service order that has an assigned IPv4 address (on macOS). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters