This document explains how you can use fireguard on example of helloVM which is VM with Alpine Linux.
fireguard allows you to create a new VMs based on origin VM. So let's first create it.
Create origin VM folder and cd into it:
Download the kernel for a VM:
Download storage with Alpine Linux:
Test that origin VM works (credentials root/root):
Where:
Create VMs:
Creating new VM... id: vm-1 home folder: ***/stage/vm-1 socket: ***/stage/vm-1/firecracker.sock state: STOPPED pid: Optional.empty vmConfig: path: ***/stage/vm-1/vm_config.json memoryGb: 1 vcpu: 1 hostIface: Optional.empty mac: Optional.empty
Creating new VM... id: vm-2 home folder: ***/stage/vm-2 socket: ***/stage/vm-2/firecracker.sock state: STOPPED pid: Optional.empty vmConfig: path: ***/stage/vm-2/vm_config.json memoryGb: 1 vcpu: 1 hostIface: Optional.empty mac: Optional.empty
Start all VMs:
Starting VM with id vm-1... Starting VM with id vm-2...
Connect to VM:
There are screens on: 3945.vm-1 (01/24/20 22:03:16) (Detached) 3942.vm-2 (01/24/20 22:03:16) (Detached)
This covers network setup under Ubuntu.
First disable ufw:
Then create a new network:
Creating new network... id: net-1 subnet: /10.1.2.0 netmask: /255.255.255.0 ifaces: []
Attach VMs to it:
Attaching vm-1 to net-1 network...
Attaching vm-2 to net-1 network...
Restart the VMs:
Stopping VM with id vm-1... Stopping VM with id vm-2...
Starting VM with id vm-1... Starting VM with id vm-2...
Then go inside of the VM (root/root) and start networking:
* Starting networking ... * eth0 ... udhcpc: started, v1.28.4 udhcpc: sending discover udhcpc: sending select for 10.1.2.2 udhcpc: lease of 10.1.2.2 obtained, lease time 43200 route: ioctl 0x890c failed: No such process [ ok ]
The VM will use dhcp client to talk to the fireguard managed dhcpd to obtain an IP address.
Once it is done you can test it:
PING google.com (172.217.3.206): 56 data bytes 64 bytes from 172.217.3.206: seq=0 ttl=53 time=11.697 ms 64 bytes from 172.217.3.206: seq=1 ttl=53 time=13.777 ms