Default LAN IP: 192.168.1.1
Default Credentials:
Username: root
Password: admin
Tested on Ubuntu Bionic 18.04 LTS
Instructions intended for use on clean Ubuntu OS with one physical nic port (ens3 in this guide)
NOTICE: No previous configuration of network/ovs/lxd accounted for.
lxc remote add ccio https://images.braincraft.io --public --accept-certificate
apt update && apt upgrade -y && apt dist-upgrade -y
apt install -y openvswitch-switch ifupdown lxd
sed 's/^/#/g' /etc/netplan/*.yaml
cat <<EOF >/etc/network/interfaces
# /etc/network/interfaces
auto lo
iface lo inet loopback
# Run interfaces.d config files
source /etc/network/interfaces.d/*.cfg
EOF
cat <<EOF >/etc/network/interfaces.d/wan.cfg
allow-hotplug wan
iface wan inet manual
EOF
cat <<EOF >/etc/network/interfaces.d/ens3.cfg
# Raise ens3 on ovs-br 'wan' with no IP
allow-hotplug ens3
iface ens3 inet manual
EOF
cat <<EOF >/etc/network/interfaces.d/lan.cfg
allow-hotplug lan
iface lan inet manual
EOF
cat <<EOF >/etc/network/interfaces.d/mgmt0.cfg
# Raise host mgmt0 iface on ovs-br 'lan' with no IP
allow-hotplug mgmt0
iface mgmt0 inet static
address 192.168.1.5
gateway 192.168.1.1
netmask 255.255.255.0
nameservers 192.168.1.1
mtu 1500
EOF
ovs-vsctl add-br wan -- add-port wan ens3
export HWADDRESS=$(echo "$HOSTNAME lan mgmt0" | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02\\:\1\\:\2\\:\3\\:\4\\:\5/')
ovs-vsctl add-br lan -- add-port lan mgmt0 -- set interface mgmt0 type=internal -- set interface mgmt0 mac="$HWADDRESS"
cat <<EOF | lxd init --preseed
config:
images.auto_update_interval: "0"
cluster: null
networks: []
storage_pools:
- config:
size: 15GB
description: ""
name: default
driver: btrfs
profiles:
- config: {}
description: ""
devices:
eth0:
name: eth0
nictype: macvlan
parent: lan
type: nic
root:
path: /
pool: default
type: disk
name: default
EOF
lxc profile copy default openwrt
lxc profile set openwrt security.privileged true
lxc profile device set openwrt eth0 parent wan
lxc profile device add openwrt eth1 nic nictype=bridged parent=lan
lxc launch bcio:openwrt gateway -p openwrt
watch -c lxc list
reboot
Find your WebUI in a lan side browser @ 192.168.1.1
Use as physical network gateway by adding 2nd physical NIC to ovs bridge 'lan'
(Substitute 'ens6' for your devices physical port)
cat <<EOF >/etc/network/interfaces.d/ens6.cfg
# Raise ens6 on ovs-br 'wan' with no IP
allow-hotplug ens6
iface ens6 inet manual
EOF
ovs-vsctl add-port lan ens6