A simple, powerful CLI tool to spin up OpenIndiana virtual machines with QEMU

Add MAC address generation for network device in QEMU setup

Changed files
+18 -1
+16
network.ts
··· 102 102 103 103 await setupQemuBridge(bridgeName); 104 104 } 105 + 106 + export function generateRandomMacAddress(): string { 107 + const hexDigits = "0123456789ABCDEF"; 108 + let macAddress = "52:54:00"; 109 + 110 + for (let i = 0; i < 3; i++) { 111 + macAddress += ":"; 112 + for (let j = 0; j < 2; j++) { 113 + macAddress += hexDigits.charAt( 114 + Math.floor(Math.random() * hexDigits.length), 115 + ); 116 + } 117 + } 118 + 119 + return macAddress; 120 + }
+2 -1
utils.ts
··· 1 1 import chalk from "chalk"; 2 2 import _ from "lodash"; 3 + import { generateRandomMacAddress } from "./network.ts"; 3 4 4 5 const DEFAULT_VERSION = "20251026"; 5 6 ··· 105 106 ? `bridge,id=net0,br=${options.bridge}` 106 107 : "user,id=net0,hostfwd=tcp::2222-:22", 107 108 "-device", 108 - "e1000,netdev=net0", 109 + `e1000,netdev=net0,mac=${generateRandomMacAddress()}`, 109 110 "-nographic", 110 111 "-monitor", 111 112 "none",