openwrt mwan3配置

來源:互聯網
上載者:User

http://www.right.com.cn/forum/forum.php?mod=viewthread&tid=178799

# 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、wan2Server Load Balancer)
        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將使每一個新的包走同一個目標主機地址來到達Server Load Balancer,如果沒有設定,那麼mwan3會根據目標地址自動Server Load Balancer)
# 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'

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.