Bobcares

Iptables DROP vs REJECT – Discussing it in detail!!

by | Oct 25, 2019

What about having a deep discussion on iptables DROP vs REJECT?

Iptables have a set of rules to manage incoming and outgoing traffic. Drop and reject belongs to the actions against each unsafe packets.

At Bobcares, we often receive requests to carry out the drop and reject actions as part of our Server Management Services.

Today, let’s have a detailed discussion about these two actions.

 

Iptables DROP vs REJECT

As we all know, iptables is a flexible firewall utility built for Linux operating systems. It uses a set of tables with chains.

And, these chains contains a set of built-in or user-defined rules. But why we use these rules?

Actually, not all the packets that reach the firewall are safe. So, these rules filter the packets effectively.

Mainly there are three responses: ACCEPT, DROP and REJECT.

Now, let’s check out the main differences between the drop and reject commands.

 

Difference between DROP and REJECT

Both DROP and REJECT prohibits packets from passing through the firewall. But, the main difference between them is the response message.

Actually, when we use the DROP command, it will not forward the packet or answer it. But, simply drops the packet silently.

And, no indication is sent to the client or server.

But, the REJECT command sends an error message back to the source indicating a connection failure.

For TCP connections, iptables will send RST/ACK segments. But, with UDP, It returns an “ICMP destination port unreachable” message.

 

Iptables DROP vs REJECT – Better choice?

So, below given are the commands to DROP and REJECT the connections.

iptables -A INPUT -s <specified_ip> -j DROP
iptables -A INPUT -s <specified_ip> -j REJECT

Recently, one of our customers had a query regarding both these commands. Though both commands have the same function, he needs to know which command is better.

Our Support Engineers recommend the DROP command above REJECT.

REJECT command sends a response message. And, this message will ensure the attackers about the existence of the server on the other end.

It will give away information like open ports, software versions, etc which is risky. Incase of a DDOS attack, the server needs to respond to each request with a response.

But, dropping the packet doesn’t give the user any clue regarding the connection failure.

And, this is the main reason why the DROP command is more preferred.

 

[Need more information regarding these commands?- We’re available 24/7.]

 

Conclusion

In short, both the DROP and REJECT commands prohibit unsafe packets from passing through the firewall. Today’s “iptables DROP vs REJECT” article focussed more on the difference between these commands.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

2 Comments

  1. Mark Hack

    There is no “right” answer here. If you want to delay whoever is probing then a DROP will slow them down (sender has to wait for a timeout), BUT if you answer on any other port, it is obvious that there is a firewall in the middle.

    A straight REJECT will respond with an ICMP unreachable which is not the response you would see on a port which is not listening

    REJECT -reject-with tcp-reset makes the port behave as though nobody was listing and no firewall is in the middle.

    All will block the port, and how to respond depends on what the aim is.

    Reply
    • Sijin George

      Hello Mark,
      Thank you for your inputs. Yes, making a choice between DROP and REJECT depends a lot on the traffic type, purpose, etc.

      Reply

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF