Show pagesourceOld revisionsBacklinksBack to top × Table of Contents Multiwan Установка Посредством графического интерфейса LuCI Посредством командной строки (CLI) Настройка Основные настройки Интерфейс WAN Правила для исходящего трафика Quick Multiwan setup guide by AndyBallon Under Construction! This page is currently under construction. You can edit the article to help completing it. Multiwan Конфигурационный файл /etc/config/multiwan является частью пакета multiwan. Этот пакет представляет собой скрипт, который позволяет сделать конфигурацию с несколькими провайдерами простой и легко управляемой. Пакет multiwan содержит легко настраиваемый набор правил распределения нагрузки и отказоустойчивости. Установка Посредством графического интерфейса LuCI В LuCI выполните шаги: System → Software → Update package lists System → Software → Available packages → Найдите пакет luci-app-multiwan → Нажмите Install В результате будет установлен пакет multiwan и пакет управления им через LuCI luci-app-multiwan. После установки при очередном обновлении веб-страницы, Вы сможете настраивать пакет multiwan на странице Network → Multi-WAN Посредством командной строки (CLI) Выполните команды: opkg update opkg install multiwan /etc/init.d/multiwan enable /etc/init.d/multiwan start /etc/init.d/multiwan single Настройка Основные настройки В файле /etc/config/multiwan (по умолчанию маршрутизировать трафик через оба интерфейса WAN) config 'multiwan' 'config' option 'default_route' 'balancer' Имя параметра Значение по умолчанию Варианты значения Описание default_route balancer balancer/fastbalancer/<interface> Выберите, как (куда) маршрутизировать трафик по умолчанию (то есть трафик, не регулируемый отдельными правилами) health_monitor parallel parallel/serial Мониторинг линков: параллельный или последовательный. Влияет на использование памяти. debug 0 0/1 Выводить отладочные сообщения в лог lan_if lan <firewall lan zone> Интерфейс LAN В командной строке (выставляем последовательный мониторинг живости линка): uci set multiwan.config.health_monitor=serial uci commit multiwan /etc/init.d/multiwan restart * Распределение нагрузки посредством netfilter называется Fast Balancer (лучшее распределение) * Распределение нагрузки посредством iproute2 называется Load Balancer (лучшая совместимость) * Правило wanrule для Fast Balancer - “fastbalancer” * Правило wanrule для Load Balancer - “balancer” Казалось бы, что fastbalancer должен давать лучший результат, но в действительности Вам нужно попробовать оба варианта, чтобы понять, какой из них лучше всего подходит для вашей ситуации. Интерфейс WAN config 'interface' 'wan' option 'weight' '10' option 'health_interval' '10' option 'icmp_hosts' 'dns' 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' '10' option 'health_interval' '10' option 'icmp_hosts' 'dns' option 'timeout' '3' option 'health_fail_retries' '3' option 'health_recovery_retries' '5' option 'failover_to' 'wan' option 'dns' 'auto' Имя параметра Значение по умолчанию Варианты значения Описание weight 10 disable/1-10 Load Balancer Distribution health_interval 10 disable/5/10/20/30/60/120 Health Monitor Interval in seconds icmp_hosts ? disable/dns/gateway/<host> Health Monitor ICMP Host(s) timeout ? disable/1-5/10 Health Monitor ICMP Timeout health_fail_retries ? 1/3/5/10/15/20 Attempts Before WAN Failover health_recovery_retries ? 1/3/5/10/15/20 Attempts Before WAN Recovery failover_to ? disable/balancer/fastbalancer/<interface> Failover Traffic Destination dns auto auto/<dns> DNS Server(s) uci delete multiwan.wan2 uci set multiwan.wwan=interface uci set multiwan.wwan.weight=3 uci set multiwan.wwan.health_interval=disable uci set multiwan.wwan.icmp_hosts=disable uci set multiwan.wwan.timeout=3 uci set multiwan.wwan.health_fail_retries=3 uci set multiwan.wwan.health_recovery_retries=5 uci set multiwan.wwan.failover_to=fastbalancer uci set multiwan.wwan.dns=auto uci commit multiwan /etc/init.d/multiwan restart Для соединений 3G полезно указать серверы DNS вручную для каждого интерфейся WAN (в конфигурации multiwan). При использовании двух или нескольких модемов 3G вам нужно добавить для каждого интерфейса WAN следующие правила в /etc/config/network: option 'peerdns' '0' option 'defaultroute' '0' Правила для исходящего трафика Если несколько правил перекрываются, действует правило, расположенное последним в файле конфигурации. ( not clear enough.) 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' Имя параметра Значение по умолчанию Варианты значения Описание src all all/<IP>/<hostname> Адрес источника: all (любой), адрес IP либо имя хоста dst all all/<IP>/<hostname> Адрес получателя: all (любой), адрес IP либо имя хоста port_type dports dports/source-ports Тип порта: порт источника или порт получателя ports all all/<port,port:range> Номера портов: все, один либо диапазон proto all all/tcp/udp/icmp/<custom> Протокол: все, мнемоническое имя из /etc/protocols либо номер wanrule balancer/fastbalancer/<interface> Правило распределения WAN: балансировка iproute2 или iptables, либо имя интерфейса failover_to balancer/fastbalancer/<interface> Резервный линк при отказе этого линка failover_to реализован патчем multiwan_per_mwanfw_failover.patch.txt uci add multiwan mwanfw uci set multiwan.@mwanfw[-1].src=192.168.2.0/24 uci set multiwan.@mwanfw[-1].dst=www.whatismyip.com uci set multiwan.@mwanfw[-1].wanrule=fastbalancer uci commit multiwan /etc/init.d/multiwan restart Quick Multiwan setup guide by AndyBallon andyballon made quick installation guide and post it in https://forum.openwrt.org/viewtopic.php?id=23904&p=3 post #75 1. Установка Backfire 10.03 for first time install see Openwrt documentation for upgrades from Kamikaze use the .trx and install via the web interface for bricked <smirk> routers see tftp install of .bin file tftp note: don't forget to login via telnet and change root passwd for ssh to work 2. Create extra Vlan for Wan2 I do this via /etc/config/newtork. Note: I removed port “0” from eth0_0 and gave it to eth0_2. You can configure wan and wan2 proto as dhcp to strt and then use the web interface to configure the pppoe or static ip later. Use the same DNS servers I'm using if you're having DNS problems. Some ISPs only allow DNS connections from their IP blocks. root@culiat-wg:~# cat /etc/config/network config 'switch' 'eth0' option 'enable' '1' config 'switch_vlan' 'eth0_0' option 'device' 'eth0' option 'vlan' '0' option 'ports' '1 2 3 5' config 'switch_vlan' 'eth0_1' option 'device' 'eth0' option 'vlan' '1' option 'ports' '4 5' config 'switch_vlan' 'eth0_2' option 'device' 'eth0' option 'vlan' '2' option 'ports' '0 5' config 'interface' 'loopback' option 'ifname' 'lo' option 'proto' 'static' option 'ipaddr' '127.0.0.1' option 'netmask' '255.0.0.0' config 'interface' 'lan' option 'type' 'bridge' option 'ifname' 'eth0.0' option 'proto' 'static' option 'stp' '1' option 'ipaddr' '192.168.1.1' option 'netmask' '255.255.255.0' config 'interface' 'wan' option 'ifname' 'eth0.1' option 'proto' 'dhcp' option 'dns' '216.146.35.113 216.146.36.113 8.8.8.8 8.8.4.4' option 'defaultroute' '0' option 'peerdns' '0' config 'interface' 'wan2' option 'ifname' 'eth0.2' option 'dns' '216.146.35.113 216.146.36.113 8.8.8.8 8.8.4.4' option 'proto' 'dhcp' option 'defaultroute' '0' option 'peerdns' '0' 3. Install prerequisite software ip, iptables, iptables-utils, iptables-mod-conntrack, iptables-mod-conntrack-extra, iptables-mod-ipopt and kmod-ipt-ipopt this is how I do it: a. go to backfire packages: http://downloads.openwrt.org/backfire/10.03/brcm47xx/packages/ b. right click a link to a package and “Copy Link Location” c. go to /tmp directory and run “opkg install http://downloads.openwrt.org/backfire/10.03/brcm47xx/packages/ip_2.6.29-1-2_brcm47xx.ipk” note: if you're new to all of this it's better to install all the applications first including multiwan before configuring vlans so your internet connection does not go kookie on you. If you did because you're folowing this guide, then just shutdown a interface like so: “ifconfig eth0.2 down” 4. Install multiwan and it's web control package (luci-app) Reboot to refresh the web ui. I always need to do this otherwise the link does not show up in networking. 5. Configure Wans && configure multiwan Wans: Network > Interfaces > Wan/WAN2 note: when asked which firewall zone to add wan2 choose wan so it has the same firewall rules for wan connections. Otherwise you'll have to manually recreate the fw rules for wan2. Multiwan: Network > Multiwan checkout the bottom page to see samples of the settings. here's how i got mine setup: a. I only have two internet connections so I always remove the last two wan interfaces. I also comment out MWAN3 and MWAN4 in /etc/iproute2/rt_tables (although it may not be necessary). b. Load Balancer Distribution = 1 for even connection distribution note: You'll get per connection distribution not per packet so don't expect one download to come from both gateways. Lots of talk on this in the internet. Failover = LoadBalancer for both links c.Traffic Rules note: checkout the examples Source, Destination, protocol, Ports, WAN Uplink all, all,all,all, Load Balancer all, all, UDP, all, wan ←- this is so all vpn and voip connection goes through 1 gateway only that's it! 6. Test. Status > Interfaces should show traffic going through both interfaces. route distribution root@culiat-wg:~# ip route show table 123 192.168.2.0/24 dev eth0.2 proto kernel scope link src 192.168.2.214 192.168.1.0/24 dev br-lan proto kernel scope link src 192.168.1.1 114.108.201.0/24 dev eth0.1 proto kernel scope link src 114.108.201.49 default proto static nexthop via 114.108.201.1 dev eth0.1 weight 1 nexthop via 192.168.2.1 dev eth0.2 weight 1 “route” should give you two default gateways try a torrent with lots of seeders. If you have a internet line that can do 90kbps max download, and another that can do 180kbps max if multiwan is working properly you should get a download rate greater than the higher rated link. pulling the plug from a wan port should still give you internet connection 7. Troubleshooting There's a problem if when you refresh the Interface status page and the Transfer rate of one interface does not change when you you go the the Interface Status page you only see one wan interface when you do “route” you only get one default gateway when you do “ip route show table 123” you don't get nexthops etc. Fix: post your problem in the thread. :D 8. Extras If you have two or more connections to the same ISP you should try: ECMP using quagga http://quagga.net/faq/kodgehopper-ecmp.html ←- hard core network stuff (makes you feel like a genius. :D) Channel bonding ←- this gives you per packet load distribution (effectively doubles your transfer rates) This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.OKMore information about cookies Last modified: 2015/12/11 15:47by tmomas