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

Auto-provisioning of DNS servers for SR Linux #1638

Closed
hellt opened this issue Oct 12, 2023 · 4 comments
Closed

Auto-provisioning of DNS servers for SR Linux #1638

hellt opened this issue Oct 12, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@hellt
Copy link
Member

hellt commented Oct 12, 2023

SR Linux management is a separate network namespace which doesn't share the DNS of the root netns setup by docker.

Because of that, users who want to get internet/external access from the management (or any other) net-inst have to configure DNS manually.

We can improve this a bit by

  1. figuring out which DNS servers are configured on the host
  2. adding these dns entries in the SRL config template

This will remove one of the tedious workflows of adding DNS servers manually, because often you can't just add 1.1.1.1 or 8.8.4.4 and you need to use the DNS servers of the cloud environment your VM is on.

finding DNS addresses

It all starts with DNS addresses. They can be found in /etc/resolv.conf for older systems and in sudo resolvectl status <interface> on newer distros.
We have to check both and add addresses from both if both exist.

To find which interface DNS addresses to use we should use rtnetlink and finding a route to 8.8.8.8 and the interface that is returned for this addr.

Configuring DNS entries

image
@hellt hellt added the enhancement New feature or request label Oct 12, 2023
@steiler
Copy link
Collaborator

steiler commented Oct 16, 2023

According to this documentation: https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers/
Which I verified on my system. We can also refere to /run/systemd/resolve/resolv.conf on systemd machines.
This file is the same format as the /etc/resolve.conf but created by systemd. For detail refere to the above link.

@hellt
Copy link
Member Author

hellt commented Oct 16, 2023

Do you mean to use this file to read which DNS servers are configured in the system to populate it in the srl config?

@steiler
Copy link
Collaborator

steiler commented Oct 16, 2023

yes. We do not need to run any route lookup or anything, just take the two files, extract the ip from the nameserver <ip> lines and we're all good. Take a look at above PR.

@jbemmel
Copy link
Contributor

jbemmel commented Oct 17, 2023

This feature needs to be controlled by a flag to enable/disable, as it introduces non-idempotence and gotcha's.

I would argue the default should be 'disable', with the option to add a flag in the topology to enable auto-dns

@hellt hellt closed this as completed Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants