Use statically-generated mac addresses.
This commit is contained in:
parent
e43fa0eab3
commit
310837ddb3
@ -38,6 +38,8 @@ function start_vm {
|
|||||||
bridge_name="bridge_${host_interface_name}"
|
bridge_name="bridge_${host_interface_name}"
|
||||||
ip_range="$5"
|
ip_range="$5"
|
||||||
|
|
||||||
|
mac_address=$(calculate_mac_address "$name")
|
||||||
|
|
||||||
assert_bridge "$host_interface_name" "$bridge_name" "$ip_range"
|
assert_bridge "$host_interface_name" "$bridge_name" "$ip_range"
|
||||||
bridge_link_name=$(detect_available_link "${bridge_name}")
|
bridge_link_name=$(detect_available_link "${bridge_name}")
|
||||||
|
|
||||||
@ -60,7 +62,8 @@ function start_vm {
|
|||||||
-H \
|
-H \
|
||||||
-s 0,hostbridge \
|
-s 0,hostbridge \
|
||||||
-s "4,nvme,/dev/zvol/${zfs_path}/disk0" \
|
-s "4,nvme,/dev/zvol/${zfs_path}/disk0" \
|
||||||
-s "2:0,virtio-net,netgraph,path=${bridge_name}:,peerhook=${bridge_link_name}" \
|
-s "2:0,virtio-net,netgraph,path=${bridge_name}:,peerhook=${bridge_link_name},mac=${mac_address}" \
|
||||||
|
-s 3,ahci-cd,/vm/.iso/archlinux-2023.04.01-x86_64.iso \
|
||||||
-s 29,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080 \
|
-s 29,fbuf,tcp=0.0.0.0:5900,w=1920,h=1080 \
|
||||||
-s 30,xhci,tablet \
|
-s 30,xhci,tablet \
|
||||||
-s 31,lpc -l com1,stdio \
|
-s 31,lpc -l com1,stdio \
|
||||||
@ -129,5 +132,11 @@ function ng_exists {
|
|||||||
ngctl status "${1}" >/dev/null 2>&1
|
ngctl status "${1}" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function calculate_mac_address {
|
||||||
|
name="$1"
|
||||||
|
source=$(md5 -r -s "$name" | awk '{print $1}')
|
||||||
|
echo "${source:0:2}:${source:2:2}:${source:4:2}:${source:6:2}:${source:8:2}:${source:10:2}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
main "${@}"
|
main "${@}"
|
||||||
|
@ -6,12 +6,18 @@
|
|||||||
"subnet4": [
|
"subnet4": [
|
||||||
{
|
{
|
||||||
"subnet": "10.215.1.0/24",
|
"subnet": "10.215.1.0/24",
|
||||||
"pools": [ { "pool": "10.215.1.10-10.215.1.250" } ],
|
"pools": [ { "pool": "10.215.1.10-10.215.1.200" } ],
|
||||||
"option-data": [
|
"option-data": [
|
||||||
{
|
{
|
||||||
"name": "routers",
|
"name": "routers",
|
||||||
"data": "10.215.1.1"
|
"data": "10.215.1.1"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"reservations": [
|
||||||
|
{
|
||||||
|
"hw-address": "d6:19:4c:68:fc:c7",
|
||||||
|
"ip-address": "10.215.1.201"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user