`

多网卡在同一网段内的问题

 
阅读更多
arp_filter - BOOLEAN
        1 - Allows you to have multiple network interfaces on the same
        subnet, and have the ARPs for each interface be answered
        based on whether or not the kernel would route a packet from
        the ARP'd IP out that interface (therefore you must use source
        based routing for this to work). In other words it allows control
        of which cards (usually 1) will respond to an arp request.
        0 - (default) The kernel can respond to arp requests with addresses
        from other interfaces. This may seem wrong but it usually makes
        sense, because it increases the chance of successful communication.
        IP addresses are owned by the complete host on Linux, not by
        particular interfaces. Only for more complex setups like load-
        balancing, does this behaviour cause problems.
        arp_filter for the interface will be enabled if at least one of
        conf/{all,interface}/arp_filter is set to TRUE,
        it will be disabled otherwise
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}
 
嘿嘿,通过:
 
echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
 
or
 
echo 1 > /proc/sys/net/ipv4/conf/all/arp_filter
 
立即搞定!
 
继续 Google 了一些信息,发现前面两个内核控制好像是在 2.6.5 实现的 :-)
推荐用前面的两个,arp_filter应该也能解决,感觉前面的两个是对arp_filter的更细节控制的实现。
 
然后还发现在inter pro/1000的网卡驱动的安装指南里面也有一节:
Multiple Interfaces on Same Ethernet Broadcast Network
------------------------------------------------------
Due to the default ARP behavior on Linux, it is not possible to have
one system on two IP networks in the same Ethernet broadcast domain
(non-partitioned switch) behave as expected. All Ethernet interfaces
will respond to IP traffic for any IP address assigned to the system.
This results in unbalanced receive traffic.
If you have multiple interfaces in a server, either turn on ARP
filtering by entering:
echo 1 > /proc/sys/net/ipv4/conf/all/arp_filter
(this only works if your kernel's version is higher than 2.4.5),
or,
install the interfaces in separate broadcast domains (either
in different switches or in a switch partitioned to VLANs).

参考
http://linux-ip.net/html/ether-arp.html
http://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
分享到:
评论

相关推荐

    电脑PC与S7-200SMART PLC不在同一网段,如何建立通信连接?.docx

    解决这个问题的方法是配置多IP地址,使电脑能够在两个不同的网段之间切换。以下是具体操作步骤: 1. **开启网络和Internet设置**:在Windows系统中,可以通过右键点击任务栏右下角的网络图标,然后选择“打开网络和...

    双网卡同网段静态路由

    双网卡同网段静态路由是指在一个主机上安装有两个或更多网络接口卡(NICs),这些网卡可能连接到同一物理网络或不同物理网络中,但它们的IP地址位于同一网段内。这种情况下,主机可以同时作为多个子网的成员,并通过...

    实现单个网卡连接两个网段互通的方法步骤

    主要为大家介绍了主机不在同一网段内,即使通过交换机或集线器连接了也无法相互通信。那么怎么实现单个网卡连接两个网段呢?下面脚本之家的小编将会详细介绍其实现方法步骤

    双网卡网关设置

    正确设置双网卡的网关是实现多网段间数据传输的关键。通过上述步骤,可以有效地在Windows 2030系统上完成双网卡的网关设置,确保不同网络之间的通信顺畅无阻。同时,需要注意维护好系统的路由表,确保所有必要的路由...

    判断两个IP是否属于同一个子网(java)

    判断两个IP是否属于同一个子网(java) 简单代码

    两块网卡同时访问两个不同的网段.txt

    在同一网段内的设备可以直接通信,而跨网段通信则需通过路由器等设备进行中转。 ### 知识点二:配置双网卡访问不同网段 假设我们有两块网卡,分别连接到两个不同的网段,例如182.118.153.0/24和182.118.100.0/24。...

    linux CentOS配置双网卡,其中一个不能用问题

    CentOS中两个网卡配置的IP地址都在同一个网段中,导致其中一个网卡不能使用,一台双网卡的设备IP地址最好不要在在同一网段中。 当然,2个网卡配置在同一个网段是可以的,但不能设置一样的IP,也就不存在地址冲突问题...

    用单网卡连接两个网段的方法小技巧

    在同一个IP子网内的主机可以直接通信,但如果主机不在同一网段,即使物理上通过交换机或集线器连接,它们也无法直接通信,因为默认情况下路由器不会转发不同网段的IP数据包。要解决这个问题,可以通过配置一台具有...

    安装docker和桥接网卡容器和局域网同网段上网

    本教程将指导您如何安装Docker并配置桥接网卡容器,以便它们能够与局域网内的其他设备在同一网段中通信。 首先,我们来看"bash-completion-2.1-6.el7.noarch.rpm"这个文件。这是一个RPM软件包,用于增强Bash shell...

    多线程扫描网段内可用IP

    "多线程扫描网段内可用IP"是一个这样的过程,它利用多线程技术提高扫描速度,有效地遍历指定网络接口(网卡)所在网段内的所有可能IP地址,寻找活动的主机。这一技术尤其适用于大型网络环境,可以快速地获取网络拓扑...

    桥接虚拟局域网和真实局域网到同一网段原理分析

    桥接虚拟局域网(VLAN)与真实局域网(LAN)到同一网段的原理涉及到网络通信、数据包处理以及虚拟化技术的多个方面。要理解这一过程,首先需要弄清楚局域网和虚拟局域网的基本概念。 局域网(LAN)是一种覆盖较小区域的...

    笔记本双网卡虚拟机双网卡连接mini2440的设置方式图解

    我们手动设置虚拟机的eth1接口IP地址为与有线网卡在同一网段的地址,如192.168.1.101,同样设置对应的子网掩码。 完成以上步骤后,我们已经实现了以下网络连接: 1. 外网-〉路由器-〉主机无线网卡-〉虚拟机网卡1...

    为什么计算机无法搜索到同一局域网内的其他电脑.docx

    4. 网络组件安装问题:需要正确安装网络组件,选择要共享的网卡,并把 IP 设置在局域网的同一个网段上。然后看一下 TCP/IP 的高级属性中,是否开启 NETBIOS。 5. NETBIOS 名称解析问题:在利用 WINNT4.0 构建的网络...

    交换机的常见故障轻松排除.doc

    如果硬件无异常,可能是交换机设置了IP地址,确保交换机IP与设备在同一网段,或检查VLAN设置,确保所有设备在同一VLAN内。 2. FEC功能无法正常实现 双端口互联交换机出现一端口红灯的情况,通常是由于交换机检测到...

    虚拟机 和开发板 Pc机有无限网卡

    如果虚拟机、开发板和PC机的无线网卡都在同一网段,可以通过路由器进行连接。开发板可以通过有线连接到路由器,而虚拟机则使用桥接方式连接到PC机的无线网卡。这样,三者都能通过路由器进行通信,形成一个更复杂的...

    ZXG_MySniffer.rar_MFC抓包_TCP/IP_mfc udp_mxm zxg_窗口拆分

    4、 支持ARP查询功能,可多线程查询与本地以太网卡位于同一网段内的所有激活的主机MAC地址,查询进度动态显示; 5、 支持窗口拆分功能,可动态调整视图大小;记录鼠标移动位置,可在状态栏动态显示鼠标当前的屏幕...

    docker centos7 配置和宿主机同网段IP.pdf

    在本篇内容中,我们将讨论如何在CentOS 7上配置Docker,使容器与宿主机处于同一网段,从而实现更顺畅的网络通信。 首先,为了创建一个桥接网络,我们需要安装`brctl`命令,它是用于管理Linux桥接网络的工具。通过...

Global site tag (gtag.js) - Google Analytics