# Generat per a:
# RouterOSv2.9
:log info "Unsolclic for 1938-FolguergolesCanDachsST going to be executed."
#
# Configuration for RouterOS > 2.9.50 or 3.4
# Trasto: 1938-FolguergolesCanDachsST
#
# 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=FolguergolesCanDachsST
#
# DNS (client & server cache) zone: 2450
/ip dns set primary-dns=10.138.18.130 secondary-dns=10.138.25.68 allow-remote-requests=yes
:delay 1
#
# NTP (client & server cache) zone: 2450
/system ntp client set enabled=yes mode=unicast primary-ntp=bandoler.guifi.net
/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="Folgueroles-CanDachs"
#
# 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 5Ghz-FolgCDachs-VicSemi
/interface wireless set wlan1 name="wlan1" \
radio-name="5Ghz-FolgCDachs-VicSemi" mode=ap-bridge ssid="guifi.net-5Ghz-FolgCDachs-VicSemi" \
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=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_VicSeminariST1" master-interface=wlan1 wds-address=00:0B:6B:36:6C:31 disabled=no
/ ip address add address=172.25.10.42/30 network=172.25.10.40 broadcast=172.25.10.43 interface=wds_VicSeminariST1 disabled=no comment="wds_VicSeminariST1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_VicSeminariST1] do={/routing ospf interface remove $i;}
add interface=wds_VicSeminariST1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.10.40/30] do={/routing ospf network remove $i;}
add network=172.25.10.40/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=VicSeminariST1] do={/routing bgp peer remove $i;}
add name="VicSeminariST1" instance=default remote-address=172.25.10.41 remote-as=1941 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=yes
#
:delay 1
# Type: wLan/Lan
/ip address
:foreach i in [find address="10.138.18.129/27"] do={remove $i}
/ ip address add address=10.138.18.129/27 network=10.138.18.128 broadcast=10.138.18.159 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.18.128/27] do={/routing ospf network remove $i;}
add network=10.138.18.128/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.18.130 mac-address=ff:ff:ff:ff:ff:ff client-id=Verdaguer server=dhcp-wLan/Lan
add address=10.138.18.131 mac-address=ff:ff:ff:ff:ff:ff client-id=Folgueroles-CanDachsADSL1 server=dhcp-wLan/Lan
:foreach i in [/ip dhcp-server network find address="10.138.18.128/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.18.137-10.138.18.158
/ip dhcp-server network add address=10.138.18.128/27 gateway=10.138.18.129 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 Folgueroles-CDachsAP1
/interface wireless set wlan2 name="wlan2" \
radio-name="Folgueroles-CDachsAP1" mode=ap-bridge ssid="guifi.net-Folgueroles-CDachsAP1" \
band="2.4ghz-b" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=2442 \
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_FolguerolesCalGuarda" master-interface=wlan2 wds-address=00:12:17:C7:97:6B disabled=yes
/ ip address add address=172.25.0.38/30 network=172.25.0.36 broadcast=172.25.0.39 interface=wds_FolguerolesCalGuarda disabled=yes comment="wds_FolguerolesCalGuarda"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_FolguerolesCalGuarda] do={/routing ospf interface remove $i;}
add interface=wds_FolguerolesCalGuarda
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.0.36/30] do={/routing ospf network remove $i;}
add network=172.25.0.36/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=FolguerolesCalGuarda] do={/routing bgp peer remove $i;}
add name="FolguerolesCalGuarda" instance=default remote-address=172.25.0.37 remote-as=320 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=yes
#
:delay 1
# Type: wLan
/ip address
:foreach i in [find address="10.138.18.161/27"] do={remove $i}
/ ip address add address=10.138.18.161/27 network=10.138.18.160 broadcast=10.138.18.191 interface=wlan2 disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wlan2] do={/routing ospf interface remove $i;}
add interface=wlan2
/ routing ospf network
:foreach i in [/routing ospf network find network=10.138.18.160/27] do={/routing ospf network remove $i;}
add network=10.138.18.160/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.18.162 mac-address=00:0F:66:51:DD:44 client-id=FolguerolesAlbert server=dhcp-wlan2
add address=10.138.18.163 mac-address=00:12:17:D7:A7:AE client-id=FolguerolesCastelltort server=dhcp-wlan2
add address=10.138.18.164 mac-address=00:14:BF:77:75:1B client-id=FolguerolesIsaac server=dhcp-wlan2
add address=10.138.18.165 mac-address=00:14:BF:EB:8E:44 client-id=FolguerolesAnnaRadio1 server=dhcp-wlan2
add address=10.138.18.166 mac-address=00:16:01:4D:AD:7A client-id=FolguerolesSusannaRadio server=dhcp-wlan2
add address=10.138.18.167 mac-address=00:18:39:C6:84:25 client-id=FolgFrancescPerezRadio1 server=dhcp-wlan2
add address=10.138.18.168 mac-address=00:14:BF:77:9C:C6 client-id=SJVPpetitRadio2 server=dhcp-wlan2
add address=10.138.18.169 mac-address=00:14:BF:EB:72:B3 client-id=FOLGRafelgrandioRadio1 server=dhcp-wlan2
add address=10.138.18.170 mac-address=00:16:01:4D:79:3E client-id=FolguerolesEnricRadio1 server=dhcp-wlan2
add address=10.138.18.171 mac-address=ff:ff:ff:ff:ff:ff client-id=FolguerolesImmaRadio1 server=dhcp-wlan2
add address=10.138.18.172 mac-address=00:14:BF:D2:6D:F5 client-id=FolgHerminia server=dhcp-wlan2
add address=10.138.18.173 mac-address=00:18:39:C6:27:7F client-id=NovissimaRadio1 server=dhcp-wlan2
add address=10.138.18.174 mac-address=00:18:39:AE:4C:52 client-id=FolgMadrona server=dhcp-wlan2
add address=10.138.18.175 mac-address=ff:ff:ff:ff:ff:ff client-id=FolgMontseSalvansRadio1 server=dhcp-wlan2
add address=10.138.18.176 mac-address=00:1D:7E:43:AE:32 client-id=FolgMarsoRadio1 server=dhcp-wlan2
add address=10.138.18.177 mac-address=ff:ff:ff:ff:ff:ff client-id=FolguerolesBrudeSala server=dhcp-wlan2
add address=10.138.18.178 mac-address=00:16:01:AD:AE:EE client-id=FolguerolesGilabertRadio server=dhcp-wlan2
add address=10.138.18.179 mac-address=00:16:B6:39:7A:6C client-id=FolguerolesVirolaiRadio1 server=dhcp-wlan2
add address=10.138.18.180 mac-address=00:16:01:84:A6:22 client-id=FOLGCasicaRadio1 server=dhcp-wlan2
add address=10.138.18.181 mac-address=00:18:39:AE:88:67 client-id=FolgIntergen server=dhcp-wlan2
add address=10.138.18.182 mac-address=00:18:F8:E5:FB:45 client-id=FOLGjordi server=dhcp-wlan2
add address=10.138.18.183 mac-address=00:18:39:C6:4B:13 client-id=SJVErraRadio1 server=dhcp-wlan2
add address=10.138.18.184 mac-address=00:16:01:15:A3:3A client-id=VicLidiaRadio1 server=dhcp-wlan2
add address=10.138.18.185 mac-address=00:1A:70:4F:0D:59 client-id=VicMinetRadio1 server=dhcp-wlan2
add address=10.138.18.186 mac-address=00:16:01:8C:5C:DA client-id=SJVAliciaRadio1 server=dhcp-wlan2
add address=10.138.18.187 mac-address=00:16:B6:39:8E:E7 client-id=FolguerolesCabreraRadio1 server=dhcp-wlan2
add address=10.138.18.188 mac-address=00:16:01:92:66:B0 client-id=VicJaumeRadio1 server=dhcp-wlan2
add address=10.138.18.189 mac-address=00:80:48:4E:FF:A2 client-id=FolgCMajor36 server=dhcp-wlan2
add address=10.138.18.190 mac-address=00:1D:7E:28:19:CB client-id=FolguerolesABoverRadio1 server=dhcp-wlan2
:foreach i in [/ip dhcp-server network find address="10.138.18.160/27"] do={/ip dhcp-server network remove $i;}
:foreach i in [/ip pool find name=dhcp-wlan2] do={/ip pool remove $i;}
/ip pool add name=dhcp-wlan2 ranges=10.138.18.190-10.138.18.190
/ip dhcp-server network add address=10.138.18.160/27 gateway=10.138.18.161 domain=guifi.net comment=dhcp-wlan2
:foreach i in [/ip dhcp-server find name=dhcp-wlan2] do={/ip dhcp-server remove $i;}
/ip dhcp-server add name=dhcp-wlan2 interface=wlan2 address-pool=dhcp-wlan2 disabled=yes
#
:delay 1
#
# Radio#: 2 Folgueroles-CDachsAP3
/interface wireless set wlan3 name="wlan3" \
radio-name="Folgueroles-CDachsAP3" mode=ap-bridge ssid="guifi.net-Folgueroles-CDachsAP3" \
band="2.4ghz-b" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=2417 \
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;}
#
:delay 1
# Type: wLan
/ip address
:foreach i in [find address="10.138.18.1/27"] do={remove $i}
/ ip address add address=10.138.18.1/27 network=10.138.18.0 broadcast=10.138.18.31 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.138.18.0/27] do={/routing ospf network remove $i;}
add network=10.138.18.0/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.18.2 mac-address=00:1D:7E:28:1B:DD client-id=FolguerolesgrauRadio1 server=dhcp-wlan3
add address=10.138.18.3 mac-address=00:16:01:AF:C5:0F client-id=FolgSadurniRadio1 server=dhcp-wlan3
add address=10.138.18.4 mac-address=00:1D:7E:55:66:BB client-id=folguerolestioRadio1 server=dhcp-wlan3
add address=10.138.18.5 mac-address=00:80:48:4E:FF:AE client-id=FolguerolesAmadeuRadio1 server=dhcp-wlan3
add address=10.138.18.6 mac-address=ff:ff:ff:ff:ff:ff client-id=FolgBoixaderRadio1 server=dhcp-wlan3
add address=10.138.18.7 mac-address=00:0C:42:16:03:BF client-id=FolguerolesLaiaDavidRadio2 server=dhcp-wlan3
add address=10.138.18.8 mac-address=00:16:01:92:6B:A8 client-id=FolgRicardRadio1 server=dhcp-wlan3
add address=10.138.18.9 mac-address=00:1D:7E:27:EE:EA client-id=FolguerolesJFontRadio1 server=dhcp-wlan3
add address=10.138.18.10 mac-address=00:16:01:AF:00:BC client-id=FolguerolesJustRadio1 server=dhcp-wlan3
add address=10.138.18.11 mac-address=00:1C:10:38:4F:B8 client-id=LlopartR1 server=dhcp-wlan3
add address=10.138.18.12 mac-address=00:1A:70:4F:42:87 client-id=folguechenRadio1 server=dhcp-wlan3
add address=10.138.18.13 mac-address=00:1D:7E:28:1A:EE client-id=FolguerolesEsbartRadio2 server=dhcp-wlan3
add address=10.138.18.14 mac-address=00:19:E0:67:A9:B3 client-id=FolguerolesBatisteRadio1 server=dhcp-wlan3
add address=10.138.18.15 mac-address=00:1D:7E:30:CB:DA client-id=FolgAutetRadio1 server=dhcp-wlan3
add address=10.138.18.16 mac-address=00:16:01:B0:72:87 client-id=FolguerolesAlbaPRadio1 server=dhcp-wlan3
add address=10.138.18.17 mac-address=ff:ff:ff:ff:ff:ff client-id=folgBruixaRadio2 server=dhcp-wlan3
add address=10.138.18.18 mac-address=ff:ff:ff:ff:ff:ff client-id=FolguerolesCarmeRadio1 server=dhcp-wlan3
add address=10.138.18.19 mac-address=00:15:6D:A8:20:E2 client-id=FolguerolesCollellRadio1 server=dhcp-wlan3
add address=10.138.18.20 mac-address=ff:ff:ff:ff:ff:ff client-id=ManlleuAGuimeraRadio1 server=dhcp-wlan3
add address=10.138.18.21 mac-address=ff:ff:ff:ff:ff:ff client-id=FolgJesusMRadio1 server=dhcp-wlan3
add address=10.138.18.22 mac-address=00:19:E0:67:56:69 client-id=FolguerolesJMVallsRadio1 server=dhcp-wlan3
add address=10.138.18.23 mac-address=00:1A:70:7B:5D:35 client-id=VicMartiFOL3 server=dhcp-wlan3
add address=10.138.18.24 mac-address=ff:ff:ff:ff:ff:ff client-id=FolguerolesEsbaRadio1 server=dhcp-wlan3
add address=10.138.18.25 mac-address=00:15:6D:E0:98:86 client-id=GurbElCervatoIIRadio1 server=dhcp-wlan3
add address=10.138.18.26 mac-address=00:16:01:AE:29:2C client-id=FolgPassavantRadio2 server=dhcp-wlan3
add address=10.138.18.27 mac-address=00:1D:7E:4B:26:32 client-id=FolguerolesAiamnaojradio1 server=dhcp-wlan3
add address=10.138.18.28 mac-address=00:16:B6:39:8F:4B client-id=GurbElCervatoRadio2 server=dhcp-wlan3
add address=10.138.18.29 mac-address=ff:ff:ff:ff:ff:ff client-id=FolgJoanMRadio1 server=dhcp-wlan3
add address=10.138.18.30 mac-address=00:1D:7E:28:19:D4 client-id=FolguerolesCrtVilanoRadio1 server=dhcp-wlan3
:foreach i in [/ip dhcp-server network find address="10.138.18.0/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.138.18.30-10.138.18.30
/ip dhcp-server network add address=10.138.18.0/27 gateway=10.138.18.1 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=yes
#
:delay 1
#
# Routed device
#
# Other cable connections
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=ether1] do={/routing ospf interface remove $i;}
add interface=ether1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.0.24/30] do={/routing ospf network remove $i;}
add network=172.25.0.24/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=Folgueroles-CanDachsAP2] do={/routing bgp peer remove $i;}
add name="Folgueroles-CanDachsAP2" instance=default remote-address=172.25.0.25 remote-as=1940 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=yes
:foreach i in [/ip address find address="172.25.0.26/30"] do={/ip address remove $i;}
:delay 1
/ ip address add address=172.25.0.26/30 network=172.25.0.24 broadcast=172.25.0.27 interface=ether1 disabled=no comment="Folgueroles-CanDachsAP2"
#
# 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.18.1 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.138.18.1 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=1938 router-id=10.138.18.1 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.138.18.1 redistribute-connected=as-type-1 redistribute-static=as-type-1 redistribute-bgp=as-type-1
#
:log info "Unsolclic for 1938-FolguergolesCanDachsST executed."
/