diff --git a/README.md b/README.md index bd8d7bb..abf9c07 100644 --- a/README.md +++ b/README.md @@ -61,4 +61,5 @@ This project was written and is maintained by the following individuals: * Ozzy Schoonover * Alexander Deca * Xinyu Wei -* Kelly Christians \ No newline at end of file +* Kelly Christians +* Ariadne Haske diff --git a/node-definitions/vyos/README.md b/node-definitions/vyos/README.md new file mode 100644 index 0000000..d682c72 --- /dev/null +++ b/node-definitions/vyos/README.md @@ -0,0 +1,5 @@ +# VyOS + +[Download](https://vyos.net/get/nightly-builds/) a nightly `.iso` image. + +Instructions on how to make the `.qcow2` from an `.iso` are in the [`image-definitions/vyos`](image-definitions/vyos) folder. diff --git a/node-definitions/vyos/VyOS-Router.yaml b/node-definitions/vyos/VyOS-Router.yaml new file mode 100644 index 0000000..edf5674 --- /dev/null +++ b/node-definitions/vyos/VyOS-Router.yaml @@ -0,0 +1,55 @@ +id: VyOS-Router +general: + nature: router + description: |- + Opensource Router and Firewall Platform + https://docs.vyos.io/ + read_only: false +device: + interfaces: + has_loopback_zero: true + physical: + - eth0 + - eth1 + - eth2 + - eth3 + - eth4 + - eth5 + serial_ports: 1 + default_count: 6 + loopback: + - lo +ui: + visible: true + label_prefix: vyos- + icon: router + label: VyOS +sim: + linux_native: + libvirt_domain_driver: kvm + driver: server + disk_driver: sata + ram: 512 + cpus: 1 + cpu_limit: 100 + nic_driver: virtio +boot: + timeout: 60 + uses_regex: false +inherited: + image: + ram: true + cpus: true + cpu_limit: true + data_volume: true + boot_disk_size: true + node: + ram: true + cpus: true + cpu_limit: true + data_volume: true + boot_disk_size: true +configuration: + generator: + driver: null +schema_version: 0.0.1 diff --git a/virl-base-images/vyos/VyOS-1.5-rolling-202409200006.yaml b/virl-base-images/vyos/VyOS-1.5-rolling-202409200006.yaml new file mode 100644 index 0000000..83af3fe --- /dev/null +++ b/virl-base-images/vyos/VyOS-1.5-rolling-202409200006.yaml @@ -0,0 +1,8 @@ +id: VyOS-1.5-rolling-202409200006 +node_definition_id: VyOS-Router +description: VyOS-1.5-rolling-202409200006 +label: VyOS-1.5-rolling-202409200006 +disk_image: vyos-1.5-rolling-202409200006.qcow2 +read_only: false +disk_subfolder: VyOS-1.5-rolling-202409200006 +schema_version: 0.0.1 diff --git a/virl-base-images/vyos/proxmox-instructions.md b/virl-base-images/vyos/proxmox-instructions.md new file mode 100644 index 0000000..61de4ed --- /dev/null +++ b/virl-base-images/vyos/proxmox-instructions.md @@ -0,0 +1,77 @@ +This works for CML v2.7.2. + +### 1. Get an image + +VyOS free images are [nightly](https://vyos.net/get/nightly-builds/) builds, packaged as `.iso` files. + +These require installation onto a virtual machine. + +### 2. Prepare the VM + +This install is Proxmox VE, but other hypervisors should work. + +I used the GUI and attached the above `.iso` onto a cd-rom. + +Settings used: + +| Option | Value | +| ---- | ---- | +| Type | Linux | +| Version | 6.x - 2.6 Kernel | +| Machine | Default (i440fx) | +| vCPU | 1 | +| Memory | 1024 MB | +| Hard Disk | 2GB Virtio Block | +| Network Device | Virtio | + +### 3. Booting the VM + +When it boots, the credentials are `vyos` / `vyos` + +### 4. Installing the VM + +To install VyOS to the hard disk, type: + +`install image` + +This is mostly defaults except the config file for boot is `/opt/vyatta/etc/config.boot.default` + +
+Would you like to continue? y
+What would you like to name this image? ENTER
+Please enter a password for the vyos user: vyos
+Please enter a password for the vyos user: vyos
+What console should be used by default? (K: KVM, S: Serial?) ENTER
+Which one should be used for installation (Default :/dev/vda) ENTER
+Would you like to use all the free space on the drive [Y/n] Y 
+Which file would you like as boot config? (Default: 1) 2
+
+ +Power off the VM. + +### 5. QCOW2 + +Proxmox puts hard disks into `/var/lib/vz/images/` + +Get the VM ID if needed +``` +root@proxmox-host:/var/lib/vz/images/103# qm list + VMID NAME STATUS MEM(MB) BOOTDISK(GB) PID + 103 VyOS running 2048 2.00 265237 +``` + +Find the file +``` +root@proxmox-host:/var/lib/vz/images/103# ls +vm-103-disk-0.qcow2 +``` + +Copy to `/tmp` +``` +root@proxmox-host:/var/lib/vz/images/103# cp vm-103-disk-0.qcow2 /tmp/ +``` + +Compress the qcow2 ... this takes the file from 2GB to 500MB. This image has the name of the .ISO to distinguish the version +``` +root@proxmox-host:/tmp# qemu-img convert -c -O qcow2 /tmp/vm-103-disk-0.qcow2 /tmp/vyos-1.5-vyos-1.5-rolling-202409200006.qcow2 +``` diff --git a/virl-base-images/vyos/virt-install-instructions.md b/virl-base-images/vyos/virt-install-instructions.md new file mode 100644 index 0000000..6faae71 --- /dev/null +++ b/virl-base-images/vyos/virt-install-instructions.md @@ -0,0 +1,246 @@ +**Works for CML v2.7.2** + +These instructions use [libvirt's](https://libvirt.org/) `virt-install` to install the `.iso` file onto a KVM virtual machine hard disk to get a working `.qcow2` file. + +This guide is for Debian. + +The guide this is based on is [here.](https://docs.vyos.io/en/sagitta/installation/virtual/libvirt.html) + +## 1. Install libvirt + +Install libvirt and prereqs: QEMU, bridge-utils, etc. +``` +sudo apt-get install -y wget qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager cpu-checker +``` + +Check if KVM is supported. +``` +sudo kvm-ok +``` + +Example +
+ariadne@tesseract:~$ sudo kvm-ok
+INFO: /dev/kvm exists
+KVM acceleration can be used
+
+ +The above **must** say, KVM acceleration can be used. + + +## 2. Download the VyOS ISO + +VyOS free images are [nightly](https://vyos.net/get/nightly-builds/) builds, packaged as `.iso` files. + +Create a project folder +``` +mkdir ~/working-with-vyos +``` + +Change to it +``` +cd working-with-vyos +``` + +Use `wget` to download the `.iso` +``` +wget +``` + +Example +
+ariadne@tesseract:~/working-with-vyos$ ls
+vyos-1.5-rolling-202409230006-generic-amd64.iso
+
+ +## 3. Prepare a libvirt network + +VyOS needs a network, this part of the guide uses a NAT network, named `br1`. + +Networks in libvirt are defined in `.xml` files. + +Use cat with redirection to make the br.xml file with these settings. +``` +cat < br1.xml + + br1 + + + + + + + + + + + + +EOF +``` + +Define the network inside virsh +``` +virsh net-define br1.xml +``` + +Start the network inside virsh +``` +virsh net-start br1 +``` + +Check to see if it's working +``` +virsh net-list +``` + +Example +
+root@tesseract:/home/ariadne/working-with-vyos# virsh net-list
+ Name   State    Autostart   Persistent
+-----------------------------------------
+ br1    active   no          yes
+
+ +## 4. Prepare the VM + +Settings used: + +| Option | Value | +| ---- | ---- | +| Type | Linux | +| Version | 6.x - 2.6 Kernel | +| Machine | Default (i440fx) | +| vCPU | 1 | +| Memory | 1024 MB | +| Hard Disk | 2GB Virtio Block | +| Network Device | Virtio | + +Attempt `virt-install` ... change the .iso +``` +sudo virt-install -n vyos_r1 \ +--ram 1024 \ +--vcpus 1 \ +--cdrom ~/working-with-vyos/.iso \ +--os-type linux \ +--os-variant debian10 \ +--network network=br1 \ +--graphics vnc \ +--hvm \ +--virt-type kvm \ +--disk path=/var/lib/libvirt/images/vyos_r1.qcow2,bus=virtio,size=2 \ +--noautoconsole +``` + +Example +
+ariadne@tesseract:~/working-with-vyos$ sudo virt-install -n vyos_r2 \
+> --ram 1024 \
+> --vcpus 1 \
+> --cdrom ~/working-with-vyos/vyos-1.5-rolling-202409230006-generic-amd64.iso \
+> --os-type linux \
+> --os-variant debian10 \
+> --network network=br1 \
+> --graphics vnc \
+> --hvm \
+> --virt-type kvm \
+> --disk path=/var/lib/libvirt/images/vyos_r2.qcow2,bus=virtio,size=2 \
+> --noautoconsole
+
+Starting install...
+Allocating 'vyos_r2.qcow2'
+
+Domain is still running. Installation may be in progress.
+You can reconnect to the console to complete the installation process.
+
+ +## 5. Connect to the VM + +Use `virsh` +``` +sudo virsh console vyos_r1 +``` + +Press enter a few times + +Credentials are `vyos` / `vyos` + +Example +``` +vyos login: vyos +Password: vyos +Welcome to VyOS! +``` + +## 6. Complete the VM install + +Install VyOS to the hard disk +``` +install image +``` + +See the below example to see what selections to pick for `install image` + +Pick KVM with `config.boot.default` + +Example +``` +vyos@vyos:~$ install image +Welcome to VyOS installation! +This command will install VyOS to your permanent storage. +Would you like to continue? [y/N] y +What would you like to name this image? (Default: 1.5-rolling-202409230006) +Please enter a password for the "vyos" user: +Please confirm password for the "vyos" user: +What console should be used by default? (K: KVM, S: Serial)? (Default: S) K +Probing disks +1 disk(s) found +The following disks were found: +Drive: /dev/vda (2.0 GB) +Which one should be used for installation? (Default: /dev/vda) +Installation will delete all data on the drive. Continue? [y/N] Y +Searching for data from previous installations +No previous installation found +Would you like to use all the free space on the drive? [Y/n] Y +Creating partition table... +The following config files are available for boot: + 1: /opt/vyatta/etc/config/config.boot + 2: /opt/vyatta/etc/config.boot.default +Which file would you like as boot config? (Default: 1) 2 +Creating temporary directories +Mounting new partitions +Creating a configuration file +Copying system image files +Installing GRUB configuration files +Installing GRUB to the drive +Cleaning up +Unmounting target filesystems +Removing temporary files +The image installed successfully; please reboot now. +``` + +Power off the VM. +``` +sudo shutdown -h now +``` + +### 7. QCOW2 + +libvirt puts hard disks into `/var/lib/libvirt/images/` + +Copy the hard disk image to /tmp +``` +sudo cp /var/lib/libvirt/images/vyos_r1.qcow2 /tmp +``` + +Compress the qcow2 ... this takes the file from 2GB to 500MB. This image has the name of the .ISO to distinguish the version +``` +sudo qemu-img convert -c -O qcow2 /tmp/vyos_r1.qcow2 /tmp/vyos-1.5-rolling-.qcow2 +``` + +Give it sane permissions +``` +sudo chmod 644 /tmp/vyos-1.5-rolling-.qcow2 +``` + +This image can be added to CML via the web interface.