openwrt上網配置的一些理解(三)

接着上面的繼續搗騰multiwan,首先考慮一下上一篇中記錄的multiwan配置,這裏的配置是否正確,得研究一下。先貼一下上一篇的配置文件,以下:php

config 'multiwan' 'config'
    option 'default_route' 'balancer'
    # health_monitor below is defaulted to parallel, and can be set to
    # serial to save system resources.
    # option 'health_monitor' 'serial'
    # option 'debug' '1'

config 'interface' 'wan'
    option 'weight' '1'
    option 'health_interval' '10'
    option 'icmp_hosts' 'gateway'
    # icmp_count is defaulted to 1, and can be increased to reduce
    # false positives.
    # option 'icmp_count' '3'
    option 'timeout' '3'
    option 'health_fail_retries' '3'
    option 'health_recovery_retries' '5'
    option 'failover_to' 'wan1'
    option 'dns' 'auto'

config 'interface' 'wan1'
    option 'weight' '1'
    option 'health_interval' '10'
    option 'icmp_hosts' 'gateway'
    option 'timeout' '3'
    option 'health_fail_retries' '3'
    option 'health_recovery_retries' '5'
    option 'failover_to' 'wan2'
    option 'dns' 'auto'

config 'interface' 'wan2'
    option 'weight' '1'
    option 'health_interval' '10'
    option 'icmp_hosts' 'gateway'
    option 'timeout' '3'
    option 'health_fail_retries' '3'
    option 'health_recovery_retries' '5'
    option 'failover_to' 'wan'
    option 'dns' 'auto'

#config 'mwanfw'
#    option 'src' '192.168.1.0/24'
#    option 'dst' 'ftp.netlab7.com'
#    option 'proto' 'tcp'
#    option 'ports' '21'
#    option 'wanrule' 'lan'

# VoIP traffic goes through wan
# config 'mwanfw'
    # option 'src' '192.168.1.0/24'
    # option 'proto' 'udp'
    # option 'port_type' 'source-ports'
    # option 'ports' '5060,16384:16482'
    # option 'wanrule' 'wan'

config 'mwanfw'
#    option 'src' '192.168.0.3'
#    option 'proto' 'icmp'
    option 'wanrule' 'balancer'

config 'mwanfw'
#    option 'dst' 'www.whatismyip.com'
    option 'wanrule' 'fastbalancer'

仍是在網上找找有沒有相關人士作過這個:網絡

http://www.openwrt.org.cn/bbs/forum.php?mod=viewthread&tid=9848&extra=&page=1實驗多WAN帶寬疊加——Multiwan篇tcp

這個帖子作實驗很嚴謹,因而我跟着作了跟我網絡環境對應的實驗,發現確實是不行的。固然根據帖子我把multiwan修改了,就是把failover_to所有修改爲balancer。可是仍是不行。後來我在http://wiki.openwrt.org/doc/uci/multiwan看到這麼一句話:Note: Multiwan will NOT work if the WAN connections are on the same subnet and share the same default gateway.ide

個人是啥狀況:用一張圖來講明個人網絡。spa

3個wan口,所有連上時,都會走eth1,也就是wan口,拔掉wan口網線,ping 百度不通,ping219.245.65.89能夠回來一個數據,而後中止。很明顯沒有自動切換,可是不知道有沒有疊加,其實我不關心疊不疊加,我只關心我隨便插哪一個,他就用哪一個,我是要確保網絡暢通。因此還得繼續想辦法。.net

根據帖子的內容我又進一步瞭解了下ip route。結果以下:debug

ip route show table 170
192.168.2.0/24 dev br-lan    proto kernel    scope    link      src    192.168.2.1
192.168.1.0/24 dev eth2     proto kernel     scope    link     src  192.168.1.247
default    proto    static
    nexthop    via    192.168.1.1    dev    eth1    weight    1
    nexthop     via     192.168.1.1    dev    eth2 weight    1
    nexthop     via     192.168.1.1    dev    eth3 weight    1
