# Generat per a:
# RouterOSv3.x
:log info "Unsolclic for 18991-CdPAlicante-RB2011 going to be executed."
#
# Configuration for RouterOSv3.x
# Device: 18991-CdPAlicante-RB2011
#
# 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 if you use RouterOSv2.9 , 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=CdPAlicante-RB2011
#
# DNS (client & server cache) zone: 11275
/ip dns set primary-dns=10.228.130.162 secondary-dns=10.228.130.162 allow-remote-requests=yes
:delay 1
#
# NTP (client & server cache) zone: 11275
/system ntp client set enabled=yes mode=unicast primary-ntp=10.228.130.162 secondary-ntp=10.228.130.162
: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="CdPAlicante01"
#
# Guest user
/user
:foreach i in [find group=read] do={/user remove $i;}
add name="guest" group=read address=10.0.0.0/8 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 castalia-T2-96
/interface wireless set wlan1 name="wlan1" \
radio-name="castalia-T2-96" mode=ap-bridge ssid="guifi.net-castalia-T2-96" \
band="5ghz" \
frequency-mode=regulatory-domain country=spain antenna-gain=14 \
dfs-mode=radar-detect \
antenna-mode=ant-a 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: wdscastalia-T2-96
# 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_CdPParqueLidonRd1" master-interface=wlan1 wds-address=00:00:00:00:00:00 disabled=no
/ ip address add address=172.16.2.158/30 network=172.16.2.156 broadcast=172.16.2.159 interface=wds_CdPParqueLidonRd1 disabled=no comment="wds_CdPParqueLidonRd1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_CdPParqueLidonRd1] do={/routing ospf interface remove $i;}
add interface=wds_CdPParqueLidonRd1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.16.2.156/30] do={/routing ospf network remove $i;}
add network=172.16.2.156/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=CdPParqueLidonRd1] do={/routing bgp peer remove $i;}
add name="CdPParqueLidonRd1" instance=default remote-address=172.16.2.157 remote-as=47498 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=yes
/ interface wireless wds
add name="wds_GrauCSLaPlana82RB" master-interface=wlan1 wds-address=00:01:02:03:04:09 disabled=no
/ ip address add address=172.16.2.210/30 network=172.16.2.208 broadcast=172.16.2.211 interface=wds_GrauCSLaPlana82RB disabled=no comment="wds_GrauCSLaPlana82RB"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_GrauCSLaPlana82RB] do={/routing ospf interface remove $i;}
add interface=wds_GrauCSLaPlana82RB
/ routing ospf network
:foreach i in [/routing ospf network find network=172.16.2.208/30] do={/routing ospf network remove $i;}
add network=172.16.2.208/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=GrauCSLaPlana82RB] do={/routing bgp peer remove $i;}
add name="GrauCSLaPlana82RB" instance=default remote-address=172.16.2.209 remote-as=30975 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=yes
#
:delay 1
# Type: wLan/Lan
/ip address
:foreach i in [find address="10.228.144.161/27"] do={remove $i}
/ ip address add address=10.228.144.161/27 network=10.228.144.160 broadcast=10.228.144.191 interface=wLan/Lan disabled=no
/ routing bgp network
:foreach i in [/routing bgp network find network=10.228.144.160/27] do={/routing bgp network remove $i;}
add network=10.228.144.160/27 synchronize=no 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.228.144.160/27] do={/routing ospf network remove $i;}
add network=10.228.144.160/27 area=backbone disabled=no
:delay 1
#
# DHCP
:foreach i in [/ip pool find name=dhcp-wLan/Lan] do={/ip pool remove $i;}
/ip pool add name=dhcp-wLan/Lan ranges=10.228.144.167-10.228.144.190
: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
:foreach i in [/ip dhcp-server network find address="10.228.144.160/27"] do={/ip dhcp-server network remove $i;}
/ip dhcp-server network add address=10.228.144.160/27 gateway=10.228.144.161 domain=guifi.net comment=dhcp-wLan/Lan
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
add address=10.228.144.163 mac-address=00:00:00:00:00:02 client-id=proxycastalia server=dhcp-wLan/Lan
add address=10.228.144.164 mac-address=00:00:00:00:00:00 client-id=NanoM5PaseoUniversidad server=dhcp-wLan/Lan
add address=10.228.144.165 mac-address=00:00:00:00:00:00 client-id=SXTalicante11 server=dhcp-wLan/Lan
add address=10.228.144.166 mac-address=00:00:00:00:00:00 client-id=NanoM5PintorLopez server=dhcp-wLan/Lan
add address=10.228.144.167 mac-address=00:00:00:00:00:00 client-id=NanoM5ParqueLidon server=dhcp-wLan/Lan
add address=10.228.144.168 mac-address=00:00:00:00:00:00 client-id=NanoM5LaPlana server=dhcp-wLan/Lan
add address=10.228.144.169 mac-address=00:00:00:00:00:00 client-id=Nanotombatossals server=dhcp-wLan/Lan
add address=10.228.144.173 mac-address=00:00:00:00:00:00 client-id=CdPAlicantehomerouter server=dhcp-wLan/Lan
#
:delay 1
#
# Radio#: 1 castaliaPUniversidad
/interface wireless set wlan2 name="wlan2" \
radio-name="castaliaPUniversidad" mode=ap-bridge ssid="guifi.net-castaliaPUniversidad" \
band="5ghz" \
frequency-mode=regulatory-domain country=spain antenna-gain=14 \
dfs-mode=radar-detect \
antenna-mode=ant-a 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_CsSanFernando6omnitik" master-interface=wlan2 wds-address=00:01:02:03:04:05 disabled=yes
/ ip address add address=172.16.4.178/30 network=172.16.4.176 broadcast=172.16.4.179 interface=wds_CsSanFernando6omnitik disabled=yes comment="wds_CsSanFernando6omnitik"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_CsSanFernando6omnitik] do={/routing ospf interface remove $i;}
add interface=wds_CsSanFernando6omnitik
/ routing ospf network
:foreach i in [/routing ospf network find network=172.16.4.176/30] do={/routing ospf network remove $i;}
add network=172.16.4.176/30 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=CsSanFernando6omnitik] do={/routing bgp peer remove $i;}
add name="CsSanFernando6omnitik" instance=default remote-address=172.16.4.177 remote-as=66161 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=no
/ interface wireless wds
add name="wds_Omnitiktombatossals" master-interface=wlan2 wds-address=D4:C4:6D:C1:93:C9 disabled=no
/ ip address add address=172.16.10.101/30 network=172.16.10.100 broadcast=172.16.10.103 interface=wds_Omnitiktombatossals disabled=no comment="wds_Omnitiktombatossals"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_Omnitiktombatossals] do={/routing ospf interface remove $i;}
add interface=wds_Omnitiktombatossals
/ routing ospf network
:foreach i in [/routing ospf network find network=172.16.10.100/30] do={/routing ospf network remove $i;}
add network=172.16.10.100/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=Omnitiktombatossals] do={/routing bgp peer remove $i;}
add name="Omnitiktombatossals" instance=default remote-address=172.16.10.102 remote-as=61240 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=yes
#
:delay 1
#
# Radio#: 2 Castalia-T3-250
/interface wireless set wlan3 name="wlan3" \
radio-name="Castalia-T3-250" mode=ap-bridge ssid="guifi.net-Castalia-T3-250" \
band="5ghz" \
frequency-mode=regulatory-domain country=spain antenna-gain=16 \
dfs-mode=radar-detect \
antenna-mode=ant-a 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: wdsCastalia-T3-250
# 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_CdPPintorLopez33RB450G" master-interface=wlan3 wds-address=00:15:6D:8A:6E:BF disabled=no
/ ip address add address=172.16.4.18/30 network=172.16.4.16 broadcast=172.16.4.19 interface=wds_CdPPintorLopez33RB450G disabled=no comment="wds_CdPPintorLopez33RB450G"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_CdPPintorLopez33RB450G] do={/routing ospf interface remove $i;}
add interface=wds_CdPPintorLopez33RB450G
/ routing ospf network
:foreach i in [/routing ospf network find network=172.16.4.16/30] do={/routing ospf network remove $i;}
add network=172.16.4.16/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=CdPPintorLopez33RB450G] do={/routing bgp peer remove $i;}
add name="CdPPintorLopez33RB450G" instance=default remote-address=172.16.4.17 remote-as=49917 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=yes
#
:delay 1
#
# Radio#: 3 CdPAlicante11-T1-010
/interface wireless set wlan4 name="wlan4" \
radio-name="CdPAlicante11-T1-010" mode=ap-bridge ssid="guifi.net-CdPAlicante11-T1-010" \
band="5ghz" \
frequency-mode=regulatory-domain country=spain antenna-gain=14 \
dfs-mode=radar-detect \
antenna-mode=ant-a 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: wdsCdPAlicante11-T1-010
# 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_CdPAlicante11Omnitik" master-interface=wlan4 wds-address=00:0C:42:FF:1F:4F disabled=no
/ ip address add address=172.16.2.42/30 network=172.16.2.40 broadcast=172.16.2.43 interface=wds_CdPAlicante11Omnitik disabled=no comment="wds_CdPAlicante11Omnitik"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_CdPAlicante11Omnitik] do={/routing ospf interface remove $i;}
add interface=wds_CdPAlicante11Omnitik
/ routing ospf network
:foreach i in [/routing ospf network find network=172.16.2.40/30] do={/routing ospf network remove $i;}
add network=172.16.2.40/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=CdPAlicante11Omnitik] do={/routing bgp peer remove $i;}
add name="CdPAlicante11Omnitik" instance=default remote-address=172.16.2.41 remote-as=46599 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=yes
#
:delay 1
#
# Radio#: 4 castalia-calderon
/interface wireless set wlan5 name="wlan5" \
radio-name="castalia-calderon" mode=ap-bridge ssid="guifi.net-castalia-calderon" \
band="5ghz" \
frequency-mode=regulatory-domain country=spain antenna-gain=14 \
dfs-mode=radar-detect \
antenna-mode=ant-a 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: wdscastalia-calderon
# 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;}
#
:delay 1
#
# Routed device
#
# Altres connexions de cable
/ 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=10.90.86.0/28] do={/routing ospf network remove $i;}
add network=10.90.86.0/28 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=Andromeda] do={/routing bgp peer remove $i;}
add name="Andromeda" instance=default remote-address=10.90.86.2 remote-as=69162 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=no
:foreach i in [/ip address find address="10.90.86.1/28"] do={/ip address remove $i;}
:delay 1
/ ip address add address=10.90.86.1/28 network=10.90.86.0 broadcast=10.90.86.15 interface=ether1 disabled=no comment="Andromeda"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=ether2] do={/routing ospf interface remove $i;}
add interface=ether2
/ routing ospf network
:foreach i in [/routing ospf network find network=172.16.7.88/30] do={/routing ospf network remove $i;}
add network=172.16.7.88/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=CdPAlicante01Omnitik] do={/routing bgp peer remove $i;}
add name="CdPAlicante01Omnitik" instance=default remote-address=172.16.7.90 remote-as=33874 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=yes
:foreach i in [/ip address find address="172.16.7.89/30"] do={/ip address remove $i;}
:delay 1
/ ip address add address=172.16.7.89/30 network=172.16.7.88 broadcast=172.16.7.91 interface=ether2 disabled=no comment="CdPAlicante01Omnitik"
#
# Internal addresses NAT
:foreach i in [/ip firewall nat find src-address="172.16.0.0/12"] 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.228.144.161 comment="" disabled=no
#
# Enrutament BGP
# 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;}
:foreach i in [/routing filter find chain=ebgp-in] do={/routing filter remove $i;}
:foreach i in [/routing filter find chain=ebgp-out] do={/routing filter remove $i;}
/ routing filter
add chain=ebgp-in comment="0. Set ebgp-in preferred source." set-pref-src="10.228.144.161" disabled=no
add action=discard chain=ebgp-in comment="1. Discard insert non 10.x routes from BGP peer" disabled=no invert-match=no prefix=!10.0.0.0/8 prefix-length=8-32
add action=discard chain=ebgp-out comment="2. Discard send non 10.x routes to BGP peer" disabled=no invert-match=no prefix=!10.0.0.0/8 prefix-length=8-32
add action=accept chain=ospf-in comment="3. Accept insert 10.x routes from OSPF neighbor" disabled=no invert-match=no prefix=10.0.0.0/8 prefix-length=8-32 set-pref-src="10.228.144.161"
add action=accept chain=ospf-in comment="4. Accept insert 172.x routes from OSPF neighbor" disabled=no invert-match=no prefix=172.16.0.0/12 prefix-length=8-32
add action=discard chain=ospf-in comment="5. Discard insert non 10.x and 172.x from OSPF neighbor" disabled=no invert-match=no
add action=accept chain=ospf-out comment="6. Allow send 10.x routes to OSPF neighbor" disabled=no invert-match=no prefix=10.0.0.0/8 prefix-length=8-32
add action=accept chain=ospf-out comment="7. Allow send 172.x routes to OSPF neighbor" disabled=no invert-match=no prefix=172.16.0.0/12 prefix-length=8-32
add action=discard chain=ospf-out comment="8. Discard send non 10.x and 172.x to OSPF neighbor" disabled=no invert-match=no
#
# Instància BGP
/ routing bgp instance
set default name="default" as=18991 router-id=10.228.144.161 \
redistribute-connected=yes redistribute-static=yes redistribute-rip=yes \
redistribute-ospf=yes redistribute-other-bgp=yes out-filter=ebgp-out \
client-to-client-reflection=yes comment="" disabled=no
#
# Enrutament OSPF
/routing ospf set router-id=10.228.144.161 distribute-default=never redistribute-connected=no \
redistribute-static=no redistribute-rip=no redistribute-bgp=as-type-1
#
:log info "Unsolclic for 18991-CdPAlicante-RB2011 executed."
/