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

refactor: dns+dhcp to a module, support short host queries #427

Closed
wants to merge 1 commit into from

Conversation

vilvo
Copy link
Contributor

@vilvo vilvo commented Dec 21, 2023

Description of changes

  • Renaming module to dns-dhcp allows us to change the internal implementation
    of DNS and DHCP services from dnsmasq to something else, like rust-based,
    later
  • Current implementation stays dnsmasq-based but is only refactored into a
    module
  • Disable systemd resolved on client side VMs completely, including DNS stub
    listener on 127.0.0.53 which made the name queries time out before going
    to primary nameserver 192.168.100.1 in the net-vm. Also note that it is
    required to set resolve.enable to false - even when NixOS options document
    the default as false.
  • Give static IPs to guests based on their mimicked synthetic MAC
  • dhcp-option '6' equals 'option:dns-server'. More descriptive this way.
  • Client side queries are configured to use .ghaf domain for local name queries
  • Better not set debug subnet ip addresses in dnsmasq, because sometimes we are
    debugging the dnsmasq itself.
  • Add tshark network packet capturing tool for builds that include
    the ghaf debug profile

Considerations:

  • ghaf-host uses resolv.conf via DNS stub resolver. It does not use
    net-vm (192.168.100.1) as default nameserver. This is considered
    more secure than using net-vm. Future development could be
    debug optional that allows ghaf-host access to local network host
    names. This has risks related to development and testing time
    assumptions on ghaf-host access to names with release builds.
  • net-vm does not serve IP address for ghaf-host queries - even
    for debug builds. See rationale above.

Checklist for things done

  • Summary of the proposed changes in the PR description
  • More detailed description in the commit message(s)
  • Commits are squashed into relevant entities - avoid a lot of minimal dev time commits in the PR
  • Contribution guidelines followed
  • Ghaf documentation updated with the commit - https://tiiuae.github.io/ghaf/
  • PR linked to architecture documentation and requirement(s) (ticket id)
  • Test procedure described (or includes tests). Select one or more:
    • Tested on Lenovo X1 x86_64
    • Tested on Jetson Orin NX or AGX aarch64
    • Tested on Polarfire riscv64
  • Author has run nix flake check --accept-flake-config and it passes
  • All automatic Github Action checks pass - see actions
  • Author has added reviewers and removed PR draft status

Testing

[ghaf@gui-vm:~]$ time for host in net-vm chromium-vm gala-vm gui-vm \
> zathura-vm; do dig +short $host; done;
192.168.100.1
192.168.100.6
192.168.100.4
192.168.100.3
192.168.100.5

real	0m0.151s
user	0m0.029s
sys	0m0.031s

@vilvo vilvo temporarily deployed to internal-build-workflow December 21, 2023 10:35 — with GitHub Actions Inactive
@vilvo

This comment was marked as resolved.

@jpruiz84
Copy link
Contributor

Today I had a routing problem in Ghaf, because my default internet router subnet is 192.168.101.0/24.

[ghaf@net-vm:~]$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         net-vm          0.0.0.0         UG    1025   0        0 wlp0s4f0
192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 ethint0
192.168.101.0   0.0.0.0         255.255.255.0   U     0      0        0 ethint0
192.168.101.0   0.0.0.0         255.255.255.0   U     1025   0        0 wlp0s4f0
net-vm          0.0.0.0         255.255.255.255 UH    1025   0        0 wlp0s4f0

The problem was that the net-vm was not able to ping my laptop because the default route in that case was through ethint0 and not to wlp0s4f0.

The solution in my case was simple, change the subnet in my Internet router to 192.168.110.0. But, many user could have a similar problem if their Internet routers subnet are 192.168.100.0 or 192.168.101.0. I think that the subnet managed by the net-vm should be one less popular, such as 192.168.170.0/

@riskuuse
Copy link
Contributor

@riskuuse - requesting early review comments to this draft One key change here is also (difficult to notice in diff):

- domain-needed = true;
+ domain-needed = false;

which removes the need to use the domain ghaf with internal name queries (e.g. gui-vm.ghaf). The primary DNS as internal (192.168.101.1) ensures that queries do not leave outside.

My tests on X1 indicates that currently VM's don't resolve to any name, with .ghaf or without. Investigating...

@vilvo

This comment was marked as outdated.

