Wirelessinfo.be

Mikrotik routerboard 751G-2HnD load balance

Configuratie

De rode en groene IP-adressen moeten vervangen worden door het door de ISP verkregen IP-adressen te zien bij de DHCP-client. Als je dit niet doet gaat de configuratie niet werken.

  • Ether4 = ISP1 DHCP-client ingesteld. Het verkregen IP-adres moet worden aangepast in de code gemerkt met de rode kleur.
  • Ether5 = ISP2 DHCP-client ingesteld. Het verkregen IP-adres moet worden aangepast in de code gemerkt met de groene kleur.
  • Er is een bridge aangemaakt br-lan.
  • Ether1, 2, 3 en wlan1 staan gebridged.
  • Lan IP-adres = 192.168.100.0/24
  • DHCP-pool 192.168.100.2-192.168.100.254
  • De wireless interface is ingesteld zonder beveiliging met als SSID Wirelessinfo.be

De code

Load-balancing met RB751G-2HnD
  • /interface bridge
  • add l2mtu=1598 name=br-lan
  • /interface ethernet
  • set [ find default-name=ether4 ] name=ISP1
  • set [ find default-name=ether5 ] name=ISP2
  • /interface wireless
  • set [ find default-name=wlan1 ] antenna-gain=5 country=belgium disabled=no \
  • l2mtu=1600 mode=ap-bridge ssid=Wirelessinfo.be
  • /interface bridge port
  • add bridge=br-lan interface=ether1
  • add bridge=br-lan interface=ether2
  • add bridge=br-lan interface=ether3
  • add bridge=br-lan interface=wlan1
  • /ip address
  • add address=192.168.100.1/24 interface=br-lan network=192.168.100.0
  • add address= 172.16.0.20/24 interface=ISP2 network= 172.16.0.0
  • /ip dhcp-client
  • add default-route-distance=0 dhcp-options=hostname,clientid disabled=no \ interface=ISP2
  • add default-route-distance=0 dhcp-options=hostname,clientid disabled=no \ interface=ISP1
  • /ip dns
  • set allow-remote-requests=yes cache-size=5000KiB max-udp-packet-size=512 \ servers=8.8.8.8,8.8.4.4
  • /ip firewall mangle
  • add action=mark-connection chain=input in-interface=ISP1 new-connection-mark=\ISP1_conn
  • add action=mark-connection chain=input in-interface=ISP2 new-connection-mark=\ISP2_conn
  • add action=mark-routing chain=output connection-mark=ISP1_conn \ new-routing-mark=to_ISP1
  • add action=mark-routing chain=output connection-mark=ISP2_conn \ new-routing-mark=to_ISP2
  • add chain=prerouting dst-address= 192.168.0.0/24 in-interface=br-lan
  • add chain=prerouting dst-address= 172.16.0.0/24 in-interface=br-lan
  • add action=mark-connection chain=prerouting dst-address-type=!local \ in-interface=br-lan new-connection-mark=ISP1_conn \ per-connection-classifier=both-addresses-and-ports:2/0
  • add action=mark-connection chain=prerouting dst-address-type=!local \ in-interface=br-lan new-connection-mark=ISP2_conn \ per-connection-classifier=both-addresses-and-ports:2/1
  • add action=mark-routing chain=prerouting connection-mark=ISP1_conn \ in-interface=br-lan new-routing-mark=to_ISP1
  • add action=mark-routing chain=prerouting connection-mark=ISP2_conn \ in-interface=br-lan new-routing-mark=to_ISP2
  • /ip firewall nat
  • add action=masquerade chain=srcnat out-interface=ISP1
  • add action=masquerade chain=srcnat out-interface=ISP2
  • /ip route
  • add check-gateway=ping distance=1 gateway= 192.168.0.219 routing-mark=to_ISP1
  • add check-gateway=ping distance=1 gateway= 172.16.0.20 routing-mark=to_ISP2
  • add check-gateway=ping distance=1 gateway= 192.168.0.219
  • add check-gateway=ping distance=2 gateway= 172.16.0.20
  • /ip upnp
  • set allow-disable-external-interface=no
  • /system leds
  • set 0 interface=wlan1
  • /ip pool
  • add name=dhcp_pool1 ranges=192.168.100.2-192.168.100.254
  • /ip dhcp-server
  • add address-pool=dhcp_pool1 disabled=no interface=br-lan name=dhcp1