Debian,2 个 NIC 负载平衡或与同一个网关聚合

Debian,2 个 NIC 负载平衡或与同一个网关聚合

我有一台服务器,它有双网卡,连接到一个具有相同网关的交换机。交换机后面有互联网。

|Debian| -> eth0 -> 交换机 -> internet -> eth1 -> 相同

我不明白如何在 eth0 和 eth1 之间进行负载平衡。入站/出站流量始终使用 eth1。

这是配置:

# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
address 192.168.248.82
netmask 255.255.255.240
network 192.168.248.80
broadcast 192.168.248.95
gateway 192.168.248.81

allow-hotplug eth1
auto eth1
iface eth1 inet static
address 192.168.248.83
netmask 255.255.255.240
network 192.168.248.80
broadcast 192.168.248.95
gateway 192.168.248.81

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.248.80 0.0.0.0 255.255.255.240 U 0 0 0 eth1
192.168.248.80 0.0.0.0 255.255.255.240 U 0 0 0 eth0
0.0.0.0 192.168.248.81 0.0.0.0 UG 0 0 0 eth1
0.0.0.0 192.168.248.81 0.0.0.0 UG 0 0 0 eth0

Ips 不是真实的,它仅用于示例。

有人知道在 192.168.248.82 上使用 eth0 和在 192.168.248.83 上使用 eth1 的正确路由吗?我有很多多个网关的例子,但这里是一样的。

谢谢大家。

问候

答案1

简而言之,你真的不能这么做。事物的设计并不是那样运作的。

是的,Linux 非常灵活,因此您可能会找到一些非常模糊的方法来实现您想要的一些行为,但将这两个链接结合在一起会更好。

答案2

要执行您想要的操作,您可能需要查看有关多个 ISP 连接的一些文档。这些概念可能与您尝试执行的操作非常接近。这Shorewall 多重IPS文档可能会给你一些关于如何去做的想法。

相关内容