1. 程式人生 > >Linux多網絡卡同網段問題

Linux多網絡卡同網段問題

net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 1
net.ipv4.conf.default.arp_announce = 1
net.ipv4.conf.all.rp_filter = 0

net.ipv4.conf.default.rp_filter = 0

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}

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.

rp_filter - INTEGER
0 - No source validation.
1 - Strict mode as defined in RFC3704 Strict Reverse Path
   Each incoming packet is tested against the FIB and if the interface
   is not the best reverse path the packet check will fail.
   By default failed packets are discarded.
2 - Loose mode as defined in RFC3704 Loose Reverse Path
   Each incoming packet's source address is also tested against the FIB
   and if the source address is not reachable via any interface
   the packet check will fail.


Current recommended practice in RFC3704 is to enable strict mode
to prevent IP spoofing from DDos attacks. If using asymmetric routing
or other complicated routing, then loose mode is recommended.


conf/all/rp_filter must also be set to non-zero to do source validation
on the interface


Default value is 0. Note that some distributions enable it
in startup scripts.

兩塊網絡卡在同一網段會出現一塊斷線但是ping這塊網絡卡的ip依然能夠ping通,這兩個ip被指向了同一的MAC地址

eth0 192.168.1.10
eth1 192.168.1.11

echo "252    net2" >> /etc/iproute2/rt_tables
echo "251    net3" >> /etc/iproute2/rt_tables


ip route add 192.168.1.0/24 dev eth0 src 192.168.1.10 table net2
ip route add 192.168.1.0/24 dev eth1 src 192.168.1.253 table net3
ip route add default dev eth0 table net2
ip route add default dev eth1 table net3

ip rule add from 192.168.1.10 table net2
ip rule add from 192.168.1.11 table net3

ip route flush cache

ping通,然後arp驗證mac地址不一樣

arp -a


相關推薦

Linux問題

net.ipv4.conf.all.arp_ignore = 1 net.ipv4.conf.default.arp_ignore = 1 net.ipv4.conf.all.arp_announce = 1 net.ipv4.conf.default.arp_announ

關於雙的廣播問題

//server.cpp #include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #in

