summaryrefslogtreecommitdiff
path: root/simple
diff options
context:
space:
mode:
authordautor <karlo98.m@gmail.com>2024-11-15 13:47:50 +0100
committerdautor <karlo98.m@gmail.com>2024-11-16 14:25:00 +0100
commitbdd2396d19f5465ecaac3195deeceef29a867d52 (patch)
tree2dbe4c83c833ef8b8bfe1473fda3a028136b4299 /simple
Create example structure and add 2 examples
Diffstat (limited to 'simple')
-rw-r--r--simple/0/conf20
-rw-r--r--simple/0/root/etc/rc.conf6
-rw-r--r--simple/0/root/etc/resolv.conf1
-rw-r--r--simple/1/conf19
-rw-r--r--simple/1/root/etc/rc.conf5
-rw-r--r--simple/1/root/etc/resolv.conf1
-rwxr-xr-xsimple/start.sh16
-rwxr-xr-xsimple/stop.sh9
8 files changed, 77 insertions, 0 deletions
diff --git a/simple/0/conf b/simple/0/conf
new file mode 100644
index 0000000..bc8c79b
--- /dev/null
+++ b/simple/0/conf
@@ -0,0 +1,20 @@
+{
+ module: sf.jail
+ configuration: {
+ interfaces: {
+ eth0 { type: eiface }
+ eth1 { type: eiface }
+ eth2 { type: steal, interface: re0 }
+ }
+ filesystem: {
+ layers: [
+ simple/0/root
+ /tmp/lamina.dns
+ /tmp/lamina.machine
+ /lab/jail/base/14.1-RELEASE
+ ]
+ }
+ init: [ sh, /etc/rc ]
+ shutdown: [ sh, /etc/rc.shutdown ]
+ }
+}
diff --git a/simple/0/root/etc/rc.conf b/simple/0/root/etc/rc.conf
new file mode 100644
index 0000000..d7ef5ce
--- /dev/null
+++ b/simple/0/root/etc/rc.conf
@@ -0,0 +1,6 @@
+hostname="test-0"
+sshd_enable="YES"
+ifconfig_eth0="inet 10.1.0.2/24 up"
+ifconfig_eth1="inet 10.2.0.2/24 up"
+ifconfig_eth2="inet 10.0.1.2/24 up"
+defaultrouter="10.0.1.1"
diff --git a/simple/0/root/etc/resolv.conf b/simple/0/root/etc/resolv.conf
new file mode 100644
index 0000000..35fb6f9
--- /dev/null
+++ b/simple/0/root/etc/resolv.conf
@@ -0,0 +1 @@
+nameserver 1.0.0.1
diff --git a/simple/1/conf b/simple/1/conf
new file mode 100644
index 0000000..59baa29
--- /dev/null
+++ b/simple/1/conf
@@ -0,0 +1,19 @@
+{
+ module: sf.jail
+ configuration: {
+ interfaces: {
+ eth0 { type: eiface }
+ eth1 { type: eiface }
+ }
+ filesystem: {
+ layers: [
+ simple/1/root
+ /tmp/lamina.machine
+ /lab/jail/base/14.1-RELEASE
+ ]
+ devfs: 5
+ }
+ init: [ echo, custom init command ]
+ shutdown: [ echo, custom shutdown command ]
+ }
+}
diff --git a/simple/1/root/etc/rc.conf b/simple/1/root/etc/rc.conf
new file mode 100644
index 0000000..6dedadd
--- /dev/null
+++ b/simple/1/root/etc/rc.conf
@@ -0,0 +1,5 @@
+hostname="test-1"
+sshd_enable="YES"
+ifconfig_eth0="inet 10.1.0.3/24 up"
+ifconfig_eth1="inet 10.2.0.3/24 up"
+defaultrouter="10.2.0.1"
diff --git a/simple/1/root/etc/resolv.conf b/simple/1/root/etc/resolv.conf
new file mode 100644
index 0000000..35fb6f9
--- /dev/null
+++ b/simple/1/root/etc/resolv.conf
@@ -0,0 +1 @@
+nameserver 1.0.0.1
diff --git a/simple/start.sh b/simple/start.sh
new file mode 100755
index 0000000..535c005
--- /dev/null
+++ b/simple/start.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -e
+. layer-recipes/util.sh
+require-layer machine
+require-layer dns
+
+export SF_PATH=run
+
+sf.base node start bridge0 '{ module: sf.bridge, configuration: {} }'
+sf.base node start sf_net '{ module: sf.eiface, configuration: { inet: "10.2.0.1/24" } }'
+sf.base link start l0 sf_net '' bridge0 link0
+sf.base node start j0 "$(cat simple/0/conf)"
+sf.base node start j1 "$(cat simple/1/conf)"
+sf.base link start l1 j0 eth0 j1 eth0
+sf.base link start l2 j0 eth1 bridge0 link1
+sf.base link start l3 j1 eth1 bridge0 link2
diff --git a/simple/stop.sh b/simple/stop.sh
new file mode 100755
index 0000000..4d6c435
--- /dev/null
+++ b/simple/stop.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+
+export SF_PATH=run
+
+sf.base node stop j0
+sf.base node stop j1
+sf.base node stop sf_net
+sf.base node stop bridge0