Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scionwan & Edge VM scripts #19

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contrib
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

35 changes: 35 additions & 0 deletions network-configs/netplan-55-scionwan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#
# This a Netplan configuration file used to create the "scionwan" bridged network used by the Edge VM appliance on a Sui Fullnode/Validator
#
# Copy this file as /etc/netplan/55-scionwan.yaml
# change the interface name [eno1] to match your interface
# add in the IPv4 and/or IPv6 address under "addresses"
# add in the IPv4 and/or IPv6 default gateways under "routes"
# remove the IPv4 and/or IPv6 addresses and routes from the existing interface on the existing netplan configuration file
#
# run "netplan apply" to create the bridge
#
# This configuration has been tested on Ubuntu 24
#
#
network:
bridges:
scionwan:
dhcp4: no
dhcp6: no
interfaces: [eno1]
addresses:
- 10.0.0.2/31
- 2001:0DB8::/32
routes:
- to: default
via: 10.0.0.1
- to: default
via: 2001:0DB8::1
nameservers:
addresses:
- 8.8.8.8
- 1.1.1.1
- 2001:4860:4860::8888
- 2606:4700:4700::1111
version: 2
39 changes: 39 additions & 0 deletions support/setup-latitude-host.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# sets up virtualization on a host in preparation for running the Edge appliance
# this includes setting up the various networks (physical and virtual)
# the appliance image is pulled down and made into an image ready for provisioning

# TOKEN must be set to download the appliance image
TOKEN=""

wget https://dl.cloudsmith.io/$TOKEN/anapaya/stable/raw/names/anapaya-appliance-base-uefi-qcow2/versions/sys_v2.10.0-scion_v0.36.0-1/anapaya-appliance-base-sys_v2.10.0-scion_v0.36.0-1-uefi.qcow2 -O appliance-uefi.qcow2

apt update

cat << EOF > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
network: {config: disabled}
EOF

mv /etc/netplan/50-cloud-init.yaml /etc/netplan/50-scionsui.yaml

echo "Please update /etc/netplan/50-scionsui.yaml to create scionwan"

apt install incus qemu-utils qemu-system-x86 -y
adduser studarus incus-admin

# non root from here down
newgrp incus-admin
incus admin init --minimal

incus network create virbr0

ls -l appliance-uefi.qcow2

cat << EOF > metadata.yaml
architecture: x86_64
creation_date: 1731113903
properties:
EOF
tar -cvzf metadata.tar.gz metadata.yaml

incus image import metadata.tar.gz appliance-uefi.qcow2 --alias edge
61 changes: 61 additions & 0 deletions support/start-edge-instance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/sh
# starts an instance of the Edge appliance as a VM
# pre-req:
# Edge Appliance UEFI QCOW2 must already be loaded as an image called edge
# virbr0 must be configured as a managed local bridged network (dhcp)
# scionwan must be configured as a unmanaged bridge network
# an extra IP on the scionwan must be available for the Edge
#
# This has only been tested on the Latitude m3.large.x86 hardware
#
# notes:
# after install, it takes a few minutes for the appliance to come online as it does updates
# the web GUI and the appliance-cli tool will not be available until this completes
#
# instance will be connected to the scionwan network for SCION connectivity via the Edge
# instance will be connected to the virbr0 network for private connectivity to the host and NAT'd Internet connectivity
EDGE_NAME=edge01

incus init edge $EDGE_NAME \
--vm \
--config limits.cpu=4 \
--config limits.memory=4096MiB

incus start $EDGE_NAME

sleep 20

incus config device add $EDGE_NAME eth0 nic nictype=bridged parent=virbr0
incus config device add $EDGE_NAME eth1 nic nictype=bridged parent=scionwan

NETPLAN_CONFIG=/tmp/scionsui-edge-netplan.$$

cat <<EOF > $NETPLAN_CONFIG
network:
version: 2
ethernets:
enp5s0:
dhcp4: true
enp6s0:
addresses:
- 45.250.253.165/31
routes:
- to: default
via: 45.250.253.164
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
EOF

incus exec $EDGE_NAME -- rm /etc/netplan/00-installer-config.yaml
incus file push $NETPLAN_CONFIG $EDGE_NAME/etc/netplan/10-scionsui.yaml --mode 600
rm $NETPLAN_CONFIG
incus exec $EDGE_NAME -- netplan apply

# configure the appliance as an Edge
incus exec $EDGE_NAME -- mkdir /home/anapaya/.appliance-cli
#incus file push appliances.json $EDGE_NAME/home/anapaya/.appliance-cli/appliances.json
#incus file push context.json $EDGE_NAME/home/anapaya/.appliance-cli/context.json
#incus file push edge-config.json $EDGE_NAME/home/anapaya/edge-config.json

59 changes: 59 additions & 0 deletions support/start-ubuntu-instance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# starts a generic Ubuntu instance for use as a generic end point for SCION testing
# instance will be connected to the scionwan network for SCION connectivity via the Edge
# instance will be connected to the virbr0 network for private connectivity to the host and NAT'd Internet connectivity

#IPV6_ADDRESS="2605:6440:a002:44::4/64"
#IPV6_GATEWAY="2605:6440:a002:44::1/64"

if [ -z "${IPV6_ADDRESS}" ] ; then
echo "set IPV6_ADDRESS before proceeding"
exit -1
fi


if [ -z "${IPV6_GATEWAY}" ] ; then
echo "set IPV6_GATEWAY before proceeding"
exit -1
fi



INSTANCE_NAME=ubuntu

incus init images:ubuntu/24.04 $INSTANCE_NAME \
--vm

incus start $INSTANCE_NAME

sleep 20

incus config device add $INSTANCE_NAME eth0 nic nictype=bridged parent=virbr0
incus config device add $INSTANCE_NAME eth1 nic nictype=bridged parent=scionwan

NETPLAN_CONFIG=/tmp/scionsui-edge-netplan.$$

cat <<EOF > $NETPLAN_CONFIG
network:
version: 2
ethernets:
enp5s0:
dhcp4: true
enp6s0:
addresses:
- ${IPV6_ADDRESS}
routes:
- to: default
via: ${IPV6_GATEWAY}
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
- 2001:4860:4860::8888
- 2606:4700:4700::1111
EOF

incus exec $INSTANCE_NAME -- rm /etc/netplan/10-lxc.yaml
incus file push $NETPLAN_CONFIG $INSTANCE_NAME/etc/netplan/10-scionsui.yaml --mode 600
rm $NETPLAN_CONFIG
incus exec $INSTANCE_NAME -- netplan apply
incus exec $INSTANCE_NAME -- apt install apache2 -y