Setting up machineconnect
5 minute read
Instructions
Installation of Proxmox
Requirements: Keyboard (with English layout), mouse, computer monitor, password generator (e. g. BitWarden), (optional) device connected via WAN port with the final network
- Start the Edge PC and boot it via the USB stick with Proxmox
- Accept EULA
- On the next screen press next
- On the next screen select Country, time zone and keyboard layout (best: English/ US)
- On the next screen enter a secure password (document it!) and your email
- On the next screen enter the hostname in the format dccaachen-2-3-proxmox.dccaachen-2.umh (document it!), the IP, gateway and DNS (last one is usually 8.8.8.8, if not already automatically detected). The networking can be adjusted and finalized later.
- On the next screen press Install
Setting up Proxmox
Requirements: Computer connected with the same network as the edge device with its WAN port
- Access the web interface of Proxmox by entering
<https://IP:8006> in your browser - Click away the subscription/warning (it is legal although there is no license)
- Go to the console of the machine (click on the node and then on shell) and enter
nano /etc/network/interfaces
Now you have two options to setup the final networking:
Option 1: DHCP
Delete the existing file and add the following lines:
auto lo
iface lo inet loopback
iface enp6s0 inet manual
iface enp7s0 inet manual
iface enp8s0 inet manual
auto vmbr0
iface vmbr0 inet dhcp
bridge-ports enp6s0
bridge-stp off
bridge-fd 0
auto vmbr1
iface vmbr1 inet manual
bridge-ports enp7s0
bridge-stp off
bridge-fd 0
auto vmbr2
iface vmbr2 inet manual
bridge-ports enp8s0
bridge-stp off
bridge-fd 0
Option 2: static IP
Just add the following lines at the end of the file:
auto vmbr1
iface vmbr1 inet manual
bridge-ports enp7s0
bridge-stp off
bridge-fd 0
auto vmbr2
iface vmbr2 inet manual
bridge-ports enp8s0
bridge-stp off
bridge-fd 0
Next steps
You can close the file with Control + X. Reboot the system using reboot.
Install VMs
Go into the console and enter:
cd /var/lib/vz/template/iso/ && wget https://mirror.dns-root.de/opnsense/releases/20.7/OPNsense-20.7-OpenSSL-dvd-amd64.iso.bz2 && bunzip2 OPNsense-20.7-OpenSSL-dvd-amd64.iso.bz2 && wget https://github.com/rancher/k3os/releases/download/v0.11.1/k3os-amd64.iso && qm create 100 --memory 1024 --sockets 1 -ostype l26 --onboot yes --name opnsense --net0 virtio,bridge=vmbr0 --net1 virtio,bridge=vmbr1 --net2 virtio,bridge=vmbr2 --cdrom local:iso/OPNsense-20.7-OpenSSL-dvd-amd64.iso --virtio0 local-lvm:4 --bootdisk virtio0 && qm create 101 --memory 6144 --sockets 3 -ostype l26 --onboot yes --name k3OS --net0 virtio,bridge=vmbr1 --cdrom local:iso/k3os-amd64.iso --virtio0 local-lvm:200 --bootdisk virtio0 && qm start 100 && qm start 101
This sets up two VMs:
100with 1024 MB RAM, 1 CPU, 4GB file storage with OPNsense101with 6114 MB RAM, 3 CPU, 200 GB file storage with k3OS
You should adjust the RAM, CPUs and file storage if you are using a different device.
Setup OPNsense
Requirements: Passwort generator (e. g. BitWarden)
- Go to the console of OPNsense
- Login with user: installer and password: opnsense
- Press enter so often that the installation starts (just accept all default values)
- Setup your root password (document it!) and reboot
- After installation and reboot, login again with root as user and your selected password
- Press
1and then selectno VLAN,WAN --> vtnet0,LAN --> vtnet1,Optional interface 1 --> vtnet2, Optional interface 2 –> just press enter to abort. Confirm withy. - Reboot the VM by selecting
6and press enter - After reboot, connect to the LAN network
- Type into your browser:
<https://192.168.1.100> or<https://192.168.1.1> (random what works and what not) and login with your selected credentials - Wait some seconds and the setup wizard will appear
- Go through the process and select the following options:
- DNS according to your network settings
- Timezone and timeserver
- IPv4 configuration (usually static IP), remeber to set IP Address to /24 and not use the default /32, upstream gateway, uncheck Block RFC1918 networks
- Select LAN IP Address (usually 172.16.SERIALNUMBER.1 e.g., 172.16.95.1 for serial number 2021-1095)
- Don’t change the root password!
The following steps can be skipped if no VPN is desired by the customer. Continue with step 17.
- Add VPN CA and VPN certificate in System –> Trust –> CA / certificate (router not technician, ca.crt into CA, client.crt as public key, client.key as private key). Copy the contents into the fields.
- Go to VPN –> OpenVPN–>Clients and add a new client. Select the following options:
- Host: vpn.umh.app
- Port: 3SERIALNUMBER, e.g., if the serial number is 2021-0105 enter 3005.
- Check
Retry DNS resolution - Uncheck
Enable authentification of TLS packets - Select your certificates for
Peer Certificate AuthorityandClient certificate - Select
AES-256-CBCasEncryption algorithm - Select the IP as
IPv4 Remote Network, e.g., 172.16.106.0/24
- Go to Firewall –> Rules –> OpenVPN and click
add. Use all default values and presssave. - Click on
Apply changes - Go to VPN –> OpenVPN –> Connection status and verify whether the status is
up
Continue here:
- Adjust DHCP server range by going to Services –> DHCPv4 –> [LAN] and changing the .10 in Range / from to 100. Press
save.
TODO: SETUP PLC NETWORKTODO: Reserve IP for k3OS
k3OS
- Go to k3OS console in Proxmox and login with the user rancher (no password).
- type
sudo k3os install - Press enter
- Press enter
- Press enter (or add Github keys, if keys are added password is disabled)
- Enter password and press enter
- Press enter
- Press enter
- Press enter
- Press
yand then enter
Now go back to the web interface of OPNsense and give k3OS a reserved IP:
- Services –> DHCPv4 –> Leases and press on k3os the plus sign.
- Add there the IP address in the format of 172.16.SERIALNUMBER.10, e.g., 172.16.107.10
- Press
save - Press
Apply changes - Reboot k3os e.g., using Proxmox (right click on VM and then
reboot)
Now setup k3OS according to the documentation.
Local host
Requirements: Python previously installed on your computer.
- Open the local path of your computer in command line (cmd), e.g.
C:\Users\YOURNAME - Create a new folder with the command
mkdir NAME - Change to the folder with the command
cd NAME - Create a directory list with the command
python -m http.server - Call your browser and enter
localhost:8000
Now you can easily add files to your new folder and host them locally.