# Generat per a:
# RouterOSv2.9
:log info "Unsolclic for 72-VinyolesDipST going to be executed."
#
# Configuració per RouterOS > 2.9.51 or 3.9
# Trasto: 72-VinyolesDipST
#
# 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=VinyolesDipST
#
# DNS (client & server cache) zone: 2457
/ip dns set primary-dns=10.138.20.101 secondary-dns=10.138.25.68 allow-remote-requests=yes
:delay 1
#
# NTP (client & server cache) zone: 2457
/system ntp client set enabled=yes mode=unicast primary-ntp=10.138.15.130
/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="VoltregaVinyoles"
#
# 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 VinyolesAP
/interface wireless set wlan1 name="wlan1" \
radio-name="VinyolesAP" mode=ap-bridge ssid="guifi.net-VinyolesAP" \
band="2.4ghz-b" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=2457 \
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: Wan
/ip address
:foreach i in [find interface=wlan1] do={remove $i}
:foreach i in [find address="10.138.31.2/27"] do={remove $i}
/ ip address add address=10.138.31.2/27 network=10.138.31.0 broadcast=10.138.31.31 interface=wlan1 disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wlan1] do={/routing ospf interface remove $i;}
add interface=wlan1
/ routing ospf network
:foreach i in [/routing ospf network find network=10.138.31.0/27] do={/routing ospf network remove $i;}
add network=10.138.31.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.138.31.0/27"] do={/ip dhcp-server network remove $i;}
:foreach i in [/ip pool find name=dhcp-wlan1] do={/ip pool remove $i;}
/ip pool add name=dhcp-wlan1 ranges=10.138.31.7-10.138.31.30
/ip dhcp-server network add address=10.138.31.0/27 gateway=10.138.31.1 domain=guifi.net comment=dhcp-wlan1
:foreach i in [/ip dhcp-server find name=dhcp-wlan1] do={/ip dhcp-server remove $i;}
/ip dhcp-server add name=dhcp-wlan1 interface=wlan1 address-pool=dhcp-wlan1 disabled=no
#
:delay 1
# Type: wLan/Lan
/ip address
:foreach i in [find address="10.138.41.65/27"] do={remove $i}
/ ip address add address=10.138.41.65/27 network=10.138.41.64 broadcast=10.138.41.95 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.41.64/27] do={/routing ospf network remove $i;}
add network=10.138.41.64/27 area=backbone disabled=no
:delay 1
#
# DHCP
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
add address=172.25.6.125 mac-address=00:0C:42:0E:7A:C0 client-id=VinyolesDipST2 server=dhcp-wLan/Lan
add address=10.138.41.66 mac-address=00:13:10:E5:8A:E7 client-id=MasiesJSurinach server=dhcp-wLan/Lan
add address=10.138.41.67 mac-address=ff:ff:ff:ff:ff:ff client-id=VinyolesRoger server=dhcp-wLan/Lan
add address=10.138.41.68 mac-address=00:16:01:F2:20:05 client-id=TSalaRadio1 server=dhcp-wLan/Lan
add address=10.138.41.69 mac-address=00:14:BF:3C:38:F7 client-id=VinyolesJForcadaRadio1 server=dhcp-wLan/Lan
add address=10.138.41.70 mac-address=ff:ff:ff:ff:ff:ff client-id=MasiesVBiblioacces server=dhcp-wLan/Lan
add address=10.138.41.71 mac-address=00:14:BF:C4:F9:5E client-id=VinyolesCapdevila server=dhcp-wLan/Lan
add address=10.138.41.72 mac-address=ff:ff:ff:ff:ff:ff client-id=VinyolesIolaRadio1 server=dhcp-wLan/Lan
add address=10.138.41.73 mac-address=00:1D:7E:BC:35:C4 client-id=VinyolesJCAylagasRadio1 server=dhcp-wLan/Lan
add address=10.138.41.74 mac-address=00:14:BF:EB:6E:54 client-id=MdVASanchezRadio1 server=dhcp-wLan/Lan
add address=10.138.41.75 mac-address=00:16:01:4D:87:DC client-id=TorelloAbelRadio1 server=dhcp-wLan/Lan
add address=10.138.41.76 mac-address=ff:ff:ff:ff:ff:ff client-id=TorelloAlexisRadio1 server=dhcp-wLan/Lan
add address=10.138.41.77 mac-address=ff:ff:ff:ff:ff:ff client-id=SBLLAlbertRadio1 server=dhcp-wLan/Lan
add address=10.138.41.78 mac-address=00:18:39:C6:83:20 client-id=VinyolesSoldeRadio1 server=dhcp-wLan/Lan
add address=10.138.41.79 mac-address=00:16:01:8C:81:82 client-id=TorelloJHomsRadio1 server=dhcp-wLan/Lan
add address=10.138.41.80 mac-address=ff:ff:ff:ff:ff:ff client-id=SVDTMorenoRadio1 server=dhcp-wLan/Lan
add address=10.138.41.81 mac-address=ff:ff:ff:ff:ff:ff client-id=VinyolesGinesta server=dhcp-wLan/Lan
add address=10.138.41.82 mac-address=00:16:01:8F:11:7A client-id=MasiesCabestreRadio1 server=dhcp-wLan/Lan
add address=10.138.41.83 mac-address=00:16:01:AD:D6:EA client-id=VinyolesSantiRadio1 server=dhcp-wLan/Lan
add address=10.138.41.84 mac-address=00:16:01:0D:19:00 client-id=VinyolesECarolRadio1 server=dhcp-wLan/Lan
add address=10.138.41.85 mac-address=00:16:B6:11:3C:10 client-id=TorelloBatistaRadio1 server=dhcp-wLan/Lan
add address=10.138.41.86 mac-address=00:14:0B:FD:26:51 client-id=MasiesAPlanasRadio1 server=dhcp-wLan/Lan
add address=10.138.41.87 mac-address=00:16:01:0D:34:DC client-id=VinyolesEudaldRadio1 server=dhcp-wLan/Lan
add address=10.138.41.89 mac-address=ff:ff:ff:ff:ff:ff client-id=VinyolesMCasasRadio1 server=dhcp-wLan/Lan
add address=10.138.41.90 mac-address=ff:ff:ff:ff:ff:ff client-id=TorelloNNardiWRT0 server=dhcp-wLan/Lan
add address=10.138.41.91 mac-address=00:1C:10:13:B2:18 client-id=VinyolesJoanAntoniRadio1 server=dhcp-wLan/Lan
add address=10.138.41.92 mac-address=00:1C:10:44:2E:70 client-id=VinyolesJCasasRadio1 server=dhcp-wLan/Lan
add address=10.138.41.93 mac-address=00:14:BF:EB:76:47 client-id=Torellofalugaradio2 server=dhcp-wLan/Lan
add address=10.138.41.94 mac-address=00:17:9A:CC:F4:1F client-id=MdVSanllorenteRadio1 server=dhcp-wLan/Lan
:foreach i in [/ip dhcp-server network find address="10.138.41.64/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.41.94-10.138.41.94
/ip dhcp-server network add address=10.138.41.64/27 gateway=10.138.41.65 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;}
/ interface wireless wds
add name="wds_VinyolesCampFutbolRadio1" master-interface=wlan1 wds-address=00:0B:6B:4E:64:27 disabled=no
/ ip address add address=172.25.1.46/30 network=172.25.1.44 broadcast=172.25.1.47 interface=wds_VinyolesCampFutbolRadio1 disabled=no comment="wds_VinyolesCampFutbolRadio1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_VinyolesCampFutbolRadio1] do={/routing ospf interface remove $i;}
add interface=wds_VinyolesCampFutbolRadio1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.1.44/30] do={/routing ospf network remove $i;}
add network=172.25.1.44/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=VinyolesCampFutbolRadio1] do={/routing bgp peer remove $i;}
add name="VinyolesCampFutbolRadio1" instance=default remote-address=172.25.1.45 remote-as=3781 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=yes
/ interface wireless wds
add name="wds_VinyolesASobiranas" master-interface=wlan1 wds-address=00:12:17:BC:D1:B5 disabled=no
/ ip address add address=172.25.2.174/30 network=172.25.2.172 broadcast=172.25.2.175 interface=wds_VinyolesASobiranas disabled=no comment="wds_VinyolesASobiranas"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_VinyolesASobiranas] do={/routing ospf interface remove $i;}
add interface=wds_VinyolesASobiranas
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.2.172/30] do={/routing ospf network remove $i;}
add network=172.25.2.172/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=VinyolesASobiranas] do={/routing bgp peer remove $i;}
add name="VinyolesASobiranas" instance=default remote-address=172.25.2.173 remote-as=327 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=yes
/ interface wireless wds
add name="wds_MdVRSobiranasRadio1" master-interface=wlan1 wds-address=00:14:BF:EB:6E:52 disabled=no
/ ip address add address=172.25.3.78/30 network=172.25.3.76 broadcast=172.25.3.79 interface=wds_MdVRSobiranasRadio1 disabled=no comment="wds_MdVRSobiranasRadio1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_MdVRSobiranasRadio1] do={/routing ospf interface remove $i;}
add interface=wds_MdVRSobiranasRadio1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.3.76/30] do={/routing ospf network remove $i;}
add network=172.25.3.76/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=MdVRSobiranasRadio1] do={/routing bgp peer remove $i;}
add name="MdVRSobiranasRadio1" instance=default remote-address=172.25.3.77 remote-as=1549 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=yes
/ interface wireless wds
add name="wds_MdVTuroEstelloleDipViny" master-interface=wlan1 wds-address=00:14:BF:EF:2F:6E disabled=no
/ ip address add address=172.25.5.106/30 network=172.25.5.104 broadcast=172.25.5.107 interface=wds_MdVTuroEstelloleDipViny disabled=no comment="wds_MdVTuroEstelloleDipViny"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_MdVTuroEstelloleDipViny] do={/routing ospf interface remove $i;}
add interface=wds_MdVTuroEstelloleDipViny
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.5.104/30] do={/routing ospf network remove $i;}
add network=172.25.5.104/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=MdVTuroEstelloleDipViny] do={/routing bgp peer remove $i;}
add name="MdVTuroEstelloleDipViny" instance=default remote-address=172.25.5.105 remote-as=1435 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=yes
#
:delay 1
#
# Radio#: 1 VinyolesDipSud
/interface wireless set wlan2 name="wlan2" \
radio-name="VinyolesDipSud" mode=ap-bridge ssid="guifi.net-VinyolesDipSud" \
band="2.4ghz-b" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=2432 \
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_StHipDipNord" master-interface=wlan2 wds-address=00:0F:66:D9:B8:01 disabled=no
/ ip address add address=172.25.5.209/30 network=172.25.5.208 broadcast=172.25.5.211 interface=wds_StHipDipNord disabled=no comment="wds_StHipDipNord"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_StHipDipNord] do={/routing ospf interface remove $i;}
add interface=wds_StHipDipNord
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.5.208/30] do={/routing ospf network remove $i;}
add network=172.25.5.208/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=StHipDipNord] do={/routing bgp peer remove $i;}
add name="StHipDipNord" instance=default remote-address=172.25.5.210 remote-as=28 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=yes
#
:delay 1
#
# Radio#: 2 VinyolesDipST-OrisST
/interface wireless set wlan3 name="wlan3" \
radio-name="VinyolesDipST-OrisST" mode=ap-bridge ssid="guifi.net-VinyolesDipST-OrisST" \
band="5ghz" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=5200 \
dfs-mode=none \
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=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_OrisAjuntamentST1" master-interface=wlan3 wds-address=00:0B:6B:81:CF:78 disabled=no
/ ip address add address=172.25.8.186/30 network=172.25.8.184 broadcast=172.25.8.187 interface=wds_OrisAjuntamentST1 disabled=no comment="wds_OrisAjuntamentST1"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_OrisAjuntamentST1] do={/routing ospf interface remove $i;}
add interface=wds_OrisAjuntamentST1
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.8.184/30] do={/routing ospf network remove $i;}
add network=172.25.8.184/30 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=OrisAjuntamentST1] do={/routing bgp peer remove $i;}
add name="OrisAjuntamentST1" instance=default remote-address=172.25.8.185 remote-as=4289 \
multihop=no route-reflect=no ttl=1 in-filter=ospf-in out-filter=ospf-out disabled=no
#
:delay 1
#
# Routed device
#
# Altres connexions de cable
:foreach i in [/ip address find address="172.25.4.110/30"] do={/ip address remove $i;}
:delay 1
/ ip address add address=172.25.4.110/30 network=172.25.4.108 broadcast=172.25.4.111 interface=ether3 disabled=no comment=""
#
# 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.41.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.138.41.65 to-ports=0-65535 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=72 router-id=10.138.41.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
#
# Enrutament OSPF
/routing ospf set router-id=10.138.41.65 redistribute-connected=as-type-1 redistribute-static=as-type-1 redistribute-bgp=as-type-1
#
:log info "Unsolclic for 72-VinyolesDipST executed."
/