Cum să setezi un router Mikrotik cu două rețele WAN (fail-over) si 2 rețele LAN

Mai jos vă prezentăm o configurare simplă pentru un router Mikrotik cu două conexiuni WAN (fail-over) și 2 rețele LAN separate.

Adresele IP sunt orientative, va fi necesar să le schimbați.

# Set up WAN interfaces
/interface ethernet
set [ find default-name=ether1 ] name=WAN1
set [ find default-name=ether2 ] name=WAN2

/ip address
add address=192.168.27.44/24 interface=WAN1 network=192.168.27.0
add address=192.168.28.45/24 interface=WAN2 network=192.168.28.0

/ip route
add distance=1 gateway=192.168.27.1
add distance=2 gateway=192.168.28.1

# Set up DNS servers
/ip dns
set servers=193.231.252.1,213.154.124.1,8.8.8.8,8.8.4.4

# Set up failover rules
/ip firewall mangle
add action=mark-routing chain=prerouting comment="Mark packets from WAN1" in-interface=WAN1 new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=prerouting comment="Mark packets from WAN2" in-interface=WAN2 new-routing-mark=to_WAN2 passthrough=yes

/ip route rule
add action=lookup-only-in-table comment="Send marked packets via WAN1" disabled=no routing-mark=to_WAN1 table=to_WAN1
add action=lookup-only-in-table comment="Send marked packets via WAN2" disabled=no routing-mark=to_WAN2 table=to_WAN2
add action=lookup-only-in-table comment="Default route for non-marked packets" disabled=no table=main

# Set up LAN interfaces
/interface ethernet
set [ find default-name=ether3 ] name=LAN3
set [ find default-name=ether4 ] name=LAN4

/ip address
add address=192.168.1.1/24 interface=LAN3 network=192.168.1.0
add address=192.168.10.1/24 interface=LAN4 network=192.168.10.0

# Set up DHCP servers
/ip pool
add name=LAN3-pool ranges=192.168.1.2-192.168.1.254
add name=LAN4-pool ranges=192.168.10.2-192.168.10.254

/ip dhcp-server
add address-pool=LAN3-pool disabled=no interface=LAN3 name=LAN3
add address-pool=LAN4-pool disabled=no interface=LAN4 name=LAN4
Cunoștiințele au fost folositoare?
Partajează