Skip to content

Instantly share code, notes, and snippets.

@0x4C4A
Created January 12, 2017 12:00
Show Gist options
  • Save 0x4C4A/3ba83e2e26cddd75c35e2bf6ee6e60d4 to your computer and use it in GitHub Desktop.
Save 0x4C4A/3ba83e2e26cddd75c35e2bf6ee6e60d4 to your computer and use it in GitHub Desktop.
Mikrotik settings to route multiple devices with same ip (for mass flashing of fixed ip devices)
# Taken from (huge thanks to Sob) http://forum.mikrotik.com/viewtopic.php?t=107142#p532709
# This is for two ports only, however can be altered for whatever number the router has
/ip address
add address=192.168.1.11/24 interface=ether1 network=192.168.1.0
add address=192.168.1.12/24 interface=ether1 network=192.168.1.0
add address=192.168.0.1 interface=ether2 network=192.168.0.1
add address=192.168.0.1 interface=ether3 network=192.168.0.1
/ip firewall mangle
add action=mark-connection chain=prerouting dst-address=192.168.1.11 new-connection-mark=port1
add action=mark-connection chain=prerouting dst-address=192.168.1.12 new-connection-mark=port2
add action=mark-routing chain=prerouting connection-mark=port1 new-routing-mark=port1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=port2 new-routing-mark=port2 passthrough=no
/ip firewall nat
add action=dst-nat chain=dstnat dst-address=192.168.1.11 dst-port=80 protocol=tcp to-addresses=192.168.0.2
add action=dst-nat chain=dstnat dst-address=192.168.1.12 dst-port=80 protocol=tcp to-addresses=192.168.0.2
add action=masquerade chain=srcnat out-interface=ether2
add action=masquerade chain=srcnat out-interface=ether3
/ip route
add distance=1 dst-address=192.168.0.0/24 gateway=ether2 routing-mark=port1
add distance=1 dst-address=192.168.0.0/24 gateway=ether3 routing-mark=port2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment