在同一子网上配置 2 个 NIC

Configure 2 NIC on the same subnet

出于调试目的,我需要在 2 台设备之间设置 MITM 代理。 所有设备都有静态 IP(示例)并且相互直接连接:

Device 1 : 192.168.10.50
Device 2 : 192.168.10.60

代理计算机在同一子网上有 2 个网卡,并且在其他设备之间:
D1 .50 <=> [.60 PROXY .50] <=> D2 .60

我的问题是,如果 2 个网卡中的一个被禁用,D1 或 D2 可以从代理到达代理。
一旦我调出 2 nic,就没有人能看到任何其他设备。 D1和D2 ip不能改。

代理是linuxcentos 8.

已经测试过:

如果有人能帮忙。
谢谢.

我找到了一个解决方案,包括创建透明代理并拦截一些数据包。

1- 使用 2 NIC 创建网桥:

nmcli connection add type bridge autoconnect yes con-name "br0" ifname "br0"
nmcli connection modify "br0" ipv4.addresses "192.168.10.10/24" ipv4.method manual
nmcli connection delete enp0s3
nmcli connection delete enp0s8
nmcli connection add type bridge-slave autoconnect yes con-name enp0s3 ifname enp0s3 master br0
nmcli connection add type bridge-slave autoconnect yes con-name enp0s8 ifname enp0s8 master br0

2 添加正确的规则来拦截特定流量

nft add table bridge mitm
nft add chain bridge mitm filter { type filter hook prerouting priority 0\; }
nft add rule bridge mitm filter tcp dport 10000 ip saddr 192.168.10.50 meta pkttype set host ether daddr set xx:xx:xx:xx:xx:xx # br0 mac address
nft add rule ip nat PREROUTING tcp dport 10000 ip saddr 192.168.10.50 dnat to 192.168.10.10

它对我有用。