Skip to content

Instantly share code, notes, and snippets.

@AlexxNica
Created February 8, 2018 08:58
Show Gist options
  • Save AlexxNica/3458593dfd650c2f878c0fa591b3b41f to your computer and use it in GitHub Desktop.
Save AlexxNica/3458593dfd650c2f878c0fa591b3b41f to your computer and use it in GitHub Desktop.
Install Vyos on Packet.net

Vyos Install on Packet.net

VyOS defaults to a console rate of “9600”, which is not compliant with packet.net’s SOS. As such, the squashfs image will need to be unpacked, config.boot.default updated to the correct serial number/BAUD rate, and squashfs image recreated.

VyOS 1.8 (stable) or above is required due to the following vyos-legacy/live-initramfs#1 issue where the “fetch” command is ran prior to network loading

#install tools we need
sudo apt update && sudo apt install squashfs-tools

#Fetch iso
wget https://downloads.vyos.io/release/1.1.8/vyos-1.1.8-amd64.iso

#create folder for iso
mkdir /tmp/iso

#mount it
sudo mount -o loop vyos-1.1.8-amd64.iso /tmp/iso

#Create directory for the squashfs
mkdir /tmp/squashfs

#unsquash it
sudo unsquashfs -f -d /tmp/squashfs/ /tmp/iso/live/filesystem.squashfs

Now we need to change the tty and BAUD rate in the boot config.

/tmp/squashfs/opt/vyatta/etc/config.boot.default

Line #32: Original-

console {
              device ttyS0 {
              speed 9600

Change to-

console {
              device ttyS1 {
              speed 115200

Now we need to rebuild the squashfs, we need to know the compression and block size that were used in the original.

#Check the original, look for the lines Compression and Block Size
unsquashfs -s /tmp/iso/live/filesystem.squashfs

#Make the new one (using the compression and block size values)
sudo mksquashfs /tmp/squashfs/ /tmp/filesystem.squashfs -comp gzip -b 131072

The following files then need to be hosted on a public url somehwere (and that url added to the ipxe data below)

  • /tmp/iso/live/vmlinuz
  • /tmp/iso/live/initrd.img
  • /tmp/filesystem.squashfs

Now the fun part, we need to use ipxe custom boot in packet.

First step is create the server with the custom ipxe option, and set the user data to:

#!ipxe
dhcp

Once the server has been provisioned, we then need to update the user data and reboot it. The reason for the shuffle is we need to get the IP details from the server to complete the ipxe data. We need the ADDRESS, GATEWAY and NETMASK (eg 255.255.255.254 for a /31) and add it to the format below: Note:

  • the server should be set to always PXE boot as well, so the reboot catchs the PXE user data (you can remove this one vyos is installed)
  • The web server must be an IP Address not a dns name
#!ipxe
dhcp
set base http://WEBSERVERIP
kernel ${base}/vmlinuz  
initrd ${base}/initrd.img
imgargs vmlinuz initrd=initrd.img boot=live config console=ttyS1,115200n8 ip=NETWORK::GATEWAY:NETMASK fetch=${base}/filesystem.squashfs
boot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment