啟動內建防火牆,不是應用防火牆…
sudo pfctl -e
加入有關 SSH 規則
sudo vi /etc/pf.conf
# Restrict SSH (port 22) access
block return in proto tcp from any to any port 22
pass in inet proto tcp from 59.124.x.x/24 to any port 22 no state
block return in proto tcp from any to any port 5900
pass in inet proto tcp from 59.124.x.x/24 to any port 5900 no state
e
載入規則 重新啟動防火牆
sudo pfctl -f /etc/pf.conf sudo pfctl -d ; sudo pfctl -ef /etc/pf.conf
參考