TCP connection timeout received when reject method for TCP connections is set to ICMP

Solution Verified - Updated -

Issue

When configuring iptables to reject TCP connections with an ICMP message, a client application trying to connect should detect that it's being rejected, however it claims that the connection times out.

For example when rejecting TCP connections with a icmp-host-prohibited message:

iptables -p tcp -A INPUT -j REJECT --reject-with icmp-host-prohibited

The first few connections are rejected properly from the client perspective, however at some point, subsequent connections are not rejected, but timed out.

Environment

Red Hat Enterprise Linux 5
Red Hat Enterprise Linux 6
Red Hat Enterprise Linux 7
Red Hat Enterprise Linux 8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content