Understanding VM Networking
Prerequisites
- You’ve installed the Anka Virtualization package
- You’ve created your first VM Template
- You grasp how to modify VM settings (like
network
)
Basics
Primarily, we use Apple’s VMNET interface set to “Using DHCP”. By default Anka VMs use a shared
networking configuration with the host. It’s a kind of NAT + DHCP.
❯ anka show 12.6 network
+------------+------------+
| mode | shared |
+------------+------------+
| controller | virtio-net |
+------------+------------+
. . .
Every time you start/resume a VM it will be assigned an IP:
❯ anka show 12.6
+---------+--------------------------------------+
| uuid | 1948dd37-e8ea-43b3-972f-b91860329eab |
+---------+--------------------------------------+
| name | 12.6 |
+---------+--------------------------------------+
| created | Oct 12 17:14:31 2022 |
+---------+--------------------------------------+
| vcpu | 5 |
+---------+--------------------------------------+
| ram | 6G |
+---------+--------------------------------------+
| display | 1024x768 vnc://192.168.64.6:5900 |
+---------+--------------------------------------+
| disk | 200GiB (17.20GiB on disk) |
+---------+--------------------------------------+
| addons | 3.1.0.148.6247878 |
+---------+--------------------------------------+
| network | shared 192.168.64.6 |
+---------+--------------------------------------+
| status | running since Oct 14 10:28:54 2022 |
+---------+--------------------------------------+
❯ anka show 12.6 network
+------------+-------------------+
| mode | shared |
+------------+-------------------+
| controller | virtio-net |
+------------+-------------------+
| ip | 192.168.64.6 |
+------------+-------------------+
| mac | ae:86:1c:97:a5:8a |
+------------+-------------------+
Type | Description |
---|---|
shared | The default network type operating as NAT + DHCP. Every VM after the start/resume gets an IP address assigned by the internal DHCP server in range 192.168.64.2 - 192.168.64.254 . Programs inside a VM can access external networks (outside the host) and the internet directly. Also, other VMs on the host are also accessible. This mode typically works with multiple interfaces on the host. |
host | It is very similar to the shared one, but the VM get IP addresses from range 192.168.128.2 - 192.168.128.254 and can’t access external networks outside of the host. |
bridge | The Bridged type will cause the VM to show in the network as an individual device and receive a unique IP separate from the host.
|
disconnected | The VM will have a disconnected network cable. |
If
anka show
does not display an IP, networking has either:
- Not fully started (give it a few more seconds).
- Networking cannot start due to some sort of host firewall or policy.
Within the VM, you can find an IP assigned for the host which can be used to ssh or transfer files out. To determine which IP is assigned to the host, executeipconfig getoption en0 server_identifier
(typically192.168.64.1
for shared network mode and192.168.128.1
for host network mode).
MAC Addresses
Anka will dynamically assign MAC addresses to your VM. You can assign custom MAC Addresses with the anka modify network --mac
option.
Be aware that if you clone your VM Template with a specific MAC, both VMs cannot run at the same time.
You must use a static MAC for each VM running on the machine. You cannot use a mix of dynamically assigned and statically assigned.
When using bridged networking mode for your VM, dynamic MAC Addresses are not guaranteed to be unique, though, reuse/collision is extremely unlikely. We do our best to prevent this with our randomization logic.
FAQs
- Should your Firewall software be blocking VM networking, you need to whitelist the
/Library/Application\ Support/Veertu/Anka/bin/headless.app
(3.x),/Library/Application\ Support/Veertu/Anka/bin/ankahv.app
, and/Applications/Anka.app
.