Skip to content

DHCPv4 Relay Agent High Level Design#1938

Merged
yaqiangz merged 6 commits intosonic-net:masterfrom
ashutosh-agrawal:dhcpv4
Aug 14, 2025
Merged

DHCPv4 Relay Agent High Level Design#1938
yaqiangz merged 6 commits intosonic-net:masterfrom
ashutosh-agrawal:dhcpv4

Conversation

@ashutosh-agrawal
Copy link
Member

@ashutosh-agrawal ashutosh-agrawal commented Mar 1, 2025

This document provides a high-level design for SONiC's new DHCPv4 relay agent, which addresses limitations of the existing ISC-DHCP implementation. The document outlines the architecture, new features and configuration of the new design, and also addresses the backward compatibility concerns related to transition from isc-dhcp.

Code PRs:
sonic-dhcp-relay
yang-model
sonic-buildimage
sonic-swss-common
Testplan HLD
sonic-mgmt test
CLIs

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@yaqiangz
Copy link
Contributor

Hi @lolyu could you please help to check the dual tor part?

@yaqiangz yaqiangz requested a review from lolyu March 17, 2025 12:28
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

lolyu
lolyu previously approved these changes Apr 8, 2025
Copy link
Contributor

@lolyu lolyu left a comment

Choose a reason for hiding this comment

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

The dualtor part LGTM

@AnantKishorSharma
Copy link

Hi @yaqiangz , @saiarcot895 , @lguohan , could you please create the new repo mentioned in this HLD( https://github.com/sonic-net/sonic-dhcpv4-relay) to open code PR?

Choose a reason for hiding this comment

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

Maybe detailing the type of OFFER packet(unicast) is more friendly


- **DHCP Acknowledgment (ACK):** The DHCP server responds with a DHCP Ack message, setting the destination IP address to the relay agent's IP address (giaddr). Upon receiving this message, the DHCP relay agent updates the packet's fields similar to the Offer message and forwards it as a unicast message to the DHCP client, completing the DHCP transaction.

<div align="center"> <img src=images/DHCPv4_Relay_Basic_Flow.png width=600 /> </div>

Choose a reason for hiding this comment

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

offer packet from server to relay agent will also be unicast, typo?


DHCPv4 relay process will run in the dhcp_relay container along with DHCPv6 processes and DhcpMon. A single instance of the process will handle DHCPv4 relay functionality of all the VLANs that are configured. This process will listen to Redis for all the necessary configuration updates and will not require restarting of the container. The design is split into 3 sub-modules and the following diagram provides an overview of how they interact with each other:

<div align="center"> <img src=images/DHCPv4_Relay_sequence_diagram.png width=700 /> </div>
Copy link

@AnantKishorSharma AnantKishorSharma Jul 1, 2025

Choose a reason for hiding this comment

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

This diagram needs to be updated with the latest changes(COUNTERS_DB etc.)?

Copy link
Contributor

@yaqiangz yaqiangz left a comment

Choose a reason for hiding this comment

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

LGTM

@yaqiangz yaqiangz merged commit f415128 into sonic-net:master Aug 14, 2025
1 check passed
Blueve pushed a commit to sonic-net/sonic-utilities that referenced this pull request Nov 5, 2025
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938).

What I did
Added dependency checks in SONiC config CLI to prevent deletion of interfaces, VRFs, and VLANs that are in use by DHCPv4 relay configurations.
Added/updated unit tests.
How I did it
Implemented a new function check_dhcpv4_relay_dependencies to check if an interface or VRF is referenced in the DHCPV4_RELAY table.
Called this function before allowing deletion of portchannels, loopbacks, VRFs, and VLANs.
Modified the VLAN deletion logic to block removal if the VLAN is present in the DHCPV4_RELAY table.
Extended the test suite to verify that deletion is blocked when dependencies exist and allowed after cleanup.

How to verify it
Run the updated unit tests: they now include cases where deletion of interfaces, VRFs, or VLANs in use by DHCPv4 relay is attempted and should fail.
Manually test by configuring DHCPv4 relay on an interface/VRF/VLAN, then attempt to delete it using the CLI; the command should fail with an appropriate error message.
After removing the DHCPv4 relay configuration, deletion should succeed.
yxieca pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Nov 10, 2025
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938).
Docker changes PR : #22486

