Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
VGSOURCES
List your tool

firewallPATCH 2026.10.15

How to List and Delete iptables Firewall Rules on Linux

By VGSources Team 8 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use sudo iptables -L -v -n --line-numbers to inspect IPv4 rules, then remove one rule with sudo iptables -D CHAIN NUMBER. The number is the rule’s one-based position in that chain. For IPv6, substitute ip6tables. Always identify the table and chain, record the current rule specification, delete only the intended entry, and list the chain again to verify the change.

What iptables rules represent

iptables is the administration interface for the Linux kernel’s IPv4 packet-filtering and NAT facilities. ip6tables provides the corresponding interface for IPv6. The current Linux man-pages documentation identifies the command suite as version 1.8.13 (documentation current on October 15, 2026).

As an Amazon Associate I earn from qualifying purchases.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Rules are organized first by table and then by chain. A rule matches packet properties such as source address, protocol, destination port, or connection state, and then applies a target such as ACCEPT, DROP, REJECT, or a jump to another chain. Deleting a rule changes the active kernel ruleset immediately; it does not automatically change whatever mechanism your distribution uses to restore rules after a reboot.

Before changing anything: identify scope and preserve a record

  • Use root privileges. Prefix commands with sudo, or run them from a root shell.
  • Determine the address family. Use iptables for IPv4 and ip6tables for IPv6. They maintain separate rulesets.
  • Determine the table. The default is filter, but NAT, packet alteration, and early packet processing use other tables.
  • Determine the chain. Common built-in chains include INPUT, OUTPUT, and FORWARD; table-specific chains such as PREROUTING and POSTROUTING are also common.
  • Record the current form. Save the output of iptables -S (with the correct -t option when needed) before editing. This gives you a command-like representation that can be audited or used to construct a specification-based deletion.

Do not remove a remote-access rule casually. If you are connected over SSH, a mistaken deletion or flush can terminate the session and prevent reconnection. Make one narrow change, verify it, and keep an existing administrative session open until the result is confirmed.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses | Anti UV Ray, For Computers & Gaming, Square Frame, Eyewear for Men and Women
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

How to list the active filter rules

List every chain with counters and rule numbers

sudo iptables -L -v -n --line-numbers

This command lists the default filter table. The options have distinct jobs:

  • -L lists rules.
  • -v displays verbose information, including packet and byte counters and additional match or interface details.
  • -n keeps addresses and ports numeric instead of performing reverse-DNS or service-name lookups. It is faster and avoids misleading delays or name-resolution changes while you inspect a firewall.
  • --line-numbers prints each rule’s one-based position in its chain, which is required when deleting by number.

Typical output begins with a chain heading, policy and counters, followed by numbered rules. Read the chain heading before interpreting a number: rule 3 in INPUT is unrelated to rule 3 in OUTPUT.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

List one chain only

sudo iptables -L INPUT -v -n --line-numbers

Replace INPUT with the chain you need. Narrowing the listing reduces the chance of counting from the wrong chain and makes it easier to compare the rules before and after an edit.

Show rules in rule-specification form

sudo iptables -S
sudo iptables -S INPUT

-S prints rules as command-style specifications rather than the aligned display used by -L. The first command shows all rules in the selected table; the second restricts output to INPUT. This form is useful for recording an exact rule, reviewing implicit details, and preparing a deletion that repeats the original match and target.

Tables: list the ruleset you actually intend to edit

Every command operates on one table at a time. If you omit -t, filter is selected. A rule that performs address translation will not appear in a default filter-table listing, so inspecting only iptables -L can give an incomplete picture.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
Table Example listing command Typical purpose
filter (default) sudo iptables -t filter -L -v -n --line-numbers Packet acceptance, dropping, rejection and forwarding policy.
nat sudo iptables -t nat -L -v -n --line-numbers Network address translation and destination or source translation.
mangle sudo iptables -t mangle -L -v -n --line-numbers Packet modifications and specialized marks or headers.
raw sudo iptables -t raw -L -v -n --line-numbers Early packet handling before connection tracking decisions.

Only query tables that exist and are relevant on the host. Chain names differ by table, so copy the table option and chain name consistently when you move from listing to deletion.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Delete one rule by its line number

Delete from the default filter table

  1. List the exact chain with numbers and counters:
    sudo iptables -L INPUT -v -n --line-numbers
  2. Identify the one-based number of the rule to remove. Confirm its source, destination, protocol, ports, interfaces and target; do not rely on the number alone.
  3. Delete that position:
    sudo iptables -D INPUT 3
  4. List the chain again:
    sudo iptables -L INPUT -v -n --line-numbers

The -D chain rulenum form deletes one rule from the selected chain. Numbering starts at 1, not 0. The command changes the running ruleset immediately.

Delete from another table

Use the same table selector used during inspection. For example, to remove rule 2 from the PREROUTING chain in the NAT table:

sudo iptables -t nat -L PREROUTING -v -n --line-numbers
sudo iptables -t nat -D PREROUTING 2
sudo iptables -t nat -L PREROUTING -v -n --line-numbers

Leaving out -t nat would target the default filter table instead, where that chain may not exist or may refer to a different ruleset.

Why you must re-list before deleting another number

After a deletion, every later rule moves up one position. If rule 3 is removed, the old rule 4 becomes rule 3. Re-run the listing before each additional numbered deletion; otherwise you can remove a different rule than intended.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Delete by matching the complete rule specification

When a rule’s position may change, delete it by repeating its match and target instead of counting lines:

sudo iptables -D INPUT -s 203.0.113.10 -p tcp --dport 22 -j DROP

