Skip to content

Add iptables rules to drop all bgp packets destined for loopback1 IP addresses in dual ToR#262

Merged
StormLiangMS merged 5 commits intosonic-net:masterfrom
yyynini:block-lp1-bgp
Jun 11, 2025
Merged

Add iptables rules to drop all bgp packets destined for loopback1 IP addresses in dual ToR#262
StormLiangMS merged 5 commits intosonic-net:masterfrom
yyynini:block-lp1-bgp

Conversation

@yyynini
Copy link
Contributor

@yyynini yyynini commented May 27, 2025

Why I did it
issue: https://msazure.visualstudio.com/One/_workitems/edit/32910131/
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.
This PR addresses the requirement to block BGP packets on lookback1 for both active-active and active-standby dual tor scenarios.

How I did it

  • Added iptable rules to drop all bgp packets destined for loopback1 IP addresses.
  • use -I to ensure its priority over all the other ACCEPT rules.

How to verify it

  • The DROP rule is at the top of the chain:
  • Sent 1000 bgp pkts from PTF, verified that all were dropped:
    image

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ZhaohuiS
Copy link
Contributor

@yyynini can you please add the description for this PR?

@ZhaohuiS
Copy link
Contributor

@yyynini Please check if it needs to update the test case in test_cacl_application for dualtor

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yyynini yyynini changed the title Add iptables rules to drop all packets destined for loopback1 IP addresses Add iptables rules to drop all bgp packets destined for loopback1 IP addresses in dual ToR May 30, 2025
@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

@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.

LGTM

@lolyu lolyu requested review from ZhaohuiS and prsunny June 4, 2025 01:52
@lolyu
Copy link

lolyu commented Jun 4, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StormLiangMS
Copy link

hi @yyynini could you help to update the description part as we do in sonic-buildimage repo?
for example, sonic-net/sonic-buildimage#22508.

@StormLiangMS StormLiangMS reopened this Jun 4, 2025
scripts/caclmgrd Outdated
if iface_name.startswith(loopback1_name):
loopback1_intf = ipaddress.ip_interface(iface_cidr)
loopback1_addr = loopback1_intf.ip
# Add iptables rules to drop all packets destined for loopback1 IP addresses

Choose a reason for hiding this comment

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

minor one, in the comment part, not all packets, but the BGP packets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, updated!

Copy link
Contributor

@prsunny prsunny left a comment

Choose a reason for hiding this comment

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

lgtm, few clarification questions.


return allow_internal_docker_ip_cmds

def generate_block_bgp_loopback1(self, namespace, config_db_connector):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you confirm it covers both active-standy and active-active dualtor scenarios?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the BGP block rule is applied for both DualToR scenarios.

loopback1_addr = loopback1_intf.ip
# Add iptables rules to drop all packets destined for loopback1 IP addresses
if isinstance(loopback1_addr, ipaddress.IPv4Address):
drop_dulator_bgp_loopback1_cmds.append(self.iptables_cmd_ns_prefix[namespace] +
Copy link
Contributor

Choose a reason for hiding this comment

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

-I is good. Lets ensure that there are no other ACCEPT rules above this.

Copy link
Contributor Author

@yyynini yyynini Jun 5, 2025

Choose a reason for hiding this comment

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

Yes, the DROP rule is at the top (rule 1).

image

@mssonicbld
Copy link

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lolyu
Copy link

lolyu commented Jun 6, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@prsunny
Copy link
Contributor

prsunny commented Jun 9, 2025

@yejianquan , please take to 202505

@yejianquan
Copy link

@yejianquan , please take to 202505

Hi @prsunny , feature-labels work is after PR got merged

@StormLiangMS StormLiangMS merged commit 04e49f8 into sonic-net:master Jun 11, 2025
5 checks passed
@StormLiangMS
Copy link

hi @yejianquan merged.

StormLiangMS pushed a commit to sonic-net/sonic-mgmt that referenced this pull request Jun 11, 2025
… dualtor (#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jun 11, 2025
… dualtor (sonic-net#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jun 11, 2025
… dualtor (sonic-net#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.
@mssonicbld
Copy link

Cherry-pick PR to 202505: #269

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jun 12, 2025
… dualtor (sonic-net#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.
mssonicbld pushed a commit to sonic-net/sonic-mgmt that referenced this pull request Jun 13, 2025
… dualtor (#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.
nissampa pushed a commit to nissampa/sonic-mgmt_dpu_test that referenced this pull request Aug 7, 2025
… dualtor (sonic-net#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
… dualtor (sonic-net#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.

Signed-off-by: opcoder0 <[email protected]>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
… dualtor (sonic-net#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.

Signed-off-by: Aharon Malkin <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
… dualtor (sonic-net#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.

Signed-off-by: Guy Shemesh <[email protected]>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
… dualtor (sonic-net#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
… dualtor (sonic-net#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.

Signed-off-by: Guy Shemesh <[email protected]>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
… dualtor (sonic-net#18766)

What is the motivation for this PR?
This PR updates the DualToR config to enforce the same loopback1 IP address for both ToRs.
Based on a recent Incident 628608070 : [SONiC RCA][SLB_DNC] Gemini Tors dropping vip traffic, we need to block BGP from being established on loopback1.

How did you do it?
Assign the same loopback1 IP to both ToRs.
Added an iptables rules to drop the packets sonic-net/sonic-host-services#262

How did you verify/test it?
Confirmed both ToRs used the same loopback1 IP, and verify the drop rule.

Signed-off-by: Yael Tzur <[email protected]>
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