设置如下:
每个NIC都连接到交换机。 这些服务器正在运行Ubuntu服务器。
两个网卡之一现在用于所有的stream量。
我想要的是两个本地服务器之间的所有通信使用第二个当前未使用的NIC; 我怎样才能做到这一点?
我尝试添加一个静态路由与路由命令,但没有那么多的成功…
你在正确的轨道上:静态路由绝对是你想用来确保这些主机之间的stream量在特定的接口上传输。 这里有一个可能有帮助的文档: http : //www.ubuntugeek.com/howto-add-permanent-static-routes-in-ubuntu.html
iproute2和iptables可以很灵活地做到这一点:
# Make a second routing table /usr/sbin/ip route flush table 2 # Set a new default route for this new table /usr/sbin/ip route add default via abcd dev eth5 table 2
然后:
# Make some packets use this table instead of the default table /usr/sbin/ip rule add from to $SUBNET table 2
要么:
# Mark some packets in iptables mangle /usr/sbin/iptables -t mangle -A PREROUTING -d $subnet -j MARK --set-mark 0x5 # make marked packets use this table /usr/sbin/ip rule add fwmark 5 table 2
(path可能在您的系统上有所不同,您可以通过在/etc/Networkmanager/dispatcher.d/或/ etc / network / interfaces中编写一个脚本,将其与NetworkManager集成为一个前置/后置处理规则)
我想下面捕获您当前的设置
|---------|-Nic1 \ | Server A| \ |---------|-Nic2 \--|----------| | Switch 1 | |------------| | |----| Firewall 1 | | | |------------| |---------|-Nic2 /--|----------| | Server B| / |---------|-Nic1 /
(服务器A)Nic 1 IP:10.20.X.2 / 24 Nic 2(未激活)默认GW 10.20.X.1(防火墙IP内)
(服务器B)Nic 1 IP:10.20.X.3 / 24 Nic 2(未激活)默认GW 10.20.X.1(防火墙内部IP)
您只需将每个服务器上的Nic2configuration到不同的子网,例如。 192.168.X.2和192.168.X.3。 通过这样做,两个节点之间的所有通信都将在其本地子网上,而不需要静态路由。
事实上,这种configuration是非常好的,因为它将私人stream量与公众分开。 另外如果你切换可以处理,如果你应该设置两个VLAN的每对尼克斯。
Ĵ
向专家提出两个问题:a)为什么不直接链接nic2,绕开开关? 也将减less交换机上的负载(如果可能的话)
b)为什么不编辑“/ etc / hosts”来指定“server2”到nic2地址。
例如:
服务器1
– nic1 = 10.1.2.3
– nic2 = 192.168.2.3Server2上
– nic1 = 10.1.2.4
– nic2 = 192.168.2.4
服务器1:/ etc / hosts文件
192.168.2.4 server2
服务器2:/ etc / hosts文件
192.168.2.3 server1
这将意味着“本地pipe理”,是的,但会保持交换机configuration清洁和简单,并保持交换机负载。
对不起,也许我完全误解了,但是你不能只使用一个内部的DNS名称到你的服务器(使用/ etc / hosts)映射到第二个NIC的IP地址吗?