The -D specification must use the same options as the command that originally added the rule with -A (or inserted or replaced it with -I or -R). Include the same chain, source and destination qualifiers, protocol, ports, interfaces, connection-state options, match modules and target.

Before composing the command, capture the current form:

sudo iptables -S INPUT

Copy the relevant rule’s options and change its operation from -A to -D. This avoids failures caused by aliases, implicit modules, omitted defaults, address formatting or option order that differs from your memory of how the rule was created.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If identical rules occur more than once, a specification-based deletion removes the first matching entry. If you need to remove several duplicates, repeat the command and inspect the chain after each removal, or use numbered deletion with a fresh listing.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Numbered deletion versus specification deletion

Method Precision and auditability What can go wrong Best use
-D CHAIN NUMBER Unambiguous for the current listing; the selected line is removed. Numbers shift after each deletion, and a stale listing can select the wrong rule. A one-time change after immediately inspecting the chain.
-D CHAIN rule-specification Documents the match and target directly and does not depend on a line position. The specification must exactly mirror the existing rule; duplicates remove the first match. Scripts, repeatable operations and rules whose position is unstable.
-F CHAIN or -F Broad and easy to verify, but not selective. Removes every rule in a chain, or every chain in the selected table when no chain is supplied. Only when a complete chain or table flush is explicitly intended.

Flush rules and remove user-defined chains only when intentional

Flush a chain or an entire table

sudo iptables -F INPUT
sudo iptables -t nat -F

-F removes every rule from the named chain. Without a chain name, it flushes every chain in the selected table. The operation is equivalent to deleting the rules one by one, but its blast radius is much larger than a single numbered or specification-based deletion. A flush can remove the rules that protect services, restrict forwarding or provide remote access.

Delete an empty user-defined chain

sudo iptables -X CUSTOM_CHAIN

-X removes a user-defined chain only after it is empty and no rules jump to it. Built-in chains such as INPUT, OUTPUT and FORWARD are not ordinary deletable chains. Remove references first, flush the custom chain, and then use -X if deleting that chain is genuinely required.

List and delete IPv6 rules

IPv6 has a parallel command and a separate ruleset. A change made with iptables does not remove the corresponding IPv6 rule.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo ip6tables -L -v -n --line-numbers
sudo ip6tables -L INPUT -v -n --line-numbers
sudo ip6tables -D INPUT 3

The list and delete forms, including table selection with -t, work the same way. If the traffic you are troubleshooting can use both address families, inspect and verify both rulesets rather than assuming an IPv4 change covers IPv6.

A safe, repeatable change procedure

  1. Confirm the family: choose iptables or ip6tables.
  2. Confirm the table: start with filter unless the traffic is being translated, modified or handled early.
  3. Record specifications: run sudo iptables -S, adding -t TABLE and a chain when appropriate.
  4. Inspect the target chain: run -L CHAIN -v -n --line-numbers and verify the complete rule details.
  5. Select the narrowest deletion: use a fresh line number for a one-off change, or copy the exact specification for a repeatable change.
  6. Apply the deletion: include the same table selector and address-family command used during inspection.
  7. Verify immediately: list the chain again and confirm that only the intended rule disappeared. Counters and neighboring rules should make the result clear.
  8. Test the traffic path: check the connection, forwarding path or translation behavior that motivated the change.
  9. Handle persistence separately: if the change must survive reboot, update the host’s distribution-specific persistence mechanism. The iptables command manuals describe the active ruleset, not one universal save-and-restore system.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting deletion failures and surprises

“No chain/target/match by that name”

Check the address-family command, table selector and chain spelling. A chain in nat is not necessarily present in filter, and an IPv6 chain must be inspected with ip6tables.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

The numbered command removed the wrong rule

The listing was probably stale, or a prior deletion shifted positions. Re-list the exact chain immediately before each numbered deletion and verify the rule’s full match and target, not merely its position.

Specification deletion says the rule does not exist

Run sudo iptables -S CHAIN and copy the rule exactly. Differences in protocol, address masks, interface names, ports, match modules, state options, target arguments or operation ordering can prevent a match. Include -t TABLE if the rule is outside filter.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The rule appears again after reboot

Deleting a running rule does not necessarily edit a saved rules file, firewall service configuration or orchestration system. Identify which persistence mechanism loads rules on that host, update it using that system’s documented procedure, reboot only when appropriate, and verify both the saved configuration and the active ruleset.

Traffic still behaves as before

Inspect both IPv4 and IPv6, the other relevant tables and the complete packet path. A rule in another chain, a jump to a user-defined chain, a NAT rule, or a separate address family may be responsible. Use verbose counters to see whether the rule you removed was receiving packets, then test the intended path again.

Command quick reference

Task Command
List filter table with numbers sudo iptables -L -v -n --line-numbers
List one filter chain sudo iptables -L INPUT -v -n --line-numbers
Show command-style specifications sudo iptables -S
Show one chain’s specifications sudo iptables -S INPUT
List a non-default table sudo iptables -t nat -L -v -n --line-numbers
Delete by number sudo iptables -D INPUT 3
Delete by specification sudo iptables -D INPUT -s 203.0.113.10 -p tcp --dport 22 -j DROP
Flush one chain sudo iptables -F INPUT
Flush a whole table sudo iptables -t nat -F
List IPv6 rules sudo ip6tables -L -v -n --line-numbers
Delete an IPv6 rule by number sudo ip6tables -D INPUT 3

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

firewallip6tablesiptablesLinuxnetwork securitysystem administration

Leave a reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.