Repository navigation
KVM Virtualized Router
Fedora Server 30 (yes it's taken this long, but now SFP+ works.)
-
Get everything up to date
-
Install VIM (because that's how it goes)
-
Add user to kvm and libvirt groups
-
Ensure VM store is accessible to the libvirt group
chmod g+w /vm
-
Add remote user SSH keys to authorized_keys
-
Enable IOMMU
sudo grubby --args="intel_iommu=on" --update-kernel /boot/vmlinuz-4.16.6-302.fc28.x86_64
-
Create VM
-
Use OpenWRT 18.06.0
-
Get the combined-ext4 image and decompress it
-
Use dd to extend the size of the image file out to ~1GB
-
Mount the image file via a loopback device with kpartx
kpartx -v -a ./openwrt-18.06.2-x86-64-combined-ext4.img -
Using fdisk, because it's a sector-level stickler, note the starting sector of the rootfs then delete it.
-
Again using fdisk, re-create the partition at the exact same sector, with the extent reaching to the end of the space in the image file.
-
Run fsck on the file system to ensure its integrity
-
Run resize2fs to extend it, then re-run fsck to check.
-
Convert the image to qcow2 format
qemu-img convert -f raw -O qcow2 openwrt-18.06.2-x86-64-combined-ext4.img openwrt-18.06.2-x86-64-combined-ext4.qcow2
-
-
Configure network
-
eth0 is attached to the bridge. Later, all other physical interfaces except WAN will be as well. Configure the bridge to use 10.0.0.1
-
eth1 or whatever is "WAN" and set to use DHCP
-
On the host:
$ sudo virsh net-edit <network><network ipv6='yes'>
<name>vmnet</name>
<uuid>56273237-b81e-4385-a559-4956722dbf9a</uuid>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:3f:57:6b'/>
<domain name='vmnet'/>
<ip address='10.0.0.2' netmask='255.255.255.0'>
</ip>
</network> -
On the host:
$ sudo virsh net-destroy <network>
$ sudo virsh net-start <network> -
You will need to shut down and restart the VM to make the networking interface happy.
-
eth0 - 52:54:00:d5:d8:25 - LAN virtual nic
ethX - ac:1f:6b:b0:02:70 - LAN 1GbaseT (switch)
eth1 - ac:1f:6b:b0:02:71 - WAN
ethY - ac:1f:6b:b0:02:72 - LAN 1GbaseT (misc)
ethZ - ac:1f:6b:b0:02:73 - LAN 1GbaseT (misc)
eth2 - ac:1f:6b:b0:79:64 - LAN 10GbaseT (main desktop)
eth3 - ac:1f:6b:b0:79:65 - LAN 10GbaseT (misc)
eth4 - ac:1f:6b:b0:79:66 - LAN 10Gbe SFP+ (NAS)
eth5 - ac:1f:6b:b0:79:67 - LAN 10Gbe SFP+ (misc)
10.0.0.1 - OpenWRT instance with all NICs routed into it.
10.0.0.2 - NAS
10.0.0.3 - VM Host system (Supermicro A2SDi-TP8F
10.0.0.4 - VM Host BMC (dedicated interface -> switch -> VM)
10.0.0.5 - Network power control box
10.0.0.6 - Ubiquiti AP
10.0.0.7 - Managed switch
10.0.0.50 - Start of wired DHCP range
10.0.0.99 - End of wired DHCP range
10.0.0.0.100 - Main desktop
10.0.0.0.101 - RB-89 (NUC 1)
10.0.0.0.102 - Nano (NUC 2)
10.0.0.0.103 - PS4
10.0.0.150 - Start of wifi DHCP range
10.0.0.199 - End of wifi DHCP range