How I did it
Included new commands to support dhcpv4_relay in dockers/docker-dhcp-relay folder.
Corresponding cli-plugin-tests are included.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Co-authored-by: Prashant Srivastava <srivastavaprashant829@gmail.com>
gordon-nexthop pushed a commit to nexthop-ai/sonic-utilities that referenced this pull request Nov 25, 2025
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938).

What I did
Added dependency checks in SONiC config CLI to prevent deletion of interfaces, VRFs, and VLANs that are in use by DHCPv4 relay configurations.
Added/updated unit tests.
How I did it
Implemented a new function check_dhcpv4_relay_dependencies to check if an interface or VRF is referenced in the DHCPV4_RELAY table.
Called this function before allowing deletion of portchannels, loopbacks, VRFs, and VLANs.
Modified the VLAN deletion logic to block removal if the VLAN is present in the DHCPV4_RELAY table.
Extended the test suite to verify that deletion is blocked when dependencies exist and allowed after cleanup.

How to verify it
Run the updated unit tests: they now include cases where deletion of interfaces, VRFs, or VLANs in use by DHCPv4 relay is attempted and should fail.
Manually test by configuring DHCPv4 relay on an interface/VRF/VLAN, then attempt to delete it using the CLI; the command should fail with an appropriate error message.
After removing the DHCPv4 relay configuration, deletion should succeed.
ashutosh-agrawal pushed a commit to AnantKishorSharma/sonic-buildimage that referenced this pull request Nov 30, 2025
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938).
Docker changes PR : sonic-net#22486

How I did it
Included new commands to support dhcpv4_relay in dockers/docker-dhcp-relay folder.
Corresponding cli-plugin-tests are included.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Co-authored-by: Prashant Srivastava <srivastavaprashant829@gmail.com>
FengPan-Frank pushed a commit to FengPan-Frank/sonic-buildimage that referenced this pull request Dec 4, 2025
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938).
Docker changes PR : sonic-net#22486

How I did it
Included new commands to support dhcpv4_relay in dockers/docker-dhcp-relay folder.
Corresponding cli-plugin-tests are included.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Co-authored-by: Prashant Srivastava <srivastavaprashant829@gmail.com>
Signed-off-by: Feng Pan <fenpan@microsoft.com>
yxieca pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Dec 5, 2025
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938)

Work item tracking
Microsoft ADO (number only):
How I did it
Edit supervisord template to start sonic DHCPv4 relay instance when configured to do so in Config DB.
Align cfg unit test to the new change.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Shivashankar C R <shivashankar.c.r@gmail.com>
Co-authored-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>
kewei-arista pushed a commit to kewei-arista/sonic-buildimage that referenced this pull request Dec 8, 2025
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938)

Work item tracking
Microsoft ADO (number only):
How I did it
Edit supervisord template to start sonic DHCPv4 relay instance when configured to do so in Config DB.
Align cfg unit test to the new change.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Shivashankar C R <shivashankar.c.r@gmail.com>
Co-authored-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>
hdwhdw pushed a commit to hdwhdw/sonic-buildimage that referenced this pull request Dec 18, 2025
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938)

Work item tracking
Microsoft ADO (number only):
How I did it
Edit supervisord template to start sonic DHCPv4 relay instance when configured to do so in Config DB.
Align cfg unit test to the new change.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Shivashankar C R <shivashankar.c.r@gmail.com>
Co-authored-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>
Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
xwjiang-ms pushed a commit to xwjiang-ms/sonic-buildimage that referenced this pull request Dec 22, 2025
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938).
Docker changes PR : sonic-net#22486

How I did it
Included new commands to support dhcpv4_relay in dockers/docker-dhcp-relay folder.
Corresponding cli-plugin-tests are included.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Co-authored-by: Prashant Srivastava <srivastavaprashant829@gmail.com>
Signed-off-by: xiaweijiang <xiaweijiang@microsoft.com>
xwjiang-ms pushed a commit to xwjiang-ms/sonic-buildimage that referenced this pull request Dec 22, 2025
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938)