linux 獲取eth0(指定的IP地址(或MAC地址)

引言 使用場景: 我使用的Linux伺服器上有多個網絡卡,有時候就需要在指令碼中使用到指定網絡卡的IP地址或MAC地址,那麼這個時候就有兩種做法,一是預先讀取網絡卡的IP地址或MAC地址,然後寫入到指令碼中;另外一種方法就是通過shell命令實時獲取指定網絡卡上的當前

指定傳送資料包 C# 實現程式碼

其實簡單,,,我看了網上很多人都在問這個事,,, 現在,貼出個小程式碼,,給大家,udp 的 using System; using System.Collections.Generic; using System.Text; using System.Net.Socket

設定 的高階設定說明

網絡卡設定 網絡卡的高階設定說明 注意: RTL8101E、RTL8102E及RTL8139系列網絡卡為10/100 Mbp,所以並不支援Gigabit的聯接速度。 自動關閉 PCIe (省電)設定此選項可進入網路控制器省電模式設定此選項可進入網路卡省電模式 選項 說明關閉 關閉自動關閉PCIe (省電)

centos7修改名稱、繫結

Linux系統在大多數企業運用中都佔據著及其重要的作用,但是從centos7開始我們發現安裝完作業系統後,網絡卡名稱發生了變化,不在是以前的eth0這樣命名了。這對於我們使用起來有很多的不便。 本文將介紹如何修改網絡卡名稱,及雙網絡卡繫結。 [[email pro

Centos 7.5 雙內外同時訪問路由設定

說明:伺服器有兩張網絡卡分別是eth0、eth1,eth0配置內網IP:192.168.1.1/24,eth1配置外網IP:10.1.1.1/24;要求192.168.0.0/16網段走網絡卡eth0,閘道器是192.168.1.254,其餘網段走網絡卡eth1

VMware克隆虛擬機器後再新增1塊,雙機器無法啟動解決辦法

ESX 4.1版本虛擬主機,使用Vsphere Client登入 Vcenter登入,虛擬機器克隆後又新增了一個168網絡卡,起先兩個網絡卡地址配顛倒了,竟然eth1配192.168.*.107網絡卡可以聯通,奇怪 168網絡卡eth1:mac地址00:50:56:80:

完美解決ARM上Linux/雙不能工作在同一的問題

       首先,要丟擲的一個問題,在多網口的ZYNQ開發板上,當五個網口處於同一個網段時,它們之間是完全能夠相互ping通。關於同一網段的測試在網口測試報告中已做詳細說明,接下來新增路由表後的測試結果。 修改路由表:        在開發板上使用指令“route ad

Linux不同IP在同一的情況

關鍵字:Strict Interface ARP, Multi-link, Multipath, Multiple network cards on same subnet problem 公司那個提供音樂下載的域名流量直逼1Gbps,但是系統的連線卻不高,伺服器用的是DELL2850的,板載兩個Gbe的

Linux中高階網路配置-team方式繫結

team簡介 在redhat7.0以上版本,配置多網絡卡繫結時,專門提供了team工具來實現多網絡卡的繫結。 team :也是鏈路聚合 最多支援8塊網絡卡,不需要手動載入相應核心模組 支援模式: broadcast 廣播容錯 roundrobin 輪詢

02 Linux 繫結

 Linux 多網絡卡繫結 網絡卡繫結mode共有七種(0~6) bond0、bond1、bond2、bond3、bond4、bond5、bond6 常用的有三種 mode=0:平衡負載模式,有自動備援,但需要”Switch”支援及設定。 mode=1:自

Linux 系統銳捷有線認證個IP被迫下線

問題描述 檢視獲取到的IP顯示,確實是有兩個IP ip 指令系統自帶,但是ifconfig需要第三方安裝 解決方法 刪除有線網絡卡的第一個IP即可 注意,需要許可權,而且刪除第一個IP,刪除第二個還是會一會掉線 但是:還

Linux 下單配置ip

我們在使用Linux系統的時候會遇到單網絡卡配置多個ip地址的問題,Linux下邊如果沒有圖形介面,配置還真的不太方便。文字控制檯下面有netconfig,還有ifconfig工具,netconfig圖形化的稍微方便些,但是沒有文件,配置一個ip還能應付,但是如果配置多個IP

Linux--的7種Bond模式

網絡卡bond是通過把多張網絡卡繫結為一個邏輯網絡卡,實現本地網絡卡的冗餘,頻寬擴容和負載均衡。在應用部署中是一種常用的技術,我們公司基本所有的專案相關伺服器都做了bond,這裡總結整理,以便待查。 bond模式: Mode=0(balance-rr) 表示負載分擔round-ro

Linux繫結

載入bonding模組,options裡的一些引數的含義: miimon 監視網路連結的頻度,單位是毫秒。 max_bonds 配置的bond口個數 mode bond模式,在一般的實際應用中,0和1用的比較多。 bond模式:常用的有三種 mode=0:平衡負載模式,有自動備援,但需要”Swi

Linux 配置ip 子介面 繫結

linux系統配置ip地址,圖形化介面略過,這裡只介紹文字行。做以下設定注意是否有此許可權檢視當前路由及閘道器資訊: [[email protected] ~]# netstat -r Kernel IP routing table Destination Gateway G

使用Linux 策略路由配置路由

【問題場景】        專案中遇到一個路由配置問題,一臺Linux使用多網絡卡,每個網絡卡配置在不同的網路平面,比如兩個網絡卡,網絡卡1連線內網閘道器,網絡卡2連線外網閘道器,系統的預設路由為網絡卡1連線的內網閘道器。現在上層應用想通過網絡卡2登入到一個外網系統。外網只

linux 傳送udp廣播

一、客戶端程式碼 #include <stdio.h> #include <netdb.h> #include <time.h> #include <sys/types.h> #include <sys/socket.h

佇列簡介以及Linux通過傳送資料包原始碼解讀

摘自:http://blog.csdn.net/yanghua_kobe/article/details/7485254  首先我們看一下一個主流多佇列網絡卡(E1000)跟多核CPU之間的關係圖: 非多佇列: linux的網絡卡由結構體net_device