Firewall

我可以根據 ICMPv6 子類型進行過濾嗎?

  • October 1, 2018

我正在嘗試過濾掉特定的 ICMPv6 數據包,並嘗試使用以下命令查看所有可能的類型選項:

ip6tables -p icmpv6 -h

這會產生以下類型(注意嵌套的類型):

Valid ICMPv6 Types:
destination-unreachable
  no-route
  communication-prohibited
  address-unreachable
  port-unreachable
packet-too-big
time-exceeded (ttl-exceeded)
  ttl-zero-during-transit
  ttl-zero-during-reassembly
parameter-problem
  bad-header
  unknown-header-type
  unknown-option
echo-request (ping)
echo-reply (pong)
router-solicitation
router-advertisement
neighbour-solicitation (neighbor-solicitation)
neighbour-advertisement (neighbor-advertisement)
redirect

嵌套類型可以專門針對嗎?

這是DROP傳出no-route目的地不可達數據包的正確語法嗎?

ip6tables -A OUTPUT -p icmpv6 --icmpv6-type destination-unreachable no-route -j DROP

直接匹配no-route類型即可:

ip6tables -A OUTPUT -p icmpv6 --icmpv6-type no-route -j DROP

如果您想刪除所有無法到達的目的地類型,您可以使用:

ip6tables -A OUTPUT -p icmpv6 --icmpv6-type destination-unreachable -j DROP

引用自:https://serverfault.com/questions/933475