Work item tracking
Microsoft ADO (number only):
How I did it
Edit supervisord template to start sonic DHCPv4 relay instance when configured to do so in Config DB.
Align cfg unit test to the new change.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Shivashankar C R <shivashankar.c.r@gmail.com>
Co-authored-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>
Signed-off-by: xiaweijiang <xiaweijiang@microsoft.com>
YairRaviv pushed a commit to YairRaviv/sonic-utilities that referenced this pull request Jan 12, 2026
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938).

What I did
Added dependency checks in SONiC config CLI to prevent deletion of interfaces, VRFs, and VLANs that are in use by DHCPv4 relay configurations.
Added/updated unit tests.
How I did it
Implemented a new function check_dhcpv4_relay_dependencies to check if an interface or VRF is referenced in the DHCPV4_RELAY table.
Called this function before allowing deletion of portchannels, loopbacks, VRFs, and VLANs.
Modified the VLAN deletion logic to block removal if the VLAN is present in the DHCPV4_RELAY table.
Extended the test suite to verify that deletion is blocked when dependencies exist and allowed after cleanup.

How to verify it
Run the updated unit tests: they now include cases where deletion of interfaces, VRFs, or VLANs in use by DHCPv4 relay is attempted and should fail.
Manually test by configuring DHCPv4 relay on an interface/VRF/VLAN, then attempt to delete it using the CLI; the command should fail with an appropriate error message.
After removing the DHCPv4 relay configuration, deletion should succeed.
jasonbridges pushed a commit to jasonbridges/sonic-buildimage that referenced this pull request Jan 22, 2026
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938)

Work item tracking
Microsoft ADO (number only):
How I did it
Edit supervisord template to start sonic DHCPv4 relay instance when configured to do so in Config DB.
Align cfg unit test to the new change.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Shivashankar C R <shivashankar.c.r@gmail.com>
Co-authored-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>
ashutosh-agrawal added a commit to ashutosh-agrawal/sonic-buildimage that referenced this pull request Feb 5, 2026
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938)

Work item tracking
Microsoft ADO (number only):
How I did it
Edit supervisord template to start sonic DHCPv4 relay instance when configured to do so in Config DB.
Align cfg unit test to the new change.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Shivashankar C R <shivashankar.c.r@gmail.com>
Co-authored-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>
FengPan-Frank pushed a commit to FengPan-Frank/sonic-buildimage that referenced this pull request Mar 6, 2026
Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938)

Work item tracking
Microsoft ADO (number only):
How I did it
Edit supervisord template to start sonic DHCPv4 relay instance when configured to do so in Config DB.
Align cfg unit test to the new change.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Shivashankar C R <shivashankar.c.r@gmail.com>
Co-authored-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>
Signed-off-by: Feng Pan <fenpan@microsoft.com>
vmittal-msft added a commit to sonic-net/sonic-buildimage that referenced this pull request Mar 23, 2026
* [dhcp_relay] sonic dhcp relay agent for IPv4 (#22486)

Why I did it
Currently SONiC uses the 'isc-dhcp-relay' package to allow DHCP relay functionality on IPv4 networks.
With this PR we are adding sonic dhcp relay agent for IPv4 as described in this HLD(sonic-net/SONiC#1938)

Work item tracking
Microsoft ADO (number only):
How I did it
Edit supervisord template to start sonic DHCPv4 relay instance when configured to do so in Config DB.
Align cfg unit test to the new change.

How to verify it
Configure sonic DHCPv4 agent as described in the feature HLD(sonic-net/SONiC#1938)
Test it with real client/server with IPv4 or use the sonic-mgmt suite

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Shivashankar C R <shivashankar.c.r@gmail.com>
Co-authored-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>

* Update sonic-dhcp-relay submodule to include boost dependency fixes

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>

---------

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
Co-authored-by: Anant <127479400+AnantKishorSharma@users.noreply.github.com>
Co-authored-by: Shivashankar C R <shivashankar.c.r@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: StormLiangMS <89824293+StormLiangMS@users.noreply.github.com>
Co-authored-by: Vineet  Mittal <46945843+vmittal-msft@users.noreply.github.com>
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.

7 participants