Skip to content

Instantly share code, notes, and snippets.

@beigna
Last active May 29, 2020 01:12
Show Gist options
  • Save beigna/a7b5086b1a681f01df95d15ac2301fe7 to your computer and use it in GitHub Desktop.
Save beigna/a7b5086b1a681f01df95d15ac2301fe7 to your computer and use it in GitHub Desktop.
# may/28/2020 21:53:06 by RouterOS 6.46.6
# software id = ISSB-RQLV
#
# model = RB750Gr3
/interface bridge
add comment="LAN Switch" name=bridge
/interface ethernet
set [ find default-name=ether1 ] comment="ISP Claro" name=wan1
set [ find default-name=ether2 ] comment="ISP Movistar" name=wan2
/interface list
add name=LAN
add name=WAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip hotspot profile
set [ find default=yes ] html-directory=flash/hotspot
/ip pool
add name=pool-casa ranges=10.0.0.100-10.0.0.199
/ip dhcp-server
add address-pool=pool-casa disabled=no interface=bridge lease-time=1d name=\
dhcp-casa
/interface bridge port
add bridge=bridge interface=ether3
add bridge=bridge interface=ether4
add bridge=bridge interface=ether5
/interface list member
add interface=bridge list=LAN
add interface=wan1 list=WAN
add interface=wan2 list=WAN
/ip address
add address=10.0.0.1/24 interface=bridge network=10.0.0.0
/ip dhcp-client
add add-default-route=no disabled=no interface=wan2 script="{\r\
\n :local count [/ip route print count-only where comment=\"Movistar\"]\r\
\n\r\
\n :if (\$bound=1) do={\r\
\n /ip route remove [find comment=\"Movistar\"]\r\
\n /ip route remove [find comment=\"Movistar-Test\"]\r\
\n /ip route add gateway=\$\"gateway-address\" comment=\"Movistar\" d\
istance=1\r\
\n /ip route add gateway=\$\"gateway-address\" comment=\"Movistar\" r\
outing-mark=to_movistar\r\
\n /ip route add dst-address=8.8.4.4 gateway=\$\"gateway-address\" co\
mment=\"Movistar-Test\"\r\
\n /tool netwatch enable [find comment=\"Movistar\"]\r\
\n :beep frequency=2500 length=30ms\r\
\n } else={\r\
\n /tool netwatch disable [find comment=\"Movistar\"]\r\
\n /ip route remove [find comment=\"Movistar\"]\r\
\n /ip route remove [find comment=\"Movistar-Test\"]\r\
\n :beep frequency=250 length=150ms\r\
\n }\r\
\n}" use-peer-dns=no use-peer-ntp=no
add add-default-route=no disabled=no interface=wan1 script="{\r\
\n :local count [/ip route print count-only where comment=\"Claro\"]\r\
\n\r\
\n :if (\$bound=1) do={\r\
\n /ip route remove [find comment=\"Claro\"]\r\
\n /ip route remove [find comment=\"Claro-Test\"]\r\
\n /ip route add gateway=\$\"gateway-address\" comment=\"Claro\" dist\
ance=2\r\
\n /ip route add gateway=\$\"gateway-address\" comment=\"Claro\" rout\
ing-mark=to_claro\r\
\n /ip route add dst-address=1.0.0.1 gateway=\$\"gateway-address\" co\
mment=\"Claro-Test\"\r\
\n /tool netwatch enable [find comment=\"Claro\"]\r\
\n :beep frequency=2000 length=30ms\r\
\n } else={\r\
\n /tool netwatch disable [find comment=\"Claro\"]\r\
\n /ip route remove [find comment=\"Claro\"]\r\
\n /ip route remove [find comment=\"Claro-Test\"]\r\
\n :beep frequency=200 length=150ms\r\
\n }\r\
\n}" use-peer-dns=no use-peer-ntp=no
/ip dhcp-server lease
add address=10.0.0.199 client-id=11:22:33:44:55:664 comment="" \
mac-address=11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.2 client-id=11:22:33:44:55:667c mac-address=\
11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.50 client-id=11:22:33:44:55:66c mac-address=\
11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.193 client-id=11:22:33:44:55:6645 comment="" \
mac-address=11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.197 client-id=11:22:33:44:55:66f9 comment="" \
mac-address=11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.51 client-id=11:22:33:44:55:66ac mac-address=\
11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.191 client-id=11:22:33:44:55:66a3 comment=Tablet \
mac-address=11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.198 client-id=11:22:33:44:55:66b6\
mac-address=11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.190 client-id=11:22:33:44:55:66cb\
mac-address=11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.188 comment="PC" mac-address=\
11:22:33:44:55:66
add address=10.0.0.54 mac-address=11:22:33:44:55:66
add address=10.0.0.52 mac-address=11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.53 mac-address=11:22:33:44:55:66
add address=10.0.0.60 client-id=\
11:22:33:44:55:662:0:0:ab:11:60:21:87:8e:13:dc:92:15 comment="" \
mac-address=11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.3 client-id=11:22:33:44:55:66f mac-address=\
11:22:33:44:55:66 server=dhcp-casa
add address=10.0.0.187 client-id=\
11:22:33:44:55:66:0:0:ab:11:60:21:87:8e:13:dc:92:15 mac-address=\
11:22:33:44:55:66 server=dhcp-casa
/ip dhcp-server network
add address=10.0.0.0/24 dns-server=10.0.0.3 gateway=10.0.0.1 netmask=24
/ip dns
set cache-max-ttl=1m servers=10.0.0.3
/ip firewall filter
add action=accept chain=input connection-state=established,related,untracked
add action=drop chain=input connection-state=invalid
add action=accept chain=input protocol=icmp
add action=drop chain=input in-interface-list=!LAN
add action=fasttrack-connection chain=forward connection-state=\
established,related
add action=accept chain=forward connection-state=\
established,related,untracked
add action=drop chain=forward connection-state=invalid
add action=drop chain=forward connection-nat-state=!dstnat connection-state=\
new in-interface-list=WAN
/ip firewall nat
add action=masquerade chain=srcnat out-interface-list=WAN
add action=dst-nat chain=dstnat comment="DNS Redirect" dst-port=53 protocol=\
udp src-address=!10.0.0.3 to-addresses=10.0.0.3 to-ports=53
add action=dst-nat chain=dstnat dst-port=53 protocol=tcp src-address=\
!10.0.0.3 to-addresses=10.0.0.3 to-ports=53
add action=masquerade chain=srcnat dst-address=10.0.0.3 dst-port=53 protocol=\
udp src-address=10.0.0.0/24
add action=masquerade chain=srcnat dst-address=10.0.0.3 dst-port=53 protocol=\
tcp src-address=10.0.0.0/24
add action=dst-nat chain=dstnat comment=CSGO dst-port=27015 \
in-interface-list=WAN protocol=tcp to-addresses=10.0.0.187 to-ports=27015
add action=dst-nat chain=dstnat dst-port=27015 in-interface-list=WAN \
protocol=udp to-addresses=10.0.0.187 to-ports=27015
add action=dst-nat chain=dstnat comment="http test" dst-port=8000 \
in-interface-list=WAN protocol=tcp to-addresses=10.0.0.198 to-ports=8000
add action=dst-nat chain=dstnat comment=nvr dst-port=8081 in-interface-list=\
WAN protocol=tcp to-addresses=10.0.0.50 to-ports=8081
add action=dst-nat chain=dstnat dst-port=8082 in-interface-list=WAN protocol=\
tcp to-addresses=10.0.0.50 to-ports=8082
add action=dst-nat chain=dstnat comment="murmur (mumble)" dst-port=64738 \
in-interface-list=WAN protocol=tcp to-addresses=10.0.0.60 to-ports=64738
add action=dst-nat chain=dstnat dst-port=64738 in-interface-list=WAN \
protocol=udp to-addresses=10.0.0.60 to-ports=64738
/ip route
add comment=Claro distance=1 gateway=186.182.228.1 routing-mark=to_claro
add comment=Movistar distance=1 gateway=192.168.1.1 routing-mark=to_movistar
add comment=Movistar distance=1 gateway=192.168.1.1
add comment=Claro distance=2 gateway=186.182.228.1
add comment=Claro-Test distance=1 dst-address=1.0.0.1/32 gateway=\
186.182.228.1
add comment=Movistar-Test distance=1 dst-address=8.8.4.4/32 gateway=\
192.168.1.1
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www disabled=yes
set api disabled=yes
set api-ssl disabled=yes
/system clock
set time-zone-autodetect=no time-zone-name=America/Argentina/Buenos_Aires
/system identity
set name=hex
/system logging
add topics=dhcp
/system ntp client
set enabled=yes server-dns-names=\
0..pool.ntp.org,0..pool.ntp.org,0.pool.ntp.org
/system script
add dont-require-permissions=no name=afraid_claro owner=admin policy=read \
source="/beep fr=1000 le=250ms\r\
\n\r\
\n/tool fetch url=\"https://freedns.afraid.org/dynamic/update.php\?\
&address=\"\r\
\n/tool fetch url=\"https://freedns.afraid.org/dynamic/update.php\?\
&address=\"\r\
\n/tool fetch url=\"https://freedns.afraid.org/dynamic/update.php\?\
&address=\""
/system watchdog
set watchdog-timer=no
/tool netwatch
add comment=Claro down-script="/ip route disable [find comment=\"Claro\"]" \
host=1.0.0.1 timeout=1s500ms up-script=\
"/ip route enable [find comment=\"Claro\"]"
add comment=Movistar down-script=\
"/ip route disable [find comment=\"Movistar\"]" host=8.8.4.4 timeout=\
1s500ms up-script="/ip route enable [find comment=\"Movistar\"]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment