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

Static DNS HLD #1262

Merged
merged 2 commits into from
Mar 29, 2023
Merged

Static DNS HLD #1262

merged 2 commits into from
Mar 29, 2023

Conversation

oleksandrivantsiv
Copy link
Contributor

@oleksandrivantsiv oleksandrivantsiv commented Feb 15, 2023

The access to the DNS in SONiC is organized via the resolver configuration file (/etc/resolv.conf). resolv.conf is the plain text file that contains the human-readable configuration. It is used across various subsystems in the SONiC to translate domain names into IP addresses.

With the current implementation dynamic DNS configuration can be received from the DHCP server or static configuration can be set manually by the user. However, SONiC doesn't provide any protection for the static configuration. The configuration that is set by the user can be overwritten with the dynamic configuration at any time.

The proposed solution is to add support for static DNS configuration into Config DB. To be able to choose between dynamic and static DNS configurations resolvconf package.

PR title State Status Dependencies Unitest Owner Included in 202305
[DNS] yang model for static DNS GitHub issue/pull request detail checkers passed N/A added @oleksandrivantsiv no
[dns] Add support for static DNS configuration. GitHub issue/pull request detail checkers passed N/A added @oleksandrivantsiv no
[dns] Implement config and show commands for static DNS. GitHub issue/pull request detail checkers passed sonic-net/sonic-buildimage#14239 added @oleksandrivantsiv no
[hostcfgd][dns] Subscribe to DNS_NAMESERVER table to react to static DNS configuration changes. GitHub issue/pull request detail checkers passed sonic-net/sonic-buildimage#14239 added @oleksandrivantsiv no
Update static DNS HLD with minigraph changes GitHub issue/pull request detail checkers passed #1322 added @oleksandrivantsiv no
Add Static DNS test plan GitHub issue/pull request detail checkers passed N/A added @nhe-NV no
Add static DNS test cases GitHub issue/pull request detail checkers failed N/A added @nhe-NV no

@ganglyu
Copy link
Contributor

ganglyu commented Mar 21, 2023

Hi @oleksandrivantsiv
This solution can be used to fix our production issue. We found some Mellanox device with wrong DNS configuration:
user@sonic:~$ cat /etc/resolv.conf
domain ztgroup.com
search ztgroup.com
nameserver 10.1.90.130
nameserver 10.1.90.101

@ganglyu
Copy link
Contributor

ganglyu commented Mar 21, 2023

@oleksandrivantsiv
Can we use minigraph.py to generate static DNS configuration for internal image?
Because TOR assembly vendor is using internal image, if we use minigraph.py to generate static DNS configuration, how can they modify DNS configuration? Maybe they can use CLI to remove static DNS configuration?

@oleksandrivantsiv
Copy link
Contributor Author

@oleksandrivantsiv Can we use minigraph.py to generate static DNS configuration for internal image? Because TOR assembly vendor is using internal image, if we use minigraph.py to generate static DNS configuration, how can they modify DNS configuration? Maybe they can use CLI to remove static DNS configuration?

@ganglyu I didn't add support for static DNS configuration into minigraph.py, but it is something we can do.
It is possible to use CLI to manipulate with DNS configuration. We will have add, remove, and show commands

@oleksandrivantsiv
Copy link
Contributor Author

@ganglyu can we update the minigraph.py in the second stage? The available changes are completely independent of the minigrapth and can be pushed independently. We will prioritize this for Apr.

@ganglyu
Copy link
Contributor

ganglyu commented Mar 27, 2023

@ganglyu can we update the minigraph.py in the second stage? The available changes are completely independent of the minigrapth and can be pushed independently. We will prioritize this for Apr.

sure

@oleksandrivantsiv
Copy link
Contributor Author

@ganglyu can we update the minigraph.py in the second stage? The available changes are completely independent of the minigrapth and can be pushed independently. We will prioritize this for Apr.

sure

@ganglyu can you please approve this PR if you are ok with the proposed design? I'll open another PR with the minigrapth related changes.

@liat-grozovik liat-grozovik merged commit 13a97bd into sonic-net:master Mar 29, 2023
liat-grozovik pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jun 22, 2023
- Why I did it
Add support for static DNS configuration. According to sonic-net/SONiC#1262 HLD.

- How I did it
Add a new resolv-config.service that is responsible for transferring configuration from Config DB into /etc/resolv.conf file that is consumed by various subsystems in Linux to resolve domain names into IP addresses.

- How to verify it
Run the image compilation. Each component related to the static DNS feature is covered with the unit tests.
Run sonic-mgmt tests. Static DNS feature will be covered with the system tests.
Install the image and run manual tests.
liat-grozovik pushed a commit to sonic-net/sonic-host-services that referenced this pull request Jun 22, 2023
…DNS configuration changes. (#49)

Changes are implemented according to sonic-net/SONiC#1262 HLD.
Implement unit tests for each method of DnsCfg class.
liat-grozovik pushed a commit to sonic-net/sonic-utilities that referenced this pull request Jun 25, 2023
- What I did
Implement config and show commands for static DNS feature. According to sonic-net/SONiC#1262 HLD.

- How I did it
Static DNS config commands are implemented in the new config/dns.py file. DNS config commands are available under config dns ... sub-command.
Show commands are implemented in the new show/dns.py file. DNS show commands are available under show dns ... sub-command.

- How to verify it
Compile sonic-utilities package. The unit tests will run automatically during the compilation.
Coverage for config/dns.py : 94%
Coverage for show/dns.py : 86%

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)
# config dns nameserver add 1.1.1.1
# config dns nameserver add 8.8.8.8
# show dns nameserver
  Nameserver
------------
     1.1.1.1
     8.8.8.8
pdhruv-marvell pushed a commit to pdhruv-marvell/sonic-utilities that referenced this pull request Aug 23, 2023
)

- What I did
Implement config and show commands for static DNS feature. According to sonic-net/SONiC#1262 HLD.

- How I did it
Static DNS config commands are implemented in the new config/dns.py file. DNS config commands are available under config dns ... sub-command.
Show commands are implemented in the new show/dns.py file. DNS show commands are available under show dns ... sub-command.

- How to verify it
Compile sonic-utilities package. The unit tests will run automatically during the compilation.
Coverage for config/dns.py : 94%
Coverage for show/dns.py : 86%

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)
# config dns nameserver add 1.1.1.1
# config dns nameserver add 8.8.8.8
# show dns nameserver
  Nameserver
------------
     1.1.1.1
     8.8.8.8
@StormLiangMS
Copy link
Contributor

@oleksandrivantsiv new feature, pls wait for next branch cut.

sonic-otn pushed a commit to sonic-otn/sonic-buildimage that referenced this pull request Sep 20, 2023
- Why I did it
Add support for static DNS configuration. According to sonic-net/SONiC#1262 HLD.

- How I did it
Add a new resolv-config.service that is responsible for transferring configuration from Config DB into /etc/resolv.conf file that is consumed by various subsystems in Linux to resolve domain names into IP addresses.

- How to verify it
Run the image compilation. Each component related to the static DNS feature is covered with the unit tests.
Run sonic-mgmt tests. Static DNS feature will be covered with the system tests.
Install the image and run manual tests.
@skg-net
Copy link
Member

skg-net commented Feb 5, 2024

@oleksandrivantsiv Can you please update the Quality Metric (Alpha/Beta/GA) for the feature either in this PR comments or in HLD itself based on https://github.com/sonic-net/SONiC/blob/master/doc/SONiC%20feature%20quality%20definition.md
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants