|
# This is a mwan3 example config. For mwan3 to work you will need at least这是mwan3的设置示例。至少需要以下几项才能运行mwan3)
#
# - 2 interfaces(2个接口)
# - 2 members(2个成员)
# - 1 policy(1个策略)
# - 1 rule(1条规则)
#
# First define all your wan interfaces. Interface name must match with the
# name used in your network configuration:
(首先要设置所有的wan口,wan口的名字必须跟network配置文件中的wan口名字一致)
config 'interface' 'wan1'
option 'enabled' '1'
list 'track_ip' '8.8.4.4'(这些IP都是测试IP,验证是否能ping的通。这里有4个,前两个都是google提供的免费DNS服务器,国内访问应该比较慢。)
list 'track_ip' '8.8.8.8'
list 'track_ip' '208.67.222.222'
list 'track_ip' '208.67.220.220'
option 'reliability' '2'(可靠性,测试以上IP的可靠性,必须是有响应的链接的个数。简单说就是要求上面的ip几个能ping通)
option 'count' '1'(ping几次)
option 'timeout' '2'(ping后如果超时,超时几秒)
option 'interval' '5'(多次ping之间的间隔时间)
option 'down' '3'(出现几个ping不通时就认定该wan口掉线了)
option 'up' '8'(出现几个ping能成功时就认定已经掉线的wan口又上线了)
config 'interface' 'wan2'
option 'enabled' '1'
list 'track_ip' '8.8.8.8'
list 'track_ip' '208.67.220.220'
option 'reliability' '1'
option 'count' '1'
option 'timeout' '2'
option 'interval' '5'
option 'down' '3'
option 'up' '8'
# Next define a member and configure metric and weight values for this member.(接着设置一个成员的权重和跃点值)
# Each interface can have multiple member definitions. Give each member a correct(每一个接口可以含有多重成员定义。每一个成员名称必须有正确的名称)
# name (A-Z, a-z, 0-9, "_" and no spaces).
config 'member' 'wan1_m1_w3'
option 'interface' 'wan1'
option 'metric' '1'(1-1000的范围)
option 'weight' '3'(1-1000的范围)
config 'member' 'wan1_m2_w3'
option 'interface' 'wan1'
option 'metric' '2'
option 'weight' '3'
config 'member' 'wan2_m1_w2'
option 'interface' 'wan2'
option 'metric' '1'
option 'weight' '2'
config 'member' 'wan2_m2_w2'
option 'interface' 'wan2'
option 'metric' '2'
option 'weight' '2'
# After that create a routing policy. A routing policy consist of one or more(然后创建一条路由策略。包括一个或者几个成员。每个策略必须有正确的名称。可以创建多重策略,以至于可以使不同的通信走不同的主/次wan口)
# members. Give each policy a correct name (A-Z, a-z, 0-9, "_" and no spaces). You
# can create multiple policies, so that it is possible for different traffic to
# have different primary and/or backup interfaces.
config 'policy' 'wan1_only'(只走wan1)
list 'use_member' 'wan1_m1_w3'
config 'policy' 'wan2_only'(只走wan2)
list 'use_member' 'wan2_m1_w2'
config 'policy' 'wan1_wan2_loadbalanced'(wan1、wan2负载平衡)
list 'use_member' 'wan1_m1_w3'
list 'use_member' 'wan2_m1_w2'
config 'policy' 'wan1_pri_wan2_sec'(wan1主,wan2次)
list 'use_member' 'wan1_m1_w3'
list 'use_member' 'wan2_m2_w2'
config 'policy' 'wan2_pri_wan1_sec'(wan2主,wan1次)
list 'use_member' 'wan1_m2_w3'
list 'use_member' 'wan2_m1_w2'
# And to finish the config define your traffic rules. Rules are matched in top to(最后来设置通信规则。他是从你设置的规则由上到下依次匹配,如果你定义的一条规则匹配上了,后面的规则都将忽略。如果平衡选项已经设置,mwan3将使每一个新的包走同一个目标主机地址来到达负载平衡,如果没有设置,那么mwan3会根据目标地址自动负载平衡)
# bottom order. If you define a rule and it matches, all following rules are ignored.
#
# If the option equalize is set, mwan3 will load-balance each new session to the same
# host. If not set, it will load-balance based on destination.
config 'rule'
option 'src_ip' '192.168.21.0/24'(源IP,支持网段的表示方法)
option 'proto' 'tcp'(指定协议)
option 'dest_port' '563'(目标端口)
option 'use_policy' 'wan2_only'(指定走上面设定的哪个策略)
config 'rule'
option 'src_ip' '192.168.21.0/24'
option 'proto' 'tcp'
option 'dest_port' '995'
option 'use_policy' 'wan1_only'
config 'rule'
option 'dest_ip' '88.154.0.0/16'(目标IP)
option 'proto' 'tcp'
option 'dest_port' '1024:65535'(1024-65535的所有端口)
option 'equalize' '1'(1为选中。如果选中,mwan3将使每一个新的包走同一个目标主机地址来到达负载平衡。如果没有,那么mwan3会根据目标地址自动负载平衡)
option 'use_policy' 'wan1_wan2_loadbalanced'
config 'rule'
option 'dest_ip' '77.11.41.0/24'
option 'proto' 'tcp'
option 'dest_port' '1024:65535'
option 'use_policy' 'wan1_pri_wan2_sec'
config 'rule'
option 'dest_ip' '112.136.0.0/16'
option 'proto' 'udp'
option 'dest_port' '5352'
option 'use_policy' 'wan2_pri_wan1_sec'
config 'rule'
option 'dest_ip' '0.0.0.0/0'
option 'use_policy' 'wan1_wan2_loadbalanced'
|
|