Last active
November 27, 2020 23:38
-
-
Save craig-m/8f8f7af2cd9a5311624c344c9996636a to your computer and use it in GitHub Desktop.
methods on linux to block a host/network
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # some methods on *nix systems to block a host/network | |
| # set a bogus arp address (for IPs in local subnet only) | |
| arp -s 192.168.1.10 00:00:00:00:00:01 | |
| # blackhole this subnet | |
| ip route add blackhole 192.168.2.0/24 | |
| # blackhole a host | |
| ip route add blackhole 192.168.1.10/32 | |
| # iptables firewall block a host | |
| iptables -I INPUT -s 192.168.1.10 -j DROP | |
| iptables -I OUTPUT -d 192.168.1.10 -j DROP | |
| # if you use UFW to manage iptables | |
| ufw deny from 192.168.1.10 to any | |
| # Add line below to /etc/hosts.deny | |
| # only works if server daemons are configured with tcpwrappers - more obsolete these days | |
| ALL: 192.168.1.10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment