Last active
May 2, 2019 06:07
-
-
Save olaseni/d2ed8de0ebc0a9b2ffb3dc84e6e0b024 to your computer and use it in GitHub Desktop.
Blocks/rejects an IP address irrespective of port, for TCP connections
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
#!/usr/bin/env bash | |
block() { | |
# $1 is the remote address you want to block. | |
route add $1 gw 127.0.0.1 lo | |
route add -host $1 reject | |
# Flush the cache. | |
ip route flush cache | |
} | |
for a in $*; do block $a > /dev/null ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment