如何将所有 GRE 流量转发到特定网络接口?

如何将所有 GRE 流量转发到特定网络接口?

我想将 eth2 上的所有 GRE 流量(IP 协议 47)转发到我机器上的 br0。我该怎么做?

答案1

我从未尝试过,但首先你需要匹配你想要的流量。你应该能够使用 iptables 和带有协议号的 -p 选项来做到这一点:

参数以下参数构成规则规范(在添加、删除、插入、替换和附加命令中使用)。

   [!] -p, --protocol protocol
          The  protocol of the rule or of the packet to check.  The speci‐
          fied protocol can be one of tcp, udp, udplite,  icmp,  esp,  ah,
          sctp  or  all, or it can be a numeric value, representing one of
          these protocols or  a  different  one.   A  protocol  name  from
          /etc/protocols  is also allowed.  A "!" argument before the pro‐
          tocol inverts the test.  The number zero is equivalent  to  all.
          Protocol  all  will  match  with  all  protocols and is taken as
          default when this option is omitted.

相关内容