@vilvo vilvo temporarily deployed to internal-build-workflow December 22, 2023 09:03 — with GitHub Actions Inactive
@vilvo vilvo temporarily deployed to internal-build-workflow January 9, 2024 06:34 — with GitHub Actions Inactive
@vilvo vilvo temporarily deployed to internal-build-workflow January 9, 2024 07:06 — with GitHub Actions Inactive
@vilvo vilvo temporarily deployed to internal-build-workflow January 9, 2024 09:02 — with GitHub Actions Inactive
@vilvo vilvo temporarily deployed to internal-build-workflow January 9, 2024 15:19 — with GitHub Actions Inactive
@vilvo vilvo temporarily deployed to internal-build-workflow January 10, 2024 09:13 — with GitHub Actions Inactive
@vilvo vilvo temporarily deployed to internal-build-workflow January 10, 2024 09:18 — with GitHub Actions Inactive
@vilvo vilvo changed the title refactor: dns+dhcp to a module refactor: dns+dhcp to a module, support short host queries Jan 10, 2024
@vilvo vilvo temporarily deployed to internal-build-workflow January 10, 2024 09:27 — with GitHub Actions Inactive
@vilvo vilvo temporarily deployed to internal-build-workflow January 10, 2024 11:41 — with GitHub Actions Inactive
@vilvo vilvo temporarily deployed to internal-build-workflow January 10, 2024 11:48 — with GitHub Actions Inactive
@vilvo vilvo mentioned this pull request Apr 29, 2024
13 tasks
vilvo added a commit to vilvo/ghaf that referenced this pull request Apr 29, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
vilvo added a commit to vilvo/ghaf that referenced this pull request Apr 29, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
vilvo added a commit to vilvo/ghaf that referenced this pull request Apr 29, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
vilvo added a commit to vilvo/ghaf that referenced this pull request Apr 29, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
vilvo added a commit to vilvo/ghaf that referenced this pull request Apr 30, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427
* removes dnsmasq and dhcp from net-vm to other guests
  * WIP: static IPs not assigned to other guests yet

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
@vilvo vilvo mentioned this pull request Apr 30, 2024
13 tasks
tervis-unikie pushed a commit to tiiuae/dev-team-sandbox that referenced this pull request May 3, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427
* removes dnsmasq and dhcp from net-vm to other guests
  * WIP: static IPs not assigned to other guests yet

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
tervis-unikie pushed a commit to tiiuae/dev-team-sandbox that referenced this pull request May 10, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427
* removes dnsmasq and dhcp from net-vm to other guests
  * WIP: static IPs not assigned to other guests yet

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
tervis-unikie pushed a commit to tiiuae/dev-team-sandbox that referenced this pull request May 14, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427
* removes dnsmasq and dhcp from net-vm to other guests
  * WIP: static IPs not assigned to other guests yet

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
tervis-unikie pushed a commit to tiiuae/dev-team-sandbox that referenced this pull request May 20, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427
* removes dnsmasq and dhcp from net-vm to other guests
  * WIP: static IPs not assigned to other guests yet

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
tervis-unikie pushed a commit to tiiuae/dev-team-sandbox that referenced this pull request May 20, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427
* removes dnsmasq and dhcp from net-vm to other guests
  * WIP: static IPs not assigned to other guests yet

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
tervis-unikie pushed a commit to tiiuae/dev-team-sandbox that referenced this pull request May 27, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427
* removes dnsmasq and dhcp from net-vm to other guests
  * WIP: static IPs not assigned to other guests yet

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
tervis-unikie pushed a commit to tiiuae/dev-team-sandbox that referenced this pull request May 28, 2024
* based on decisions to use static names over internal DNS
  tiiuae#427
* removes dnsmasq and dhcp from net-vm to other guests
  * WIP: static IPs not assigned to other guests yet

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
tervis-unikie added a commit to tiiuae/dev-team-sandbox that referenced this pull request May 28, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
tervis-unikie added a commit to tiiuae/dev-team-sandbox that referenced this pull request May 29, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
tervis-unikie added a commit to tiiuae/dev-team-sandbox that referenced this pull request Jun 2, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
tervis-unikie added a commit to tiiuae/dev-team-sandbox that referenced this pull request Jun 3, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
vilvo added a commit to tiiuae/dev-team-sandbox that referenced this pull request Jun 4, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
tervis-unikie added a commit to tiiuae/dev-team-sandbox that referenced this pull request Jun 4, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
vilvo added a commit to tiiuae/dev-team-sandbox that referenced this pull request Jun 4, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
tervis-unikie added a commit to tiiuae/dev-team-sandbox that referenced this pull request Jun 4, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
tervis-unikie added a commit to tiiuae/dev-team-sandbox that referenced this pull request Jun 5, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
tervis-unikie added a commit to tiiuae/dev-team-sandbox that referenced this pull request Jun 6, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
brianmcgillion pushed a commit that referenced this pull request Jun 7, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  #427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
brianmcgillion pushed a commit that referenced this pull request Jun 7, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  #427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
brianmcgillion pushed a commit that referenced this pull request Jun 7, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  #427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
tervis-unikie added a commit to tiiuae/dev-team-sandbox that referenced this pull request Jun 7, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
tervis-unikie added a commit to tiiuae/dev-team-sandbox that referenced this pull request Jun 7, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  tiiuae#427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
brianmcgillion pushed a commit that referenced this pull request Jun 7, 2024
* Set static IPs and names for all vms
* Based on decisions to use static IPs/names over internal DNS and DHCP
  #427
* Removes dnsmasq and dhcp from net-vm to other guests

Signed-off-by: Ville Ilvonen <ville.ilvonen@unikie.com>
Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
Co-authored-by: Tero Tervala <tero.tervala@unikie.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tested on Lenovo X1 Carbon This PR has been tested on Lenovo X1 Carbon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants