
내 서버에 "route -n"을 입력한 후 다음 줄을 알아냈습니다.
1.0.104.156 - 255.255.255.255 !H - - - -
1.9.22.84 - 255.255.255.255 !H - - - -
1.9.27.129 - 255.255.255.255 !H - - - -
1.9.63.206 - 255.255.255.255 !H - - - -
1.9.116.134 - 255.255.255.255 !H - - - -
1.9.123.225 - 255.255.255.255 !H - - - -
에게
223.203.194.5 - 255.255.255.255 !H - - - -
223.203.218.68 - 255.255.255.255 !H - - - -
223.203.218.91 - 255.255.255.255 !H - - - -
223.206.106.124 - 255.255.255.255 !H - - - -
223.222.241.34 - 255.255.255.255 !H - - - -
223.224.126.254 - 255.255.255.255 !H - - - -
223.239.223.254 - 255.255.255.255 !H - - - -
223.255.162.34 - 255.255.255.255 !H - - - -
223.255.165.226 - 255.255.255.255 !H - - - -
223.255.183.202 - 255.255.255.255 !H - - - -
총 : 42727라인
그것은 어디에서 왔으며 어떻게 알 수 있습니까?
답변1
이것이 도움이 되길 바라면서, 합리적으로 안전해야 하지만 여전히 표준 및 일부 비표준 서비스에 대한 액세스를 허용하는 IPTABLES 규칙 세트의 사본은 다음과 같습니다.
*filter
# Reject some specifics (picked up from logs & fail2ban)
# -A INPUT -s 213.239.213.102 -j LOG --log-prefix "iptables DROP: " --log-level 7
# -A INPUT -s 213.239.213.102 -j REJECT
# -A INPUT -s 208.76.245.135 -j LOG --log-prefix "iptables DROP: " --log-level 7
# -A INPUT -s 208.76.245.135 -j REJECT
-A INPUT -s 78.189.110.91 -j LOG --log-prefix "iptables DROP: " --log-level 7
-A INPUT -s 78.189.110.91 -j REJECT
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
# Accepts all established inbound connections
# This is best:
#-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
# But the extension might not be available so may need to use this:
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allows all outbound traffic
# You can modify this to only allow certain traffic
-A OUTPUT -j ACCEPT
# Allows HTTP and HTTPS connections from anywhere (the normal ports for websites)
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
# Allow non-standard http(s) connections for Node.js etc
-A INPUT -p tcp --dport 5050:5151 -j ACCEPT
# Allows SSH connections (on non-standard port <1024)
-A INPUT -p tcp -m state --state NEW --dport 444 -j ACCEPT
# Allows mail connections
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 25 -j ACCEPT
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 465 -j ACCEPT
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 585 -j ACCEPT
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 993 -j ACCEPT
-A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 995 -j ACCEPT
# Allow ping
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
# log iptables denied calls
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables DENY: " --log-level 7
# Reject all other inbound - default deny unless explicitly allowed policy
-A INPUT -j REJECT
-A FORWARD -j REJECT
COMMIT
# ----------------------------------------------------
# NAT Rules
# ----------------------------------------------------
*nat
:PREROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
*mangle
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed
이 버전은 아웃바운드를 차단하지 않지만 그렇게 하는 것이 가장 좋습니다. 또한, 서버가 해당 네트워크 중 일부에 액세스할 필요가 없다면 간단히 차단하세요. 1.9.., 등 적어도 잠시 동안.