Labels

Sunday, July 31, 2016

OpenWRT KVM Setup

I was able to eek out a little period of time this weekend to work on the Ubuntu server.  My concentration was on getting some vlans setup coming into the server from a trunk line.

But before that I attempted to setup some OpenWRT VMs using instructions from the openwrt website.  First, I downloaded https://downloads.openwrt.org/chaos_calmer/15.05/x86/64/openwrt-15.05-x86-64-combined-ext4.img.gz, then I moved it to the Ubuntu server and unpacked it.

gunzip openwrt-x86-generic-combined-ext4.img.gz
qemu-img convert -f raw -O vmdk openwrt-x86-generic-combined-ext4.img openwrt-x86-generic-combined-ext4.vmdk

Once that was done, I converted it to qcow2 using the script here.  Once that was accomplished I pulled the qcow2 file into KVM and cloned it three times.  The three clones are for additional router functions in the future.

Once I had the KVMs generated I then updated the ethernet connection going to the card that had the No-Mans Land vlan on it.  I added several more tagged vlans to the trunk that I had formed using the Netgear switch.  I then setup a number of vlans using the instructions from https://wiki.ubuntu.com/vlan.  I then updated the /etc/network/interfaces file to setup the new vlans from the trunk line (truncated):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo br0-vlan6 br2-vlan300 br1-vlan200 enp3s0 enp4s5 enp4s6
iface lo inet loopback

# The primary network interface
iface enp3s0 inet manual
iface br0-vlan6 inet static
    address 192.168.0.133
    netmask 255.255.255.0
    broadcast 192.168.0.255
    network 192.168.0.0
    gateway 192.168.0.2
    bridge_ports enp3s0
    bridge_stp off
    bridge_fd 0
    bridge_waitport 0
    dns-nameservers 8.8.8.8 8.8.4.4 192.168.1.1

iface enp4s5 inet manual

...


iface br2-vlan300 inet static
    address 10.100.30.50
    netmask 255.255.255.0
    broadcast 10.100.30.255
    network 10.100.30.0
    bridge_ports enp4s5
    bridge_stp off
    bridge_fd 0
    bridge_waitport 0

auto enp4s5.4
iface enp4s5.4 inet static
        address 10.10.4.45
        netmask 255.255.255.0
        vlan-raw-device enp4s5

(and so on ...)

Now that I have the vlans (tagged) setup on the same Ethernet as the No-Mans Land vlan, I can concentrate on setting up the OpenWRT VMs to point to the correct vlans.