Last active
February 4, 2025 03:02
-
-
Save akanehara/a2948ae8b38af62436e38d4f6ea651b7 to your computer and use it in GitHub Desktop.
iptablesスニペット
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
# 接続先で遮断 | |
iptables -I INPUT -p tcp --tcp-flags ALL,SYN SYN -s ${SRC_ADDR} --dport ${PORT} -j DROP | |
iptables -I INPUT -p tcp -s ${SRC_ADDR} --dport ${PORT} -j REJECT | |
# 接続元で遮断 | |
iptables -I OUTPUT -p tcp -d ${DEST_ADDR} --dport ${PORT} -j REJECT | |
iptables -I OUTPUT -p tcp --tcp-flags ALL,SYN SYN -d ${DEST_ADDR} --dport ${PORT} -j DROP | |
# 何か入力するまで遮断 | |
,(){ CMD='sudo iptables $op OUTPUT -p tcp -d "$1" --dport "$2" -j REJECT'; op=-I;eval "$CMD"; read; op=-D; eval "$CMD";};, 192.168.1.2 9200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment