Feat: Add Linux support via QEMU tap networking#633
Feat: Add Linux support via QEMU tap networking#633bdkabiruddin wants to merge 1 commit intoroots:masterfrom
Conversation
|
This is a creative solution. Thanks for proposing it. Using Lima as the Linux solution is certainly more consistent and easier to implement than my other ideas of using LXD. I'll try and test this out using a VM within a VM. Couple notes:
How is performance of the Qemu based VM and this tap networking mode? I assume the TAP part has no perf penalty. |
|
Related: lima-vm/lima#358 and lima-vm/lima#4371 |
|
Thanks @swalkinshaw for the feedback and for reviewing this! Regarding your points:
Additional Context: I also think that testing this in other Linux environments (beyond my Ubuntu setup) is a good idea to ensure stability across different distributions. |
Description
This PR addresses issue #599 by enabling
trellis-clito work on Linux using Lima with QEMU.Currently,
trellis-clirelies onvmType: vzand macOS-specific networking, which makes VMs inaccessible on Linux (cannot route to the VM's IP).Changes Implemented
1. Dynamic VM Type
pkg/lima/instance.goandconfig.ymlto switch betweenvz(macOS) andqemu(Linux).2. Bridged Networking (The "TAP" Solution)
Since Lima on Linux (QEMU) implies user-mode networking by default, I implemented a bridged network approach:
tap0interface (assigned192.168.56.1) on the host usingsudo.192.168.56.5.3. QEMU Wrapper
Lima does not currently expose a way to inject specific
-netdev taparguments.qemu-system-x86_64wrapper script inpkg/lima/manager.go.4. IP Detection
Instance.IP()to prioritize the custom bridged subnet (192.168.56.x) on Linux.Verification
runtime.GOOSchecks.