# Generat per a:
# RouterOSv2.9
:log info "Unsolclic for 5882-ALBMDDMon going to be executed."
#
# Configuration for RouterOS > 2.9.50 or 3.4
# Trasto: 5882-ALBMDDMon
#
# WARNING: Beta version
#
# 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.-Imported file:
# Save this output to a file, then upload it to the router
# using ftp using a name like "script_name.rsc".
# (note that extension ".rsc" is required)
# Run the import file using the command:
# > /import script_name
# 3.-Telnet cut&paste:
# 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=ALBMDDMon
#
# DNS (client & server cache) zone: 9171
:delay 1
#
# NTP (client & server cache) zone: 9171
/system ntp server set manycast=no enabled=yes
: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="ALBMDDMon"
#
# 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 ALBMDDMon-AP1
/interface wireless set wlan1 name="wlan1" \
radio-name="ALBMDDMon-AP1" mode=ap-bridge ssid="guifi.net-ALBMDDMon-AP1" \
band="5ghz" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=5220 \
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=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;}
/ interface wireless wds
add name="wds_castellfollitRadio1" master-interface=wlan1 wds-address=00:15:6D:63:77:8D disabled=yes
/ ip address add address=172.25.2.26/30 network=172.25.2.24 broadcast=172.25.2.27 interface=wds_castellfollitRadio1 disabled=yes comment="wds_castellfollitRadio1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_castellfollitRadio1] do={/routing ospf interface remove $i;}
add interface=wds_castellfollitRadio1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.2.24/30] do={/routing ospf network remove $i;}
add network=172.25.2.24/30 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=castellfollitRadio1] do={/routing bgp peer remove $i;}
add name="castellfollitRadio1" instance=default remote-address=172.25.2.25 remote-as=7552 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=no
#
:delay 1
# Type: wLan/Lan
/ip address
:foreach i in [find address="10.139.14.1/27"] do={remove $i}
/ ip address add address=10.139.14.1/27 network=10.139.14.0 broadcast=10.139.14.31 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.139.14.0/27] do={/routing ospf network remove $i;}
add network=10.139.14.0/27 area=backbone disabled=no
:delay 1
#
# DHCP
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
:foreach i in [/ip dhcp-server network find address="10.139.14.0/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.139.14.7-10.139.14.30
/ip dhcp-server network add address=10.139.14.0/27 gateway=10.139.14.1 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=no
#
:delay 1
#
# Radio#: 1 ALBMDDMon-AP2
/interface wireless set wlan2 name="wlan2" \
radio-name="ALBMDDMon-AP2" mode=ap-bridge ssid="guifi.net-ALBMDDMon-AP2" \
band="5ghz" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=5260 \
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_AjuntCastellRadio1" master-interface=wlan2 wds-address=FF:FF:FF:FF:FF:FF disabled=yes
/ ip address add address=172.25.7.218/27 network=172.25.7.192 broadcast=172.25.7.223 interface=wds_AjuntCastellRadio1 disabled=yes comment="wds_AjuntCastellRadio1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_AjuntCastellRadio1] do={/routing ospf interface remove $i;}
add interface=wds_AjuntCastellRadio1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.7.192/27] do={/routing ospf network remove $i;}
add network=172.25.7.192/27 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=AjuntCastellRadio1] do={/routing bgp peer remove $i;}
add name="AjuntCastellRadio1" instance=default remote-address=172.25.7.217 remote-as=7667 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=no
#
:delay 1
#
# Radio#: 2 ALBMDDMon-AP3
/interface wireless set wlan3 name="wlan3" \
radio-name="ALBMDDMon-AP3" mode=ap-bridge ssid="guifi.net-ALBMDDMon-AP3" \
band="5ghz" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=5300 \
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_SibiRadio1" master-interface=wlan3 wds-address=00:15:6D:63:77:92 disabled=yes
/ ip address add address=172.25.6.234/30 network=172.25.6.232 broadcast=172.25.6.235 interface=wds_SibiRadio1 disabled=yes comment="wds_SibiRadio1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_SibiRadio1] do={/routing ospf interface remove $i;}
add interface=wds_SibiRadio1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.6.232/30] do={/routing ospf network remove $i;}
add network=172.25.6.232/30 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=SibiRadio1] do={/routing bgp peer remove $i;}
add name="SibiRadio1" instance=default remote-address=172.25.6.233 remote-as=7843 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=no
/ interface wireless wds
add name="wds_AjunArgelaguerRadio1" master-interface=wlan3 wds-address=00:15:6D:63:79:5E disabled=yes
/ ip address add address=172.25.7.254/30 network=172.25.7.252 broadcast=172.25.7.255 interface=wds_AjunArgelaguerRadio1 disabled=yes comment="wds_AjunArgelaguerRadio1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_AjunArgelaguerRadio1] do={/routing ospf interface remove $i;}
add interface=wds_AjunArgelaguerRadio1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.7.252/30] do={/routing ospf network remove $i;}
add network=172.25.7.252/30 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=AjunArgelaguerRadio1] do={/routing bgp peer remove $i;}
add name="AjunArgelaguerRadio1" instance=default remote-address=172.25.7.253 remote-as=7692 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=no
#
:delay 1
# Type: wLan
/ip address
:foreach i in [find address="10.139.14.65/27"] do={remove $i}
/ ip address add address=10.139.14.65/27 network=10.139.14.64 broadcast=10.139.14.95 interface=wlan3 disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wlan3] do={/routing ospf interface remove $i;}
add interface=wlan3
/ routing ospf network
:foreach i in [/routing ospf network find network=10.139.14.64/27] do={/routing ospf network remove $i;}
add network=10.139.14.64/27 area=backbone disabled=no
:delay 1
#
# DHCP
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
:foreach i in [/ip dhcp-server network find address="10.139.14.64/27"] do={/ip dhcp-server network remove $i;}
:foreach i in [/ip pool find name=dhcp-wlan3] do={/ip pool remove $i;}
/ip pool add name=dhcp-wlan3 ranges=10.139.14.71-10.139.14.94
/ip dhcp-server network add address=10.139.14.64/27 gateway=10.139.14.65 domain=guifi.net comment=dhcp-wlan3
:foreach i in [/ip dhcp-server find name=dhcp-wlan3] do={/ip dhcp-server remove $i;}
/ip dhcp-server add name=dhcp-wlan3 interface=wlan3 address-pool=dhcp-wlan3 disabled=no
#
:delay 1
#
# Radio#: 3 ALBMDDMon-SFERRIOLTelecentre
/interface wireless set wlan4 name="wlan4" \
radio-name="ALBMDDMon-SFERRIOLTelecentre" mode=ap-bridge ssid="guifi.net-ALBMDDMon-SFERRIOLTelecentre" \
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: 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;}
/ interface wireless wds
add name="wds_SFERRIOLTelecentreRadio1" master-interface=wlan4 wds-address=00:0B:6B:81:3E:5D disabled=yes
/ ip address add address=172.25.7.42/30 network=172.25.7.40 broadcast=172.25.7.43 interface=wds_SFERRIOLTelecentreRadio1 disabled=yes comment="wds_SFERRIOLTelecentreRadio1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_SFERRIOLTelecentreRadio1] do={/routing ospf interface remove $i;}
add interface=wds_SFERRIOLTelecentreRadio1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.7.40/30] do={/routing ospf network remove $i;}
add network=172.25.7.40/30 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=SFERRIOLTelecentreRadio1] do={/routing bgp peer remove $i;}
add name="SFERRIOLTelecentreRadio1" instance=default remote-address=172.25.7.41 remote-as=6523 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=no
#
:delay 1
#
# Radio#: 4 ALBMDDMon-4
/interface wireless set wlan5 name="wlan5" \
radio-name="ALBMDDMon-4" mode=ap-bridge ssid="guifi.net-ALBMDDMon-4" \
band="2.4ghz-b" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
dfs-mode=radar-detect \
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=wlan5] \
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_MontolivetRadio1" master-interface=wlan5 wds-address=00:0C:42:23:A0:F2 disabled=yes
/ ip address add address=172.25.2.118/30 network=172.25.2.116 broadcast=172.25.2.119 interface=wds_MontolivetRadio1 disabled=yes comment="wds_MontolivetRadio1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_MontolivetRadio1] do={/routing ospf interface remove $i;}
add interface=wds_MontolivetRadio1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.2.116/30] do={/routing ospf network remove $i;}
add network=172.25.2.116/30 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=MontolivetRadio1] do={/routing bgp peer remove $i;}
add name="MontolivetRadio1" instance=default remote-address=172.25.2.117 remote-as=9200 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=no
#
:delay 1
#
# Radio#: 5 ALBMDDMon-5
/interface wireless set wlan6 name="wlan6" \
radio-name="ALBMDDMon-5" mode=ap-bridge ssid="guifi.net-ALBMDDMon-5" \
band="2.4ghz-b" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
dfs-mode=radar-detect \
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=wlan6] \
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_BDEBisbalencsRadio1" master-interface=wlan6 wds-address=FF:FF:FF:FF:FF:FF disabled=yes
/ ip address add address=172.25.8.13/30 network=172.25.8.12 broadcast=172.25.8.15 interface=wds_BDEBisbalencsRadio1 disabled=yes comment="wds_BDEBisbalencsRadio1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_BDEBisbalencsRadio1] do={/routing ospf interface remove $i;}
add interface=wds_BDEBisbalencsRadio1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.8.12/30] do={/routing ospf network remove $i;}
add network=172.25.8.12/30 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=BDEBisbalencsRadio1] do={/routing bgp peer remove $i;}
add name="BDEBisbalencsRadio1" instance=default remote-address=172.25.8.14 remote-as=6773 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=no
#
:delay 1
#
# Routed device
#
# Other cable connections
#
# 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.139.14.65 to-ports=0-65535 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.139.14.65 to-ports=0-65535 comment="" disabled=no
#
# BGP Routing
# BGP & OSPF Filters
: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
#
# BGP instance
/ routing bgp instance
set default name="default" as=5882 router-id=10.139.14.65 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
#
# OSPF Routing
/routing ospf set router-id=10.139.14.65 redistribute-connected=as-type-1 redistribute-static=as-type-1 redistribute-bgp=as-type-1
#
:log info "Unsolclic for 5882-ALBMDDMon executed."
/