ebtables 笔记

ebtables 是一种用于 Linux 操作系统的防火墙工具,可以用于在数据包从一个网络接口的 MAC 层转发到另一个网络接口之前,对数据包进行过滤、转换和重定向等操作。它可以在内核层面拦截和处理数据包,在实现防火墙、流量控制、网络监控等方面具有重要作用。

ebtables 命令行工具的基本用法如下:

  • 1. 显示列表:ebtables -L 或者 ebtables -L -t table-name
  • 2. 增加规则:ebtables -A chain_name -p protocol –source-mac MAC –destination-mac MAC –in-interface interface-name –out-interface interface-name –jump target-action
  • 3. 删除规则:ebtables -D chain_name rule-number
  • 4. 修改规则:ebtables -R chain_name rule-number -p protocol –source-mac MAC –destination-mac MAC –in-interface interface-name –out-interface interface-name –jump target-action
  • 其中,table-name 默认filter可以取值如下:
  • filter:过滤器表,用于过滤数据包;
  • nat:网络地址转换表,用于实现 NAT;
  • broute:广播路由表,用于实现数据包的本地处理。
  • target-action 有 ACCEPT DROP RETURN

target-action 是需要执行的操作,包括 ACCEPT、DROP、REJECT 等。

注意:使用 ebtables 需要以 root 权限操作。

huan

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: