Hi,
I’m trying to set up Multi WAN mikrotik router where the second ISP is Starlink with ethernet adapter. The issue is that Starlink provides the default gateway 100.64.0.1 (mac address 00:00:5E:00:01:01) which does not reply at icmp requests. I guess that they use some kind of a load balancing/or switching when the sattelite is passing the region.
The setup looks like this:
# Adding local subnet to the main table
/routing rule
add action=lookup disabled=no dst-address=172.16.46.0/24 table=main
/routing table
add disabled=no fib name=rtab-wan
add disabled=no fib name=rtab-sat
# Marking the incoming connections from every ISP
/ip firewall mangle
add action=mark-connection chain=prerouting comment=WAN-Routing-Mark connection-mark=no-mark in-interface=bridge_wan new-connection-mark=from-wan-internet passthrough=no
add action=mark-connection chain=prerouting comment=SAT-Routing-Mark connection-mark=no-mark in-interface=bridge_sat new-connection-mark=from-sat-internet passthrough=no
## Outgoing transit traffic rules
add action=mark-routing chain=prerouting comment="WAN Outgoing transit traffic to rtab-wan Routing Table " connection-mark=from-wan-internet dst-address-type=!local in-interface-list=!WAN new-routing-mark=rtab-wan passthrough=no
add action=mark-routing chain=prerouting comment="SAT Outgoing transit traffic to rtab-sat Routing Table " connection-mark=from-sat-internet dst-address-type=!local in-interface-list=!WAN new-routing-mark=rtab-sat passthrough=no
## Outgoing local traffic rules
add action=mark-routing chain=output comment="WAN Outgoing Local traffic to rtab-wan Routing Table " connection-mark=from-wan-internet dst-address-type=!local new-routing-mark=rtab-wan passthrough=no
add action=mark-routing chain=output comment="SAT Outgoing Local traffic to rtab-sat Routing Table " connection-mark=from-sat-internet dst-address-type=!local new-routing-mark=rtab-sat passthrough=no
## Dedicated Routing rules per address lists
add action=mark-routing chain=prerouting comment="Users routed via WAN" dst-address-list=!BOGONS new-routing-mark=rtab-wan passthrough=yes src-address-list=Routed-via-WAN place-before=0
add action=mark-routing chain=prerouting comment="Users routed via SAT" dst-address-list=!BOGONS new-routing-mark=rtab-sat passthrough=yes src-address-list=Routed-via-SAT place-before=0
# Adding emergency default route
/interface bridge add name=br-lo comment="Loopback Routing Interface"
/ip route add distance=254 gateway=br-lo comment="Emergency route"
# Adding the route for the 1st testing IP via WAN
/ip route
add check-gateway=ping comment="For recursion via WAN" distance=1 dst-address=4.2.2.1 gateway=80.92.227.42 scope=11
add check-gateway=ping comment="Unmarked via WAN" distance=1 gateway=4.2.2.1 target-scope=11
add comment="Marked via WAN" distance=1 gateway=4.2.2.1 routing-table=rtab-wan target-scope=11
add comment="Marked via SAT" distance=2 gateway=4.2.2.1 routing-table=rtab-sat target-scope=11
# Route rule from local traffic to internet (WAN)
/routing/rule/add action=lookup comment="From WAN IP to Inet" src-address=8.9.7.41 table=rtab-wan
The DHCP client for starlink bridge is done like this:
/ip dhcp-client add add-default-route=no disabled=no interface=bridge-sat
Also there is a script attached to DHCP clients for bridge-sat:
:local ispThis "SAT"
:local ispThisRt "rtab-sat"
:local ispThisGwCheck "arp"
:local ispThisMainRtDistance "2"
:local ispMain "WAN"
:local ispBackup "SAT"
:local checkIp "4.2.2.2"
:local ispMainRt "rtab-wan"
:local ispBackupRt "rtab-sat"
#:local postScript "some-script"
:log info "$ispThis: Bound: $bound, Gateway: $"gateway-address""
:if ($bound=1) do={
:log info "$ispThis: Removing the old route records"
/ip route remove [ find gateway="$checkIp" ]
/ip route remove [ find where dst-address ~"$checkIp" ]
:log info "$ispThis: Adding actual route records"
/ip route add check-gateway=$ispThisGwCheck comment="For recursion via $ispThis" distance=1 dst-address=$checkIp gateway=$"gateway-address" scope=11
/ip route add check-gateway=ping comment="Unmarked via $ispThis" distance=$ispThisMainRtDistance gateway=$checkIp target-scope=11
/ip route add comment="Marked via $ispBackup" distance=1 gateway=$checkIp routing-table=$ispBackupRt target-scope=11
/ip route add comment="Marked via $ispMain" distance=2 gateway=$checkIp routing-table=$ispMainRt target-scope=11
:log info "$ispThis: Setting NAT"
:if [:tobool ([/ip firewall/nat/ find comment="NAT via $ispThis"])] do={
:log info "$ispThis: .... rule had been updated"
/ip firewall nat set [find comment="NAT via $ispThis"] action=src-nat chain=srcnat ipsec-policy=out,none out-interface=$"interface" to-addresses=$"lease-address"
} else={
:log info "$ispThis: .... rule had been added"
/ip firewall nat add action=src-nat chain=srcnat ipsec-policy=out,none out-interface=$"interface" to-addresses=$"lease-address" comment="NAT via $ispThis"
}
:log info "$ispThis: Setting routing rules"
:if [:tobool ([/routing/rule find comment="From $ISP IP to Inet"])] do={
:log info "$ispThis: .... rule had been updated"
/routing/rule/set [find comment="From $ispThis IP to Inet"] action=lookup src-address=$"lease-address" table=$ispThisRt
} else={
:log info "$ispThis: .... rule had been added"
/routing/rule/add action=lookup comment="From $ispThis IP to Inet" src-address=$"lease-address" table=$ispThisRt
}
#:log info "$ispThis: Runnit the post action script"
#/system script run $postScript
:log info "$ispThis: Activation is done!"
} else={
:log info "$ispThis: Removing route records"
/ip route remove [ find gateway="$checkIp" ]
/ip route remove [ find where dst-address ~"$checkIp" ]
:log info "$ispThis: Removing firewall NAT"
/ip firewall nat remove [find comment="NAT via $ispThis"]
:log info "$ispThis: Removing routing rules"
/routing/rule/remove [find comment="From $ispThis IP to Inet"]
:log info "$ispThis: Cleaning is done!"
}
The problem is that “check-gateway” feature when there is “ping” value not works (because the Starling gateway not accepts ICMPs). I also tried ARP - that somehow not work as well, but I can see the mac-address of the gateway at IP-ARP via Winbox. Could it be the issue because the gateway is somewhere at the space and the RouterOS times out the arp response? Doing arp ping from the routeros console works as well.
How can I check that starlink is up using Mikrotik’s native tools?
