zoukankan      html  css  js  c++  java
  • openwrt上网配置的一些理解(三)

    接着上面的继续捣腾multiwan,首先考虑一下上一篇中记录的multiwan配置,这里的配置是否正确,得研究一下。先贴一下上一篇的配置文件,如下:

    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篇

    这个帖子做实验很严谨,于是我跟着做了跟我网络环境对应的实验,发现确实是不行的。当然根据帖子我把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.

    我的是啥情况:用一张图来说明我的网络。

    3个wan口,全部连上时,都会走eth1,也就是wan口,拔掉wan口网线,ping 百度不通,ping219.245.65.89可以回来一个数据,然后停止。很明显没有自动切换,但是不知道有没有叠加,其实我不关心叠不叠加,我只关心我随便插哪个,他就用哪个,我是要确保网络畅通。所以还得继续想办法。

    根据帖子的内容我又进一步了解了下ip route。结果如下:

    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=#pid108970

    里面multiwan的第一项中,我少了个option enabled 1.加上一试,还真是,我拿luci界面进行3个wan口的connect和stop。发现可以了,我把任意两个关了,还是可以上网。那就满足我的要求了,不过还是要研究一下luci界面机制。还是记录一下multiwan。

    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上网的也加进来试试。

  • 相关阅读:
    du
    date
    echo
    redis的多实例
    redis相关配置
    mariadb的安装与主从复制
    11.Flask-钩子函数
    Python之Linux下的virtualenv&&virtualenvwrapper
    Linux的防火墙概念
    安装ipython解释器
  • 原文地址:https://www.cnblogs.com/preorder69/p/3731030.html
Copyright © 2011-2022 走看看