Add initial version of template files

master
LEdoian 3 years ago
parent 82905c2b20
commit c0f9174ab6

@ -0,0 +1,29 @@
log syslog all;
debug protocols all;
router id 172.23.100.{{c.num}};
protocol device { }
protocol direct { disabled; }
protocol kernel {
ipv4 {
preference 100;
import none;
export all;
};
}
protocol ospf v3 {
ipv4 {
preference 10;
import all;
export all;
};
area 0 {
{% for br in c.bridges %}
interface "net_{{br.num}}" {
cost 10;
type broadcast;
};
{% endfor %}
};
}

@ -0,0 +1,19 @@
auto lo
iface lo inet loopback
{# auto {% for x in range(len(c.bridges)) %} eth{{x}} {% endfor %} #}
auto /eth*
mapping eth*
script TODO/get-mac-address.sh
{% for br in c.bridges %}
map 52:54:00:17:{{ '%02x:%02x' % (c.num, br.num) }} net_{{br.num}}
{% endfor %}
{% for br in c.bridges %}
iface net_{{br.num}} inet static
address 172.23.{{ br.num }}.{{ c.num }}/24
{% endfor %}

@ -0,0 +1,46 @@
#!/bin/bash
# This is my QEMU starting script, copied over and over.
set -euo pipefail
# KNOWN BUG: We cannot override options from command line
# -> Easy fix would be to disallow spaces OR single quotes in options, but IMHO not worth
CONFIG='
# Basics:
name {{ c.name }}
m 20M
{# enable-kvm #}
# Boot drive (BIOS)
drive media=disk,file=./disk.img,format=raw
# Monitor on dedicated socket
monitor unix:./monitor.sock,server,nowait
spice unix=on,addr=./spice.sock,disable-copy-paste=on,seamless-migration=off,disable-ticketing=on
display none # Already handled by SPICE
# NIC: attach to bridges:
{% for br in c.bridges %}
nic bridge,br={{ br.name }},model=virtio-net-pci,mac=52:54:00:17:{{ '%02x%02x' % (c.num, br.num) }}
{% endfor %}
'
strip() {
sed -e '
s/^[ ]*//
s/[ ]*$//
s/[ ]*#.*$//
/^$/d
'
}
# Now QEMU is in foreground
strip <<<"$CONFIG" | while read option params; do echo "-$option"; test -n "$params" && echo "$params"; done | xargs qemu-system-x86_64 "$@"
Loading…
Cancel
Save