# Generat per a:
# RouterOSv2.9
:log info "Unsolclic for 4793-SERAntenesST going to be executed."
#
# Configuration for RouterOS > 2.9.51 or 3.9
# Trasto: 4793-SERAntenesST
#
# 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.-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=SERAntenesST
#
# DNS (client & server cache) zone: 2759
/ip dns set primary-dns=10.138.54.162 secondary-dns=10.138.25.68 allow-remote-requests=yes
:delay 1
#
# NTP (client & server cache) zone: 2759
/system ntp client set enabled=yes mode=unicast primary-ntp=10.138.54.162
/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="SERAntenes"
#
# 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 SERAntenesAP
/interface wireless set wlan1 name="wlan1" \
radio-name="SERAntenesAP" mode=ap-bridge ssid="guifi.net-SERAntenesAP" \
band="2.4ghz-b" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=2422 \
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_SERAjAntenes" master-interface=wlan1 wds-address=00:18:F8:CC:E7:49 disabled=no
/ ip address add address=172.25.2.233/30 network=172.25.2.232 broadcast=172.25.2.235 interface=wds_SERAjAntenes disabled=no comment="wds_SERAjAntenes"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_SERAjAntenes] do={/routing ospf interface remove $i;}
add interface=wds_SERAjAntenes
/ routing ospf network
:foreach i in [/routing ospf network find network=172.25.2.232/30] do={/routing ospf network remove $i;}
add network=172.25.2.232/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=SERAjAntenes] do={/routing bgp peer remove $i;}
add name="SERAjAntenes" instance=default remote-address=172.25.2.234 remote-as=3897 \
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.54.65/27"] do={remove $i}
/ ip address add address=10.138.54.65/27 network=10.138.54.64 broadcast=10.138.54.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.54.64/27] do={/routing ospf network remove $i;}
add network=10.138.54.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=10.138.54.66 mac-address=00:16:01:AD:DA:38 client-id=SERROrriolsRadio1 server=dhcp-wLan/Lan
add address=10.138.54.67 mac-address=00:16:01:AD:02:06 client-id=SERVBenitezRadio1 server=dhcp-wLan/Lan
add address=10.138.54.68 mac-address=00:16:01:AD:D7:E2 client-id=SERUzarteRadio1 server=dhcp-wLan/Lan
add address=10.138.54.69 mac-address=00:16:01:8E:D2:82 client-id=SEROliverasRadio1 server=dhcp-wLan/Lan
add address=10.138.54.70 mac-address=00:16:01:AF:BE:28 client-id=SERAreaRadio1 server=dhcp-wLan/Lan
add address=10.138.54.71 mac-address=00:16:01:AE:E8:1C client-id=SerJMoratallaRadio1 server=dhcp-wLan/Lan
add address=10.138.54.72 mac-address=ff:ff:ff:ff:ff:ff client-id=SERFrankeJRRadio1 server=dhcp-wLan/Lan
add address=10.138.54.73 mac-address=00:1C:10:88:75:00 client-id=SERpferresRadio1 server=dhcp-wLan/Lan
add address=10.138.54.74 mac-address=00:1C:10:36:47:15 client-id=StaEulaliapajerolsRadio1 server=dhcp-wLan/Lan
add address=10.138.54.75 mac-address=00:80:48:4E:FF:A5 client-id=SERPauriaRadio1 server=dhcp-wLan/Lan
add address=10.138.54.76 mac-address=ff:ff:ff:ff:ff:ff client-id=SERCrusellaRadio1 server=dhcp-wLan/Lan
add address=10.138.54.77 mac-address=00:1C:10:14:14:85 client-id=SERjsierraRadio1 server=dhcp-wLan/Lan
add address=10.138.54.78 mac-address=00:1C:10:36:57:80 client-id=StaeulaliamolasRadio1 server=dhcp-wLan/Lan
add address=10.138.54.79 mac-address=00:1D:7E:4B:0B:C5 client-id=SERMariaGarRadio1 server=dhcp-wLan/Lan
add address=10.138.54.80 mac-address=00:1C:10:B2:8B:1B client-id=steulaliberchRadio1 server=dhcp-wLan/Lan
add address=10.138.54.81 mac-address=00:16:01:AF:D4:ED client-id=SERPepFRadio1 server=dhcp-wLan/Lan
add address=10.138.54.82 mac-address=00:16:01:AF:00:45 client-id=SERMartosRadio1 server=dhcp-wLan/Lan
add address=10.138.54.83 mac-address=00:16:01:F2:12:80 client-id=vidalRadio1 server=dhcp-wLan/Lan
add address=10.138.54.84 mac-address=00:1D:7E:55:40:5D client-id=StaEulaliaRufino server=dhcp-wLan/Lan
add address=10.138.54.85 mac-address=00:16:01:12:D0:8A client-id=SERGaloRadio1 server=dhcp-wLan/Lan
add address=10.138.54.86 mac-address=00:16:B6:1F:F4:24 client-id=SERJordittR2 server=dhcp-wLan/Lan
add address=10.138.54.87 mac-address=00:16:01:F2:3E:A2 client-id=SERSMasRadio1 server=dhcp-wLan/Lan
add address=10.138.54.88 mac-address=ff:ff:ff:ff:ff:ff client-id=SERLoreRadio1 server=dhcp-wLan/Lan
add address=10.138.54.89 mac-address=ff:ff:ff:ff:ff:ff client-id=SERYGrifellRadio1 server=dhcp-wLan/Lan
add address=10.138.54.90 mac-address=ff:ff:ff:ff:ff:ff client-id=SerCBachRadio1 server=dhcp-wLan/Lan
add address=10.138.54.91 mac-address=00:1D:7E:28:12:C3 client-id=SerLidsersRadio1 server=dhcp-wLan/Lan
add address=10.138.54.92 mac-address=00:19:E0:67:92:C1 client-id=SERAPozoRadio1 server=dhcp-wLan/Lan
add address=10.138.54.93 mac-address=ff:ff:ff:ff:ff:ff client-id=SERJBertranRadio1 server=dhcp-wLan/Lan
add address=10.138.54.94 mac-address=ff:ff:ff:ff:ff:ff client-id=SERmikel server=dhcp-wLan/Lan
:foreach i in [/ip dhcp-server network find address="10.138.54.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.54.94-10.138.54.94
/ip dhcp-server network add address=10.138.54.64/27 gateway=10.138.54.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: wLan
/ip address
:foreach i in [find address="10.138.54.193/27"] do={remove $i}
/ ip address add address=10.138.54.193/27 network=10.138.54.192 broadcast=10.138.54.223 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.54.192/27] do={/routing ospf network remove $i;}
add network=10.138.54.192/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.54.194 mac-address=00:16:01:4C:29:55 client-id=SERcanSoldatR1 server=dhcp-wlan1
add address=10.138.54.195 mac-address=ff:ff:ff:ff:ff:ff client-id=sermmxcRadio1 server=dhcp-wlan1
:foreach i in [/ip dhcp-server network find address="10.138.54.192/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.54.201-10.138.54.222
/ip dhcp-server network add address=10.138.54.192/27 gateway=10.138.54.193 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
#
# Radio#: 1 SERAntenesSeminari
/interface wireless set wlan2 name="wlan2" \
radio-name="SERAntenesSeminari" mode=ap-bridge ssid="guifi.net-SERAntenesSeminari" \
band="5ghz" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=5600 \
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;}
#
:delay 1
#
# Radio#: 2 SERAntenesAPEst
/interface wireless set wlan3 name="wlan3" \
radio-name="SERAntenesAPEst" mode=ap-bridge ssid="guifi.net-SERAntenesAPEst" \
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: 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.54.97/27"] do={remove $i}
/ ip address add address=10.138.54.97/27 network=10.138.54.96 broadcast=10.138.54.127 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.54.96/27] do={/routing ospf network remove $i;}
add network=10.138.54.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.54.99 mac-address=00:0C:42:18:80:6C client-id=SERMasPadrosRadio1 server=dhcp-wlan3
:foreach i in [/ip dhcp-server network find address="10.138.54.96/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.54.105-10.138.54.126
/ip dhcp-server network add address=10.138.54.96/27 gateway=10.138.54.97 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 SERAntenesAPOest
/interface wireless set wlan4 name="wlan4" \
radio-name="SERAntenesAPOest" mode=ap-bridge ssid="guifi.net-SERAntenesAPOest" \
band="2.4ghz-b" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=2452 \
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;}
#
:delay 1
# Type: wLan
/ip address
:foreach i in [find address="10.138.54.129/27"] do={remove $i}
/ ip address add address=10.138.54.129/27 network=10.138.54.128 broadcast=10.138.54.159 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.54.128/27] do={/routing ospf network remove $i;}
add network=10.138.54.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.54.130 mac-address=00:16:01:16:4F:33 client-id=SERTioRadio1 server=dhcp-wlan4
add address=10.138.54.131 mac-address=00:1D:0F:AE:5A:7D client-id=SEREnricSRadio3 server=dhcp-wlan4
:foreach i in [/ip dhcp-server network find address="10.138.54.128/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.54.137-10.138.54.158
/ip dhcp-server network add address=10.138.54.128/27 gateway=10.138.54.129 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
#
# 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.54.129 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.54.129 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=4793 router-id=10.138.54.129 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.54.129 redistribute-connected=as-type-1 redistribute-static=as-type-1 redistribute-bgp=as-type-1
#
:log info "Unsolclic for 4793-SERAntenesST executed."
/