Since i do not have access to other layers, i would like to know the most efficient way to block an ip address from connecting to a Ubuntu 18.04 server. To the box itself, they are most likely connecting to port 80. However i would like to block access across all ports to this ip address.

I am aware of adding a record in iptables. By most efficient i mean, the least amount of layers the packet goes through. Kind of like blocking using iptables happens before block using an apache config on the webserver itself.

Are there any other better ways?


closed as off-topic by yoonix, Jenny D, Ward Apr 13 at 2:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    route add THEIPADDRESS will mean they never get any packets accepted and therefore cannot connect. – Jenny D Apr 10 at 12:20

In general, earlier denial means less load and potentially malicious traffic reaches your compute.

A network level firewall prevents packets from reaching the host.

A host level firewall prevents packets from reaching applications.

An application layer access list has not prevented the connection, but may deny servicing the request. If you know you don't want a given address or port, a firewall rule would be more efficient.

Not the answer you're looking for? Browse other questions tagged or ask your own question.