linux – 是否可以将proxy-arp用于同一个界面?

我有一个连接到 Linux路由器的WiFi接入点.路由器本身连接到Internet.出于多种原因(主要是为了控制安全性和服务质量),我想强制所有用户的流量通过Linux路由器,甚至是用户之间的流量.

为此,我禁用了AP中的站到站通信(我使用的是D-Link DWL-7200 AP).以下是我配置AP的方式:

ssh admin@accesspoint1
D-Link Access Point wlan1 -> set sta2sta disable
D-Link Access Point wlan1 -> reboot

这很好用:无线用户不能再相互通信了.至少不是直接的.我的目标是强制流量到达路由器并返回.

为此,我在Linux路由器中启用了proxy-arp:

echo 1 > /proc/sys/net/ipv4/conf/eth1/proxy_arp

这是大局.

10.0.0.0/8 subnet    
   ____________________|______________________
  /                                           \
  |                                           |

               (sta2sta disabled)
  UserA----------------AP---------------------Router-------------------Internet
10.0.0.55             /                   eth1     eth0
                     /                10.0.0.1     203.0.113.15
                    /        proxy-arp enabled
  UserB____________/
10.0.0.66

如果UserA ping UserB,我希望会发生这种情况:

> UserA尝试ping 10.0.0.66
>所以UserA发送ARP广播说“谁有10.0.0.66?”
>接入点允许请求通过路由器(但不允许到UserB,因为sta2sta被禁用)
>路由器收到请求,并且因为在eth1上启用了proxy-arp,它应该回答“向我发送10.0.0.66的数据包(路由器的MAC地址)”.
>接入点应该接收答案并将其转发给UserA.
>然后UserA应该将实际的ping数据包发送到路由器的MAC地址
>数据包应该通过AP到达路由器
>路由器应将其路由回到eth1,方法是将目标MAC地址更改为UserB(如果需要,执行ARP请求),并将源MAC地址更改为自己的MAC地址.
>数据包应该到达AP并转发给UserB.
> UserB应该回复ping请求.
>回复应该通过AP到路由器.
>回复应该路由到UserA.
>它应该通过AP并到达UserA.

不幸的是,整个梦想在第4步失败,因为Linux路由器收到ARP请求但未能回答它.从我在互联网上看到的内容来看,这似乎是正常的:代理ARP并不是真正设计用于这种设置.更确切地说:路由器不响应与ARP请求来自同一接口的主机的ARP请求.在这种情况下,ARP请求来自eth1,但它显示“谁有IP 10.0.0.66?”,主机10.0.0.66在接口eth1上.

我理解为什么这是一个很好的默认行为,因为如果在AP中没有禁用sta2sta,UserA将收到来自路由器的ARP响应和来自UserB的另一个ARP响应.但就我而言,我相信回答每一个ARP请求都是完全合理的,即使对于同一界面上的主机也是如此.

有什么办法可以解决这个默认的proxy-arp行为吗?

解决方法

你想要的实际上是可能的,但需要一个非常新的Linux内核(> = 2.6.34,或者一个backport).

您需要的选项是/ proc / sys / net / ipv4 / conf / * / proxy_arp_pvlan:

proxy_arp_pvlan - BOOLEAN
    Private VLAN proxy arp.
    Basically allow proxy arp replies back to the same interface
    (from which the ARP request/solicitation was received).

    This is done to support (ethernet) switch features,like RFC
    3069,where the individual ports are NOT allowed to
    communicate with each other,but they are allowed to talk to
    the upstream router.  As described in RFC 3069,it is possible
    to allow these hosts to communicate through the upstream
    router by proxy_arp'ing. Don't need to be used together with
    proxy_arp.

    This technology is known by different names:
      In RFC 3069 it is called VLAN Aggregation.
      Cisco and Allied Telesyn call it Private VLAN.
      Hewlett-Packard call it Source-Port filtering or port-isolation.
      Ericsson call it MAC-Forced Forwarding (RFC Draft).

添加此支持的上游提交是65324144b50bc7022cc9b6ca8f4a536a957019e3.

相关文章

linux常用进程通信方式包括管道(pipe)、有名管道(FIFO)、...
Linux性能观测工具按类别可分为系统级别和进程级别,系统级别...
本文详细介绍了curl命令基础和高级用法,包括跳过https的证书...
本文包含作者工作中常用到的一些命令,用于诊断网络、磁盘占满...
linux的平均负载表示运行态和就绪态及不可中断状态(正在io)的...
CPU上下文频繁切换会导致系统性能下降,切换分为进程切换、线...