frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

Quickly Allowing/Denying IP’s Using Iptables

JustinJustin Moderator
edited October 2017 in Performance and Security
How do you block an IP using iptables?

iptables -A INPUT -s xx.xx.xx.xx -j DROP

How do you block an IP from a specific port?

iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j DROP

How do you allow access to an IP?

iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT

How do you allow access to an IP to a specific port using iptables?

iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j ACCEPT
(xx.xx.xx.xx is the remote IP address and PORT is the port number you wish to allow/deny access to.)

How do you block a scanner on a server for example "blablabla.at.ISC.SANS" using iptables?
iptables -I INPUT -p tcp --dport 80 -m string --algo bm \
--string 'GET /blablabla.at.ISC.SANS.' -j DROP

More information can be found on our article about most common iptables rules:
https://community.time4vps.eu/discussion/271/basic-and-most-common-iptables-rules

Sign In or Register to comment.

Learn how to install a web and database server, email, FTP client or other applications. Discover and share information on server security or optimization recommendations.
Feel free to join our constantly expanding community, participate in discussions, strengthen your knowledge on Linux and Windows server management!
© 2013 - 2018 Time4VPS. All rights reserved.

Get In Touch