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

Change tcp port range to support telemetry and gnmi #17907

Merged
merged 3 commits into from
Jan 26, 2024

Conversation

ganglyu
Copy link
Contributor

@ganglyu ganglyu commented Jan 26, 2024

Why I did it

A common cause of failure for the telemetry and gnmi server is port conflict. If other processes are using tcp ports 50051 and 50052, the server cannot start.

Work item tracking
  • Microsoft ADO (number only): 26538971

How I did it

Change local port range in sysctl, new port range is from 32768 to 50001.
And then service ports for telemetry and gnmi will not be used by automatic port assignments.
https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html

How to verify it

Stop telemetry and gnmi service, and create new tcp connections, and they will not use 50051 and 50052.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

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)

@@ -15,6 +15,7 @@ net.ipv4.conf.all.arp_announce=1
net.ipv4.conf.all.arp_filter=0
net.ipv4.conf.all.arp_notify=1
net.ipv4.conf.all.arp_ignore=2
net.ipv4.ip_local_reserved_ports=50051,50052
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is current SONiC auto allocate port range: 32768 60999
If any other SONiC service in this range, also need add to here.

admin@vlab-01:$ sudo sysctl -a | grep ip_local_
net.ipv4.ip_local_port_range = 32768 60999
net.ipv4.ip_local_reserved_ports =
admin@vlab-01:
$

@ganglyu ganglyu requested a review from liuh-80 January 26, 2024 05:28
@ganglyu ganglyu changed the title Reserve tcp port for telemetry and gnmi Change tcp port range to support telemetry and gnmi Jan 26, 2024
@ganglyu ganglyu marked this pull request as draft January 26, 2024 06:56
@ganglyu ganglyu marked this pull request as ready for review January 26, 2024 07:22
@yxieca yxieca merged commit c798ea8 into sonic-net:master Jan 26, 2024
19 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Jan 26, 2024
* Reserve tcp port for telemetry and gnmi

* Use ip_local_port_range instead

* Fix sysctl config
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202311: #17916

yxieca pushed a commit that referenced this pull request Jan 26, 2024
* Reserve tcp port for telemetry and gnmi

* Use ip_local_port_range instead

* Fix sysctl config

Co-authored-by: ganglv <88995770+ganglyu@users.noreply.github.com>
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Jan 29, 2024
* Reserve tcp port for telemetry and gnmi

* Use ip_local_port_range instead

* Fix sysctl config
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #17923

mssonicbld pushed a commit that referenced this pull request Jan 29, 2024
* Reserve tcp port for telemetry and gnmi

* Use ip_local_port_range instead

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

Successfully merging this pull request may close these issues.

7 participants