免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 914 | 回复: 0
打印 上一主题 下一主题

arp problems in linux [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-09-26 15:58 |只看该作者 |倒序浏览

                               
arp_filter:
               
when
                       
/proc/sys/net/ipv4/conf/DEV/arp_filter is set to 1
or
/proc/sys/net/ipv4/conf/all/arp_filter is set to 1
then the flag will cause any probe received on interface
        DEV to be dropped if the route from TARGET to SENDER points
        to different interface. With the usual local networks in
        table main in the form "from 0/0 to local_net lookup main"
        we see that the TARGET is ignored. As result, we drop
        probes received from SENDER that comes from wrong
        interface. As result, if the route from TARGET to
        SENDER1 is via DEV1 and from TARGET to SENDER2 is
        via DEV2, then we will reply only through one device
        for each of the senders. Of course, the arp_filter
        relies on the routing and as result the bahavior
        depends on the used ip rules and routes. The above
        is a simple example for normal local networks. The
        arp_filter simply checks the route for the reversed
        addresses. It should point to the input device.
                       
rp_filter:
               
        The rp_filter flag (DEV/rp_filter or all/rp_filter)
        set to 1 has similar semantic. It has nearly the same
        function as arp_filter and can control the ARP for
        the same purposes: symmetric talks (in and out using
        same device) but it covers the IP traffic too. It is
        assumed that where ARP is received (replied more
        exactly) there the IP traffic will be accepted too.
        It has mostly security function and can defend
        against IP spoofing. It controls the reverse path
        protection: we accept traffic from SENDER to TARGET
        received on DEV only when the reverse path (from
        TARGET to SENDER) points to the input interface
        DEV. It is used usually for "external" interfaces.
               
        How you can use it:
               
ifconfig eth0 192.168.1.2
ifconfig eth1 192.168.2.2
echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_filter
echo 1 > /proc/sys/net/ipv4/conf/eth1/arp_filter
arp_annouce and arp_ignore have been used in LVS commonly.
arp_announce - INTEGER
        Define different restriction levels for announcing the local
        source IP address from IP packets in ARP requests sent on
        interface:
        0 - (default) Use any local address, configured on any interface
        1 - Try to avoid local addresses that are not in the target's
        subnet for this interface. This mode is useful when target
        hosts reachable via this interface require the source IP
        address in ARP requests to be part of their logical network
        configured on the receiving interface. When we generate the
        request we will check all our subnets that include the
        target IP and will preserve the source address if it is from
        such subnet. If there is no such subnet we select source
        address according to the rules for level 2.
        2 - Always use the best local address for this target.
        In this mode we ignore the source address in the IP packet
        and try to select local address that we prefer for talks with
        the target host. Such local address is selected by looking
        for primary IP addresses on all our subnets on the outgoing
        interface that include the target IP address. If no suitable
        local address is found we select the first local address
        we have on the outgoing interface or on all other interfaces,
        with the hope we will receive reply for our request and
        even sometimes no matter the source IP address we announce.
        The max value from conf/{all,interface}/arp_announce is used.
        Increasing the restriction level gives more chance for
        receiving answer from the resolved target while decreasing
        the level announces more valid sender's information.
arp_ignore - INTEGER
        Define different modes for sending replies in response to
        received ARP requests that resolve local target IP addresses:
        0 - (default): reply for any local target IP address, configured
        on any interface
        1 - reply only if the target IP address is local address
        configured on the incoming interface
        2 - reply only if the target IP address is local address
        configured on the incoming interface and both with the
        sender's IP address are part from same subnet on this interface
        3 - do not reply for local addresses configured with scope host,
        only resolutions for global and link addresses are replied
        4-7 - reserved
        8 - do not reply for all local addresses
        The max value from conf/{all,interface}/arp_ignore is used
        when ARP request is received on the {interface}
Note:
1. The arp problem only occurs on Linux with kernels 2.2 and later.Other OS's honor the arp flag.
2. arp_ignore works only on physical interfaces. The old eth0:0 notation is a hang-over from the days of ip aliases, where in a round-about way you could establish virtual interfaces (sort of). These days an interface can have 0 or more addresses.  The arp_ignore semantics apply to such addresses.

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/42903/showart_390354.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP