# Generat per a:
# RouterOSv3.x
:log info "Unsolclic for 5589-VicSetupST going to be executed."
#
# Configuration for RouterOS > 2.9.51 or 3.x
# Trasto: 5589-VicSetupST
#
# ATENCIÓ: Versió Beta
#
# Methods to upload/execute this script:
# 1.-As a script. Upload this output as a script either with:
# a.Winbox (with Linux, wine required)
# b.Terminal (telnet, ssh...)
# Then execute the script with:
# > /system script run script_name
# 2.-Fitxer importat:
# Desa aquesta "sortida" a un fitxer, després puja'l al router
# fent servir FTP amb un nom de l'estil "script_name.rsc".
# (note, l'extensió ".rsc" es un requisit)
# Executa el fitxer importat amb la comanda:
# > /import script_name
# 3.-Telnet copia i enganxar:
# Open a terminal session, and cut&paste this output
# directly on the terminal input.
#
# Notes:
# -routing-test package is required, be sure you have it enabled at system packages
# -wlans should be enabled manually, be sure to set the correct antenna (a or b)
# according in how did you connect the cable to the miniPCI. Keep the
# power at the minimum possible and check the channel.
# -The script doesn't reset the router, you might have to do it manually
# -You must have write access to the router
# -MAC access (winbox, MAC telnet...) method is recommended
# (the script reconfigures some IP addresses, so communication can be lost)
# -No changes are done in user passwords on the device
# -A Read Only guest account with no password will be created to allow guest access
# to the router with no danger of damage but able to see the config.
# -Be sure that all packages are activated.
# -Don't run the script from telnet and being connected through an IP connection at
# the wLan/Lan interface: This interface will be destroyed during the script.
#
/ system identity set name=VicSetupST
#
# DNS (client & server cache) zone: 2472
/ip dns set primary-dns=10.138.160.98 secondary-dns=10.138.25.68 allow-remote-requests=yes
:delay 1
#
# NTP (client & server cache) zone: 2472
/system ntp client set enabled=yes mode=unicast primary-ntp=10.138.25.69
:delay 1
#
# Bandwidth-server
/ tool bandwidth-server set enabled=yes authenticate=no allocate-udp-ports-from=2000
#
# SNMP
/snmp set contact="guifi@guifi.net" enabled=yes location="VicSetup"
#
# Guest user
/user
:foreach i in [find group=read] do={/user remove $i;}
add name="guest" group=read address=0.0.0.0/0 comment="" disabled=no
#
# Graphing
/tool graphing interface add
# Remove current wLan/Lan bridge if exists
:foreach i in [/interface bridge find name=wLan/Lan] \
do={:foreach i in [/interface bridge port find bridge=wLan/Lan] \
do={/interface bridge port remove $i; \
:foreach i in [/ip address find interface=wLan/Lan] \
do={/ip address remove $i;};};
/interface bridge remove $i;}
# Construct main bridge on wlan1 & ether1
/ interface bridge
add name="wLan/Lan"
/ interface bridge port
add interface=ether1 bridge=wLan/Lan
add interface=wlan1 bridge=wLan/Lan
:delay 1
#
# Radio#: 0 VicSetupInformaticaAP
/interface wireless set wlan1 name="wlan1" \
radio-name="VicSetupInformaticaAP" mode=ap-bridge ssid="guifi.net-VicSetupInformaticaAP" \
band="2.4ghz-b" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=2437 \
dfs-mode=none \
wds-mode=static wds-default-bridge=none wds-default-cost=100 \
wds-cost-range=50-150 wds-ignore-ssid=yes hide-ssid=no
:delay 1
# Type: wLan/Lan
/ip address
:foreach i in [find address="10.138.23.33/27"] do={remove $i}
/ ip address add address=10.138.23.33/27 network=10.138.23.32 broadcast=10.138.23.63 interface=wLan/Lan disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wLan/Lan] do={/routing ospf interface remove $i;}
add interface=wLan/Lan
/ routing ospf network
:foreach i in [/routing ospf network find network=10.138.23.32/27] do={/routing ospf network remove $i;}
add network=10.138.23.32/27 area=backbone disabled=no
:delay 1
#
# DHCP
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
add address=10.138.23.34 mac-address=ff:ff:ff:ff:ff:ff client-id=handelvic2 server=dhcp-wLan/Lan
add address=10.138.23.35 mac-address=ff:ff:ff:ff:ff:ff client-id=VicMonRadio server=dhcp-wLan/Lan
add address=10.138.23.37 mac-address=00:19:E0:67:3F:4A client-id=VicMDiazRadio1 server=dhcp-wLan/Lan
add address=10.138.23.38 mac-address=00:1D:0F:AE:D5:63 client-id=VicMRodriguezRadio1 server=dhcp-wLan/Lan
add address=10.138.23.39 mac-address=00:0C:42:18:2B:73 client-id=VicSmartPointVic2 server=dhcp-wLan/Lan
add address=10.138.23.40 mac-address=00:1C:10:36:57:B4 client-id=VicSisaRadio1 server=dhcp-wLan/Lan
add address=10.138.23.41 mac-address=00:1C:10:36:49:F8 client-id=VicJGrauRadio2 server=dhcp-wLan/Lan
add address=10.138.23.42 mac-address=ff:ff:ff:ff:ff:ff client-id=VicOmniumDavidRadio1 server=dhcp-wLan/Lan
add address=10.138.23.43 mac-address=00:16:01:AE:E8:D2 client-id=VicMontserrat27 server=dhcp-wLan/Lan
add address=10.138.23.44 mac-address=00:1D:0F:AE:BA:F0 client-id=VicDVilaRadio1 server=dhcp-wLan/Lan
add address=10.138.23.45 mac-address=00:16:01:F2:40:F8 client-id=VicMohamedSRadio1 server=dhcp-wLan/Lan
add address=10.138.23.46 mac-address=00:19:E0:67:8E:A5 client-id=VicBordalloRadio1 server=dhcp-wLan/Lan
add address=10.138.23.47 mac-address=00:80:48:4F:0C:20 client-id=VicMMontillaRadio1 server=dhcp-wLan/Lan
add address=10.138.23.48 mac-address=00:1D:0F:B0:EF:42 client-id=VicJRicardRadio1 server=dhcp-wLan/Lan
add address=10.138.23.49 mac-address=00:16:01:F2:29:74 client-id=VicJLloretRadio2 server=dhcp-wLan/Lan
add address=10.138.23.50 mac-address=00:19:E0:67:07:54 client-id=VicPoyatoRadio1 server=dhcp-wLan/Lan
add address=10.138.23.51 mac-address=ff:ff:ff:ff:ff:ff client-id=handelvic2 server=dhcp-wLan/Lan
add address=10.138.23.52 mac-address=00:19:E0:67:56:C1 client-id=VicJSolerRadio1 server=dhcp-wLan/Lan
add address=10.138.23.53 mac-address=00:19:E0:67:66:E7 client-id=VicSoledatRadio server=dhcp-wLan/Lan
add address=10.138.23.54 mac-address=00:0C:42:1B:52:6D client-id=VicSmartPointPGeneralitat server=dhcp-wLan/Lan
add address=10.138.23.55 mac-address=00:1D:7E:FB:80:F7 client-id=VicHelenaVRadio1 server=dhcp-wLan/Lan
add address=10.138.23.56 mac-address=00:19:EO:67:1C:04 client-id=VicJCasanovesRadio1 server=dhcp-wLan/Lan
add address=10.138.23.57 mac-address=00:15:6D:A7:AA:DB client-id=victruman4Rd1 server=dhcp-wLan/Lan
add address=10.138.23.58 mac-address=00:19:E0:67:A5:C7 client-id=VicCarlesGRadio1 server=dhcp-wLan/Lan
add address=10.138.23.60 mac-address=00:1D:0F:AE:5A:59 client-id=VicCanigoRadio2 server=dhcp-wLan/Lan
add address=10.138.23.61 mac-address=00:16:01:16:56:2B client-id=VicRemeiRadio1 server=dhcp-wLan/Lan
add address=10.138.23.62 mac-address=00:19:E0:67:45:36 client-id=TaradellJanetRadio1 server=dhcp-wLan/Lan
:foreach i in [/ip dhcp-server network find address="10.138.23.32/27"] do={/ip dhcp-server network remove $i;}
:foreach i in [/ip pool find name=dhcp-wLan/Lan] do={/ip pool remove $i;}
/ip pool add name=dhcp-wLan/Lan ranges=10.138.23.62-10.138.23.62
/ip dhcp-server network add address=10.138.23.32/27 gateway=10.138.23.33 domain=guifi.net comment=dhcp-wLan/Lan
:foreach i in [/ip dhcp-server find name=dhcp-wLan/Lan] do={/ip dhcp-server remove $i;}
/ip dhcp-server add name=dhcp-wLan/Lan interface=wLan/Lan address-pool=dhcp-wLan/Lan disabled=yes
#
:delay 1
# Type: wds/p2p
# Remove all existing wds interfaces
:foreach i in [/interface wireless wds find master-interface=wlan1] \
do={:foreach n in [/interface wireless wds get $i name] \
do={:foreach inum in [/ip address find interface=$n] \
do={/ip address remove $inum;};}; \
/interface wireless wds remove $i;}
#
:delay 1
#
# Radio#: 1 VicSetupST-SBGRocLlarg
/interface wireless set wlan2 name="wlan2" \
radio-name="VicSetupST-SBGRocLlarg" mode=ap-bridge ssid="guifi.net-VicSetupST-SBGRocLlarg" \
band="5ghz" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=5500 \
dfs-mode=none \
wds-mode=static wds-default-bridge=none wds-default-cost=100 \
wds-cost-range=50-150 wds-ignore-ssid=yes hide-ssid=no
:delay 1
# Type: wds/p2p
# Remove all existing wds interfaces
:foreach i in [/interface wireless wds find master-interface=wlan2] \
do={:foreach n in [/interface wireless wds get $i name] \
do={:foreach inum in [/ip address find interface=$n] \
do={/ip address remove $inum;};}; \
/interface wireless wds remove $i;}
/ interface wireless wds
add name="wds_SBGRocLlargST1" master-interface=wlan2 wds-address=00:0B:6B:81:3B:0E disabled=no
/ ip address add address=172.25.10.117/30 network=172.25.10.116 broadcast=172.25.10.119 interface=wds_SBGRocLlargST1 disabled=no comment="wds_SBGRocLlargST1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_SBGRocLlargST1] do={/routing ospf interface remove $i;}
add interface=wds_SBGRocLlargST1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.10.116/30] do={/routing ospf network remove $i;}
add network=172.25.10.116/30 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=SBGRocLlargST1] do={/routing bgp peer remove $i;}
add name="SBGRocLlargST1" instance=default remote-address=172.25.10.118 remote-as=5508 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=no
#
:delay 1
#
# Radio#: 2 VicSetupST-VicHabitat
/interface wireless set wlan3 name="wlan3" \
radio-name="VicSetupST-VicHabitat" mode=ap-bridge ssid="guifi.net-VicSetupST-VicHabitat" \
band="5ghz" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=5540 \
dfs-mode=none \
wds-mode=static wds-default-bridge=none wds-default-cost=100 \
wds-cost-range=50-150 wds-ignore-ssid=yes hide-ssid=no
:delay 1
# Type: wds/p2p
# Remove all existing wds interfaces
:foreach i in [/interface wireless wds find master-interface=wlan3] \
do={:foreach n in [/interface wireless wds get $i name] \
do={:foreach inum in [/ip address find interface=$n] \
do={/ip address remove $inum;};}; \
/interface wireless wds remove $i;}
/ interface wireless wds
add name="wds_VicHabitatST2" master-interface=wlan3 wds-address=00:0B:6B:4F:7C:0C disabled=no
/ ip address add address=172.25.10.137/30 network=172.25.10.136 broadcast=172.25.10.139 interface=wds_VicHabitatST2 disabled=no comment="wds_VicHabitatST2"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_VicHabitatST2] do={/routing ospf interface remove $i;}
add interface=wds_VicHabitatST2
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.10.136/30] do={/routing ospf network remove $i;}
add network=172.25.10.136/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=VicHabitatST2] do={/routing bgp peer remove $i;}
add name="VicHabitatST2" instance=default remote-address=172.25.10.138 remote-as=2557 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=yes
#
:delay 1
#
# Radio#: 3 VicSetupST-AP5Ghz
/interface wireless set wlan4 name="wlan4" \
radio-name="VicSetupST-AP5Ghz" mode=ap-bridge ssid="guifi.net-VicSetupST-AP5Ghz" \
band="5ghz" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=5180 \
dfs-mode=none \
wds-mode=static wds-default-bridge=none wds-default-cost=100 \
wds-cost-range=50-150 wds-ignore-ssid=yes hide-ssid=no
:delay 1
# Type: wLan
/ip address
:foreach i in [find address="10.138.23.97/27"] do={remove $i}
/ ip address add address=10.138.23.97/27 network=10.138.23.96 broadcast=10.138.23.127 interface=wlan4 disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wlan4] do={/routing ospf interface remove $i;}
add interface=wlan4
/ routing ospf network
:foreach i in [/routing ospf network find network=10.138.23.96/27] do={/routing ospf network remove $i;}
add network=10.138.23.96/27 area=backbone disabled=no
:delay 1
#
# DHCP
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
add address=10.138.23.98 mac-address=00:0C:42:06:38:24 client-id=CalldetenesDCRRadio2 server=dhcp-wlan4
add address=10.138.23.100 mac-address=00:15:6D:B5:B6:5E client-id=VicJordiCasalsRadio1 server=dhcp-wlan4
:foreach i in [/ip dhcp-server network find address="10.138.23.96/27"] do={/ip dhcp-server network remove $i;}
:foreach i in [/ip pool find name=dhcp-wlan4] do={/ip pool remove $i;}
/ip pool add name=dhcp-wlan4 ranges=10.138.23.106-10.138.23.126
/ip dhcp-server network add address=10.138.23.96/27 gateway=10.138.23.97 domain=guifi.net comment=dhcp-wlan4
:foreach i in [/ip dhcp-server find name=dhcp-wlan4] do={/ip dhcp-server remove $i;}
/ip dhcp-server add name=dhcp-wlan4 interface=wlan4 address-pool=dhcp-wlan4 disabled=no
#
:delay 1
# Type: wds/p2p
# Remove all existing wds interfaces
:foreach i in [/interface wireless wds find master-interface=wlan4] \
do={:foreach n in [/interface wireless wds get $i name] \
do={:foreach inum in [/ip address find interface=$n] \
do={/ip address remove $inum;};}; \
/interface wireless wds remove $i;}
#
:delay 1
#
# Routed device
#
# Altres connexions de cable
#
# Internal addresses NAT
:foreach i in [/ip firewall nat find src-address="172.25.0.0/16"] do={/ip firewall nat remove $i;}
:foreach i in [/ip firewall nat find src-address="192.168.0.0/16"] do={/ip firewall nat remove $i;}
/ip firewall nat
add chain=srcnat src-address="192.168.0.0/16" dst-address=!192.168.0.0/16 action=src-nat to-addresses=10.138.23.97 comment="" disabled=no
add chain=srcnat src-address="172.25.0.0/16" dst-address=!172.25.0.0/16 protocol=!ospf action=src-nat to-addresses=10.138.23.97 comment="" disabled=no
#
# Enrutament BGP
# Filtres BGP i OSPF
:foreach i in [/routing filter find chain=ospf-in] do={/routing filter remove $i;}
:foreach i in [/routing filter find chain=ospf-out] do={/routing filter remove $i;}
/ routing filter
add chain=ospf-out prefix=10.0.0.0/8 prefix-length=8-32 invert-match=no action=accept comment="" disabled=no
add chain=ospf-out invert-match=no action=discard comment="" disabled=no
add chain=ospf-in prefix=10.0.0.0/8 prefix-length=8-32 invert-match=no action=accept comment="" disabled=no
add chain=ospf-in invert-match=no action=reject comment="" disabled=no
#
# Instància BGP
/ routing bgp instance
set default name="default" as=5589 router-id=10.138.23.97 redistribute-static=yes \
redistribute-connected=yes redistribute-rip=yes redistribute-ospf=yes \
redistribute-other-bgp=yes out-filter=ospf-out \
client-to-client-reflection=yes comment="" disabled=no
#
# Enrutament OSPF
/routing ospf set router-id=10.138.23.97 redistribute-connected=as-type-1 redistribute-static=as-type-1 redistribute-bgp=as-type-1
#
:log info "Unsolclic for 5589-VicSetupST executed."
/