Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

networking: module for static names #580

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/common/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
./version
./virtualization/docker.nix
./systemd
./networking
];
}
7 changes: 7 additions & 0 deletions modules/common/networking/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{
imports = [
./hosts.nix
];
}
21 changes: 21 additions & 0 deletions modules/common/networking/hosts.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0
{lib, ...}: {
environment.etc.hosts = lib.mkForce {
# please note that .100. network is not
# reachable from ghaf-host. It's only reachable
# guest-to-guest. Use to .101. (debug) to access
# guests from host (no names)
text = ''
127.0.0.1 localhost
192.168.100.1 net-vm
192.168.100.2 log-vm
192.168.100.3 gala-vm
192.168.100.4 chromium-vm
192.168.100.5 zathura-vm
192.168.100.6 element-vm
192.168.100.7 gui-vm
'';
mode = "0444";
};
}
24 changes: 1 addition & 23 deletions modules/microvm/virtualization/microvm/netvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,7 @@
# Add simple wi-fi connection helper
environment.systemPackages = lib.mkIf config.ghaf.profiles.debug.enable [pkgs.wifi-connector];

# Dnsmasq is used as a DHCP/DNS server inside the NetVM
services.dnsmasq = {
enable = true;
resolveLocalQueries = true;
settings = {
server = ["8.8.8.8"];
dhcp-range = ["192.168.100.2,192.168.100.254"];
dhcp-sequential-ip = true;
dhcp-authoritative = true;
domain = "ghaf";
listen-address = ["127.0.0.1,192.168.100.1"];
dhcp-option = [
"option:router,192.168.100.1"
"6,192.168.100.1"
];
expand-hosts = true;
domain-needed = true;
bogus-priv = true;
};
};

# Disable resolved since we are using Dnsmasq
services.resolved.enable = false;
services.resolved.enable = true;

systemd.network = {
enable = true;
Expand Down