微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