Jump to content
Sign in to follow this  

Blocking Incoming Traffic

Recommended Posts

You want to block all incoming network traffic, except from your system itself. Does not affect outgoing traffic.




For iptables:


# iptables -F INPUT

# iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT

# iptables -A INPUT -j REJECT



For ipchains:


# ipchains -F input

# ipchains -A input -i lo -j ACCEPT

# ipchains -A input -p tcp --syn -j REJECT

# ipchains -A input -p udp --dport 0:1023 -j REJECT :P




Share this post

Link to post
Share on other sites

slight refinement..


# iptables -F INPUT
# iptables -A input -i lo -s -d -j ACCEPT
# iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# iptables -A INPUT -j DROP


ensures that loopback is actually looping.. addition of RELATED state (for instance passive ftp, dcc connections) and DROP rather than REJECT. Drop throws them away, Reject responds.. always better to be non-existant instead of visible..

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...