Juniper vMX on Fedora
The Juniper vMX Virtual Device is a full-featured, carrier-grade virtual device. The vMX Virtual Device runs the Junos operating system and compiles the programmable Trio chipset microcode for x86 chipsets, which maintains complete feature and operational consistency with physical MX Series 3D Universal Edge Routers.
I will cover installing required software and altering the Juniper install script so that it runs on Fedora. After making these alterations, the Juniper vMX can be easily installed on Fedora, as a guest on KVM.
This past weekend I received access to download the Trial Version for Juniper's vMX router. I have had to change a bunch of stuff to get it up and running on Fedora, which is the operating system I run KVM from. The trial software can be downloaded from here, however you will need to set up a relevant account and then contact Juniper Customer Services. This can take some time.
The setup is pretty complex without a guide and you will want to get hold of Matt Dinham's excellent Day One Book vMX Up & Running. You will want to read, at least chapters 1 & 2 before starting here.
As the vMX orchestration scripts are written to run with ubuntu, there was a lot of breakage to deal with so I will attempt to clear the path for any other Fedora users. I read somewhere on the Juniper site that vMX should run under Red Hat, so this may even run on Red Hat or CentOS, out of the box. Please let me know if it does.
I will only list the Fedora specifics here. The rest is in vMX Up & Running.
Fedora packages needed:
dnf install PyYAML \ glib2-devel \ libnl3-devel \ libvirt-daemon-config-network \ libvirt-daemon-kvm \ libxml2-devel \ libxslt-devel \ libyaml-devel \ numactl \ numactl-devel \ python-devel \ python-netifaces \ qemu-kvm \ redhat-lsb-core \ virt-install \ yajl-devel
When that is installed and you have extracted the vMX .tgz bundle, it is a simple matter of applying the patch I have provided here to make all the required changes.
cd /path/to/unbundled/vmx-16.1R1.7 patch -p1 -i /path/to/vmx-fedora-16.1R1.7.patch
From here, you need to follow vMX Up & Running to sort out your vmx.conf file.
Fedora changes to vMX scripts
I haven't done much of anything fancy. All of it can be garnered from reading the patch file, however, here are quick notes on "why I did what":
env/fedora_virtio.env - added file to provide environment variables from Fedora, to vMX.
scripts/common/vmx_common_utils.sh - add -e to echo to colorize text as necessary.
scripts/kvm/common/vmx_kvm_bringup.sh- make interfaces provide details we can work with.
scripts/kvm/common/vmx_kvm_cleanup.sh - same again, it's all about grepping interfaces.
scripts/kvm/common/vmx_kvm_system_setup.sh - this is going to take a little more explaining:
- First. /proc/sys/vm/nr_hugepages - from what I have researched this seems to be the location to allocate huge page memory for Fedora. If you have specific needs for Huge Pages you will need to research this more, and please leave a comment if you do. Running grep Huge /proc/meminfo will show you details of usage.
[root@localhost vmx-16.1R1.7]# grep Huge /proc/meminfo AnonHugePages: 2844672 kB ShmemHugePages: 0 kB HugePages_Total: 4096 HugePages_Free: 189 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB
next we skip the ubuntu apparmor foo, as Huge Pages is handled correctly via SELinux.
and finally 2 entries to start and stop libvirt.
scripts/templates/_vPFE-ref.xml - cutting out machine='pc-i440fx-trusty' lets KVM choose the default machine type for your hypervisor.
vmx.sh - just a few missing quotations of variables that made the script die.
This was an older post ( late 2016/early 2017 ) from my networkfoo github page, where I used to mess about with Juniper equipment. I have added it here just to keep everything all in one place and also that, someone may find it interesting.