小编Rus*_*hPL的帖子

利用同一网络上的两个网关与负载平衡相同的接口

我的设置是单个接口和单个网络上的两个 ISP。我可以将我的默认网关设置为192.168.0.1192.168.1.250并且要么工作。

编辑:网络掩码(如评论中所见)is 255.255.254.0-正如我所说,它们位于同一个子网上。

我的愿望是通过一些负载平衡来利用它们。我试图遵循这里给出的建议 https://serverfault.com/a/96586

#!/bin/sh                                                                                                                                                                                                                        
ip route show table main | grep -Ev '^default' \                                                                                                                                                                                 
   | while read ROUTE ; do                                                                                                                                                                                                       
     ip route add table ISP1 $ROUTE                                                                                                                                                                                              
done                                                                                                                                                                                                                             
ip route add default via 192.168.1.250 table ISP1                                                                                                                                                                                
ip route add default via 192.168.0.1 table ISP2                                                                                                                                                                                  

iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark                                                                                                                                                                      
iptables -t mangle -A PREROUTING -m mark ! --mark 0 -j ACCEPT                                                                                                                                                                    
iptables -t mangle -A PREROUTING -j MARK …
Run Code Online (Sandbox Code Playgroud)

iptables load-balancing gateway iproute2

7
推荐指数
1
解决办法
4479
查看次数

标签 统计

gateway ×1

iproute2 ×1

iptables ×1

load-balancing ×1