上一篇里面遇到了只能静态上网的问题,动态不行。因此再接再励,问题老是要解决的,偷懒的下场就是一直停留在菜鸟的水平。编程
首先分析下问题,要动态上网,首先我要明确不是动态获取不了IP,是获取了,上不了外网。那么问题就不会在lan口的配置上了,确定是wan口,再来看咱们的wan口配置。都同样,ifconfig|more,看了一下,eth1,eth2,eth3竟然HWaddr都是00:A0:C9:00:00:00,不知道这样会不会影响上外网,可是确定不对吧,因此我改了下:网络
config interface wan option ifname eth1 option proto dhcp option macaddr 00:A0:C9:00:00:0A config interface wan option ifname eth1 option proto dhcp option macaddr 00:A0:C9:00:00:0B config interface wan option ifname eth1 option proto dhcp option macaddr 00:A0:C9:00:00:0C
没别的就是各加了个mac地址。tcp
那么再试一下,果真都有本身的IP地址了,虽然个人lan口仍是不能上外网。spa
那么主机ping一下,这里的主机其实就是咱们的CPU,以前一直觉得是网卡在ping。主机ping通外网了。动态获取了IP了,那么问题确定在数据流向了。他到了咱们主机这里,并且主机能够上外网了,那么确定就是lan口和wan口数据不通了,一顿百度和谷歌,以为有多是firewall的问题,并且咱们这里有3个wan口,那么后面的配置确定还和multiwan有关,那么就去看/etc/config目录下firewall和multiwan这两个文件。.net
首先我发现以前第一篇的wan配置是否是有点麻烦,每一个口都写zone和forwarding,看到网上其余人不用这么麻烦,因此精简成下面这样,试了一下,发现不影响,后来把forward那个reject编程ACCEPT,平板上网了。debug
config zone option name wan option network ‘wan wan1 wan2’ option input REJECT option output ACCEPT option forward ACCEPT option masq 1 option mtu_fix 1
不过我还改了multiwan,可是我不认为multiwan是让我能够上网的缘由。rest
那么multiwan是干什么的呢,初步分析认为,他是用来进行多wan口上网时进行流量均衡和wan口切换用的。个人配置了下,发现达到网上某些人说的多wan了,看了下3个wan口还真是都在走流量。在总的status里面MultiWAN-Status,3个wan,wan1,wan2都绿了,可是我试了,我把wan口拔掉,而后上网,不行,得从新启动下网络,防火墙和multiwan,/etc/init.d/network(firewall,multiwan) restart,而后才又能够上网,这明显不是multiwan的做用。至于怎么配置,继续探索一下。code
这里记录下整个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 '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'