diff --git a/website/content/en/docs/config/network/_index.md b/website/content/en/docs/config/network/_index.md new file mode 100644 index 000000000000..6003e2a1025f --- /dev/null +++ b/website/content/en/docs/config/network/_index.md @@ -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)"] +``` \ No newline at end of file diff --git a/website/content/en/docs/config/network/user-v2.md b/website/content/en/docs/config/network/user-v2.md new file mode 100644 index 000000000000..9cbd3ee638f0 --- /dev/null +++ b/website/content/en/docs/config/network/user-v2.md @@ -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-.internal.` (e.g., `lima-default.internal.`). + +_Note_ + +- Enabling this network will disable the [default user-mode network](#user-mode-network--1921685024-) \ No newline at end of file diff --git a/website/content/en/docs/config/network/user.md b/website/content/en/docs/config/network/user.md new file mode 100644 index 000000000000..093911205429 --- /dev/null +++ b/website/content/en/docs/config/network/user.md @@ -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). diff --git a/website/content/en/docs/config/network.md b/website/content/en/docs/config/network/vmnet.md similarity index 59% rename from website/content/en/docs/config/network.md rename to website/content/en/docs/config/network/vmnet.md index a281f3b454c4..bf4b1438bc06 100644 --- a/website/content/en/docs/config/network.md +++ b/website/content/en/docs/config/network/vmnet.md @@ -1,102 +1,8 @@ --- -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"] - vm -- "qemu" --> shared["socket_vmnet (shared)"] - connect_from -- "Other VMs" --> userV2["user-v2"] - connect_from -- "Other hosts" --> bridged["socket_vmnet (bridged)"] -``` - -## 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). - -## 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 +title: VMNet networks +weight: 33 -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-.internal.` (e.g., `lima-default.internal.`). - -_Note_ - -- Enabling this network will disable the [default user-mode network](#user-mode-network--1921685024-) +--- ## VMNet networks @@ -271,4 +177,4 @@ configured in `socket_vmnet` and not in lima. ```yaml networks: - socket: "/var/run/socket_vmnet" -``` +``` \ No newline at end of file