On Wed, 6 Jan 2021 at 15:56, Thomas Leonard
exec sudo "$mktuntap" -pvB 3 \ sudo -u "$USER" -C 4 \ "$crosvm" run \ -p init=/sbin/init \ -p "spectrumcmd=$(printf %s "$command" | base64 -w0)" \ --tap-fd 3 \ --seccomp-log-failures \ --root "$rootfs" \ --host_ip 10.0.0.1 \ --netmask 255.0.0.0 \ --mac c0:ff:ee:c0:ff:ee \ -m 4096 \ "$@" \ "$kernel"
I got "sudo: you are not permitted to use the -C option", which I fixed by editing the sudoers file. Then it fails with:
[ERROR:src/main.rs:1351] The architecture failed to build the vm: error creating devices: failed to set up virtio networking: failed to open tap device: failed to create tap interface: Operation not permitted (os error 1)
D'oh! I just realised you're not supposed to use the other network options when using `--tap-fd`! I was then able to browse the web from crosvm, like this: - Add pkgs/os-specific/linux/spectrum/rootfs/etc/resolv.conf with e.g. "nameserver 8.8.8.8". - Configure the virtual eth0 in the VM setup script: foreground { ifconfig eth0 10.0.0.2 up } foreground { route add default gateway 10.0.0.1 } - Enable NAT in configuration.nix, e.g. networking.nat = { enable = true; externalInterface = "eno2"; internalIPs = [ "10.0.0.0/8" ]; }; - Start the VM. - Run "sudo ifconfig tap0 10.0.0.1 up" on host. - Run firefox in VM to browse the web :-) -- talex5 (GitHub/Twitter) http://roscidus.com/blog/ GPG: 5DD5 8D70 899C 454A 966D 6A51 7513 3C8F 94F6 E0CC