From nobody Sat Sep 10 08:52:01 2022 X-Original-To: virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MPmnf09C2z4bVfH; Sat, 10 Sep 2022 08:52:06 +0000 (UTC) (envelope-from mad@madpilot.net) Received: from mail.madpilot.net (vogon.madpilot.net [159.69.1.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4MPmnd2yskz3RBM; Sat, 10 Sep 2022 08:52:05 +0000 (UTC) (envelope-from mad@madpilot.net) Received: from mail (mail [192.168.254.3]) by mail.madpilot.net (Postfix) with ESMTP id 4MPmnc297Fz6fh9; Sat, 10 Sep 2022 10:52:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=madpilot.net; h= content-transfer-encoding:content-type:content-type:subject :subject:from:from:content-language:date:date:message-id :received; s=bjowvop61wgh; t=1662799922; x=1664614323; bh=Ru6b0d siLFPp9Ugh9NWblJAub9gFrwagtR20i4OK6Wk=; b=A5r6Or5NHvZwSy7JeTY1+P EWR2ruwgv893DMXnG+5EaN5JhneedYROfTHYZ94jnQnMgsCdHjiMBzcM0260FXdh USY6vYptAGRR5iF5kF6NTgTDwHJ/ys67VWhrTxtVrHd9XCmK2j4KYJWSnb2Dz187 OIdyvwNLTetDzh3RGk5drDHF5CyP4nEhaT7IKh61nTLhvQVsW7R8GLGqdELjQE/B I3VltP2Q4MPRUucOvUQTa6KdQ7FiSoLIeENfoNfP6Ql5HFnj7pgAiE0BHiBm2Cb9 X36+XK4d2iDYNGlu+vRT6ZJe0bJjZ+8zy6/kVTfQwNmUurOcfZuXZcg10cpSDEIg == Received: from mail.madpilot.net ([192.168.254.3]) by mail (mail.madpilot.net [192.168.254.3]) (amavisd-new, port 10026) with ESMTP id za6VcjTotUbD; Sat, 10 Sep 2022 10:52:02 +0200 (CEST) Message-ID: Date: Sat, 10 Sep 2022 10:52:01 +0200 To: freebsd-hackers@freebsd.org, virtualization@FreeBSD.org Content-Language: en-US From: Guido Falsi Subject: Dynamic hostname in rc.conf (for bhyve VMs) Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4MPmnd2yskz3RBM X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=madpilot.net header.s=bjowvop61wgh header.b=A5r6Or5N; dmarc=pass (policy=quarantine) header.from=madpilot.net; spf=pass (mx1.freebsd.org: domain of mad@madpilot.net designates 159.69.1.99 as permitted sender) smtp.mailfrom=mad@madpilot.net X-Spamd-Result: default: False [-1.46 / 15.00]; MISSING_MIME_VERSION(2.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; DMARC_POLICY_ALLOW(-0.50)[madpilot.net,quarantine]; NEURAL_HAM_LONG(-0.46)[-0.463]; R_SPF_ALLOW(-0.20)[+mx:c]; R_DKIM_ALLOW(-0.20)[madpilot.net:s=bjowvop61wgh]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org,virtualization@FreeBSD.org]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[madpilot.net:+]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_NONE(0.00)[]; ASN(0.00)[asn:24940, ipnet:159.69.0.0/16, country:DE]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org Hi, Since rc.conf is just a shell script I'd like to be able to set hostname dynamically. This is bhyve related because what I'd like to do is pass an hostname to VMs via the -e option to bhyveload(8), and then read it in rc.conf, maybe via sysctl to set the hostname accordingly. By the way I'm using vm-bhyve [1] to manage my VMs. its configuration files are also shell scripts, so I was planning to hack some simple logic there, host side, to derive the hostname from filesystem (useful for cloned VMs). Could not find any example or documentation about any step of this. Is this even possible with current tools? I'm open to hacky solutions to start with, then maybe refine them. I'm trying to do this because I'm using a local dnsmasq that exposes DNS with the hostnames provided by VMs, but clones get the same naem as the machien they're cloned from and mask those in this small internal DNS. If each clone could provide it's different name it would be much better. Thanks in advance for any help/suggestions. [1] https://github.com/churchers/vm-bhyve -- Guido Falsi