-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[SNMP]: Fix SNMP mgmt reachability when mgmt IP is obtained via DHCP #16237
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
dockers/docker-snmp/snmpd.conf.j2
Outdated
@@ -29,25 +29,23 @@ | |||
agentAddress {{ protocol(agentip) }}:[{{ agentip }}]{% if port %}:{{ port }}{% endif %}{% if vrf %}%{{ vrf }}{% endif %}{{ "" }} | |||
{% endfor %} | |||
{% elif NAMESPACE_COUNT is not defined or NAMESPACE_COUNT|int <= 1 %} | |||
{% if MGMT_INTERFACE is defined %} | |||
{% if MGMT_INTERFACE is defined and LOOPBACK_INTERFACE is defined %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check will ensure that if mgmt interface and loopback interface both defined, the agentip will be populated. Is this a temporary work around? Can't we control this agentIP using a specific configuration knob in config_db.json rather than having some arbitrary checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could populate the SNMP_AGENT_ADDRESS table in config_db and if that is available in config_db that will be used.
This condition is to specifically use if we do not have any AGENT_ADDRESS configuration.
The main issue is that if we listen on any IP, then snmp IPv6 will not work.
Having specific IP configured as agentaddress is to solve this baseline ipv6 issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue here is the design enforces the user to configure both mgmt ip table and loopback interface table together in order to generate the agentIP and overcome this issue.
There can be deployments without mgmt ip table or loopback interface. So this will be a problem there. The solution needs to be generic.
There is no logical reason to depend on mgmt interface or loopback interface to generate agentip. In my opinion, if we have a configuration option, the user should use it. Generating it implicitly or only in certain conditions seems to be a hack and the user might not be aware of the implications. @qiluo-msft please comment your feedback here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have plan to update SNMP_AGENT_ADDRESS table when loading configuration from minigraph.
But again, plan is to populate SNMP_AGENT_ADDRESS table with Mgmt and Loopback IP from minigraph and use that in snmpd.conf.
This could be overridden with new configuration as chosen by updating SNMP_AGENT_ADDRESS in config_db.json or using CLI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check will ensure that if mgmt interface and loopback interface both defined, the agentip will be populated. Is this a temporary work around? Can't we control this agentIP using a specific configuration knob in config_db.json rather than having some arbitrary checks?
not sure how using SNMP_AGENT_ADDRESS will work ? Do we know DHCP will provide the IP address by the time SNMP starts ? For DHCP Based IP assignment and SNMP to work it would need to listen to 0.0.0.0 for v4 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question too. However I don't think the solution should be an arbitrary check where if both mgmt and loopback are configured, then we add agentIP to the snmpd.conf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above changes have made sure for v4/v6:
1> First use SNMP_AGENT_ADDRESS_CONFIG
2> if both MGMT and LOOPBACK then use them
3> else use catch all 0.0.0.0 / ::/0 ==> FOR DHCP case
Above change will make sure for v4 works for all scenarios and for v6 DHCP base SNMP will not work because of the issue as define here: net-snmp/net-snmp#630
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgsudharsan @moshemos Is it possible to add support in SNMP to listen to changes in mgmt ip obtaining from DHCP and restart if there is any change? Is there any SONiC table that gets change in mgmt IP due to DHCP?
in single asic platform. Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
Hi @SuvarnaMeenakshi is sees that checker fail can you takes a look? |
Why I did it
fixes #16165
#15487 made changes to ensure that SNMP works over IPv6 mgmt and loopback if snmpagentaddress configuration is not present in config_db. This change checks for MGMT_INTERFACE and LOOPBACK_INTERFACE tables in config_db and snmpd starts to listen on those IPs.
With this change, if MGMT_INTERFACE is not present in config_db and is configured via DHCP, snmpd will start to listen only on Loopback0 IP. So snmp query over DHCP configured mgmt IP does not work.
Work item tracking
24914478
How I did it
Check if both Loopback and MGMT interface configurations are present in config_db to be used as snmpagentaddress. If both are not present, fall to listening on any IP.
new logic:
For single-asic platform:
Caveat: If DHCP is used to configure MGMT interface, then snmpd will listen on any IP and SNMP IPv6 reachability will not work.
Workaround will be to use SNMP_AGENT_ADDRESS_CONFIG to specifically configure specific IPs for snmpd to listen on.
How to verify it
Verified change on 202211 single asic VS image.
Test when MGMT_INTERFACE is not present in config_db
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)