2 つのポート (eth1、eth2) を持つ 10G ネットワーク カードを使用してネットワーク テストを実行しようとしています。テストするには、iperf のようなものを使用して帯域幅テストを行います。
ポート 1(eth1) からポート 2(eth2) に直接ケーブルを接続します。
IP アドレス:
eth1: 192.168.20.1/24
eth2: 192.168.20.2/24
ターミナル1:
user@host:~$ iperf -s -B 192.168.20.1
ターミナル2:
user@host:~$ iperf -c 192.168.20.1
結果:
------------------------------------------------------------
Client connecting to 192.168.20.1, TCP port 5001
TCP window size: 169 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.20.1 port 53293 connected with 192.168.20.1 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 41.6 GBytes 35.7 Gbits/sec
ご覧のとおり、データはケーブルをまったく通過せず、ローカルホストまたはメモリのみを通過するため、10G を超える速度が得られます。
コマンド「iperf -c 192.168.20.1」から eth1 を非表示にして、データが強制的にケーブルを通過するようにすることは可能ですか?
更新 1:
@Mardanian による参照の後、次のことを試しました。
Note: Ports are now eth2/eth3 (not eth1/eth2)
eth2 has mac address 00:40:c7:6c:01:12
eth3 has mac address 00:40:c7:6c:01:13
ifconfig eth2 192.168.20.1/24 up
ifconfig eth3 192.168.20.2/24 up
arp -s 192.168.20.3 00:40:c7:6c:01:12
arp -s 192.168.20.4 00:40:c7:6c:01:13
ip route add 192.168.20.3 dev eth3
ip route add 192.168.20.4 dev eth2
iptables -t nat -A POSTROUTING -d 192.168.20.4 -j SNAT --to-source 192.168.20.3
iptables -t nat -A POSTROUTING -d 192.168.20.3 -j SNAT --to-source 192.168.20.4
iptables -t nat -A PREROUTING -d 192.168.20.3 -j DNAT --to-destination 192.168.20.1
iptables -t nat -A PREROUTING -d 192.168.20.4 -j DNAT --to-destination 192.168.20.2
iperf -s -B 192.168.20.3
bind failed: Cannot assign requested address
これらのダミー アドレスは正しく機能していないようです。それらをバインドしたり、ping を実行したりすることさえできないようです。
arp -an
? (192.168.20.3) at 00:40:c7:6c:01:12 [ether] PERM on eth2
? (192.168.20.4) at 00:40:c7:6c:01:13 [ether] PERM on eth3
私が理解している限り、arpはIPアドレスをインターフェイスにバインドしません。特定のIPを見つけるために、どのインターフェイスを通過するかをシステムに知らせるだけです。そのため、にバインドできませんダミーの IP アドレス。実際の IP アドレスにバインドすると、ローカル システムを経由することになります。