ip route show table    171
192.168.2.0/24    dev    br-lan    proto    kernel    scope    link    src    192.168.2.1
192.168.1.0/24    dev    eth1        proto    kernel    scope    link    src    192.168.1.247
Default    via    192.168.1.1    dev    eth1    proto    static    src    192.168.1.247
ip route show table 172
192.168.2.0/24    dev    br-lan    proto    kernel    scope    link    src    192.168.2.1
192.168.1.0/24    dev    eth1        proto    kernel    scope    link    src    192.168.1.247
Default    via    192.168.1.1    dev    eth1    proto    static    src    192.168.1.248
ip route show table 173
192.168.2.0/24    dev    br-lan    proto    kernel    scope    link    src    192.168.2.1
192.168.1.0/24    dev    eth1        proto    kernel    scope    link    src    192.168.1.247
Default    via    192.168.1.1    dev    eth1    proto    static    src    192.168.1.249

就是都會往eth1走,因此,把wan拔了確定就有問題。回去檢查了下multiwan,由於這個文件仍是上一次的,只是根據這個帖子修改了failover_to,都改爲balancer了,那麼再看看這個帖子:http://www.openwrt.org.cn/bbs/forum.php?mod=viewthread&tid=14861&page=1&extra=#pid108970code

裏面multiwan的第一項中,我少了個option enabled 1.加上一試,還真是,我拿luci界面進行3個wan口的connect和stop。發現能夠了,我把任意兩個關了,仍是能夠上網。那就知足個人要求了,不過仍是要研究一下luci界面機制。仍是記錄一下multiwan。blog

config 'multiwan' 'config'
    option 'default_route' 'balancer'
    # health_monitor below is defaulted to parallel, and can be set to
    # serial to save system resources.
    # option 'health_monitor' 'serial'
    option 'enabled' '1'

config 'interface' 'wan'
    option 'weight' '1'
    option 'health_interval' '10'
    option 'icmp_hosts' 'gateway'
    # icmp_count is defaulted to 1, and can be increased to reduce
    # false positives.
    # option 'icmp_count' '3'
    option 'timeout' '3'
    option 'health_fail_retries' '3'
    option 'health_recovery_retries' '5'
    option 'failover_to' 'balancer'
    option 'dns' 'auto'

config 'interface' 'wan1'
    option 'weight' '1'
    option 'health_interval' '10'
    option 'icmp_hosts' 'gateway'
    option 'timeout' '3'
    option 'health_fail_retries' '3'
    option 'health_recovery_retries' '5'
    option 'failover_to' 'balancer'
    option 'dns' 'auto'

config 'interface' 'wan2'
    option 'weight' '1'
    option 'health_interval' '10'
    option 'icmp_hosts' 'gateway'
    option 'timeout' '3'
    option 'health_fail_retries' '3'
    option 'health_recovery_retries' '5'
    option 'failover_to' 'balancer'
    option 'dns' 'auto'

#config 'mwanfw'
#    option 'src' '192.168.1.0/24'
#    option 'dst' 'ftp.netlab7.com'
#    option 'proto' 'tcp'
#    option 'ports' '21'
#    option 'wanrule' 'lan'

# VoIP traffic goes through wan
# config 'mwanfw'
    # option 'src' '192.168.1.0/24'
    # option 'proto' 'udp'
    # option 'port_type' 'source-ports'
    # option 'ports' '5060,16384:16482'
    # option 'wanrule' 'wan'

config 'mwanfw'
#    option 'src' '192.168.0.3'
#    option 'proto' 'icmp'
    option 'wanrule' 'balancer'

config 'mwanfw'
#    option 'dst' 'www.whatismyip.com'
    option 'wanrule' 'fastbalancer'

接下來還要把3g上網的也加進來試試。dns

相關文章
相關標籤/搜索