Iptables tcpdump


第一部分 iptables防火牆


⎝⎛•‿•⎞⎠html

shell

Shell 字符串操做
https://blog.csdn.net/dongwuming/article/details/50605911
Shell 取字符串變量字符數
https://blog.csdn.net/moyuanbomo/article/details/86741998shell

判斷變量是否爲空字符串: if [ -z "$VAR" ]; then or if [ "${#VAR}" == 0]; then or if [ "${#VAR}" -eq 0 ]; thenvim

vim 高級技巧

在 Insert 模式下能夠按 Ctrl + o 暫時進入 Command 模式, 執行一個命令後回到 Insert 模式
Alt + 任意字符 能夠快速進入 Command 模式並執行命令bash

iptables 中文文檔

查看鏈表ssh

iptables -L --line-number

向表內執行操做 -> D刪除 A添加/I插入tcp

iptables -[D/A/I] [INPUT/OUTPUT]

指向協議和端口 -> -p 協議 --dport 端口工具

iptables -A INPUT -j DROP -s 59.68.37.74 -p TCP --dport 22 # 丟棄59.68.37.74鏈接ssh的包

爲規則添加註釋.net

-m comment --comment 煩人的蜘蛛

CloudFlare IP 規則表

sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 103.31.4.0/22
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 141.101.64.0/18
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 108.162.192.0/18
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 190.93.240.0/20
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 188.114.96.0/20
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 197.234.240.0/22
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 198.41.128.0/17
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 162.158.0.0/15
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 104.16.0.0/12
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 172.64.0.0/13
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 131.0.72.0/22
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 173.245.48.0/20
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 103.21.244.0/22
sudo iptables -A INPUT -j ACCEPT -p tcp --dport 443 -m comment --comment 'CF' -s 103.22.200.0/22
sudo iptables -A INPUT -j DROP -p tcp --dport 443 -m comment --comment '禁止HTTPS'

sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 103.31.4.0/22
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 141.101.64.0/18
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 108.162.192.0/18
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 190.93.240.0/20
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 188.114.96.0/20
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 197.234.240.0/22
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 198.41.128.0/17
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 162.158.0.0/15
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 104.16.0.0/12
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 172.64.0.0/13
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 131.0.72.0/22
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 173.245.48.0/20
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 103.21.244.0/22
sudo iptables -A OUTPUT -j ACCEPT -p tcp --sport 443 -m comment --comment 'CF' -d 103.22.200.0/22
sudo iptables -A OUTPUT -j DROP -p tcp --sport 443 -m comment --comment '禁止HTTPS'

參考
http://www.javashuo.com/article/p-eworplke-ga.htmlcode


第二部分 tcpdump 網卡抓包工具


什麼是tcpdump

ENDhtm

相關文章
相關標籤/搜索