# Generat per a:
# RouterOSv2.9
:log info "Unsolclic for 2788-SQBRepetidor going to be executed."
#
# Configuration for RouterOS > 2.9.50 or 3.4
# Trasto: 2788-SQBRepetidor
#
# 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=SQBRepetidor
#
# DNS (client & server cache) zone: 2670
/ip dns set primary-dns=10.138.195.74 allow-remote-requests=yes
:delay 1
#
# NTP (client & server cache) zone: 2670
/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="SQBRepetidorTV"
#
# 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 SQBAP1
/interface wireless set wlan1 name="wlan1" \
radio-name="SQBAP1" mode=ap-bridge ssid="guifi.net-SQBAP1" \
band="2.4ghz-b" \
frequency-mode=manual-txpower country=spain antenna-gain=0 \
frequency=2412 \
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;}
#
:delay 1
# Type: wLan/Lan
/ip address
:foreach i in [find address="10.138.194.129/26"] do={remove $i}
/ ip address add address=10.138.194.129/26 network=10.138.194.128 broadcast=10.138.194.191 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.194.128/26] do={/routing ospf network remove $i;}
add network=10.138.194.128/26 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.194.130 mac-address=00:1C:10:2F:E6:F9 client-id=SQBMoratoRadio1 server=dhcp-wLan/Lan
add address=10.138.194.131 mac-address=00:16:01:AF:D5:88 client-id=DoctorRadio1 server=dhcp-wLan/Lan
add address=10.138.194.132 mac-address=00:16:01:F2:0E:49 client-id=SQBArenenyesRadio1 server=dhcp-wLan/Lan
add address=10.138.194.133 mac-address=00:16:01:F2:31:E9 client-id=SQBpilarRadio1 server=dhcp-wLan/Lan
add address=10.138.194.134 mac-address=ff:ff:ff:ff:ff:ff client-id=SQBJFerrersRadio1 server=dhcp-wLan/Lan
add address=10.138.194.135 mac-address=00:16:01:AF:AF:04 client-id=SMBLesqueixRadio1 server=dhcp-wLan/Lan
add address=10.138.194.136 mac-address=00:16:01:F2:31:EB client-id=SQBXispesRadio1 server=dhcp-wLan/Lan
add address=10.138.194.137 mac-address=00:1D:7E:3A:36:2C client-id=SQB-JuandomferRadio1 server=dhcp-wLan/Lan
add address=10.138.194.138 mac-address=ff:ff:ff:ff:ff:ff client-id=SQBTSeguraRadio1 server=dhcp-wLan/Lan
add address=10.138.194.139 mac-address=ff:ff:ff:ff:ff:ff client-id=MAIKELRadio1 server=dhcp-wLan/Lan
add address=10.138.194.140 mac-address=00:16:01:AF:E9:A8 client-id=SQBRSoyRadio1 server=dhcp-wLan/Lan
add address=10.138.194.141 mac-address=00:16:01:B0:0C:3F client-id=SQBUESantQuirzeRadio1 server=dhcp-wLan/Lan
add address=10.138.194.142 mac-address=ff:ff:ff:ff:ff:ff client-id=SQBRCastanyRadio1 server=dhcp-wLan/Lan
add address=10.138.194.143 mac-address=00:16:01:F2:07:3E client-id=SQBCComasRadio1 server=dhcp-wLan/Lan
add address=10.138.194.144 mac-address=00:1D:73:05:18:0A client-id=SQBTORadio1 server=dhcp-wLan/Lan
add address=10.138.194.145 mac-address=ff:ff:ff:ff:ff:ff client-id=SQDBdamiagranadosRadio1 server=dhcp-wLan/Lan
add address=10.138.194.146 mac-address=ff:ff:ff:ff:ff:ff client-id=SMBLaVilaRadio1 server=dhcp-wLan/Lan
:foreach i in [/ip dhcp-server network find address="10.138.194.128/26"] 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.194.152-10.138.194.190
/ip dhcp-server network add address=10.138.194.128/26 gateway=10.138.194.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 SQBAP2
/interface wireless set wlan2 name="wlan2" \
radio-name="SQBAP2" mode=ap-bridge ssid="guifi.net-SQBAP2" \
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=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
# Type: wLan
/ip address
:foreach i in [find address="10.138.194.193/26"] do={remove $i}
/ ip address add address=10.138.194.193/26 network=10.138.194.192 broadcast=10.138.194.255 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.194.192/26] do={/routing ospf network remove $i;}
add network=10.138.194.192/26 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.194.194 mac-address=00:1A:70:4E:D2:25 client-id=SQBRomaRadio1 server=dhcp-wlan2
add address=10.138.194.195 mac-address=00:16:01:AF:AF:7B client-id=SQBQK server=dhcp-wlan2
add address=10.138.194.196 mac-address=00:1D:7E:4B:27:A0 client-id=SQBQueroRadio1 server=dhcp-wlan2
add address=10.138.194.197 mac-address=00:16:01:F2:29:5B client-id=SQBSALERESRadio20 server=dhcp-wlan2
add address=10.138.194.198 mac-address=00:18:39:AE:6E:3F client-id=SQBJCrousRadio1 server=dhcp-wlan2
add address=10.138.194.199 mac-address=00:18:39:AE:6E:42 client-id=SQBJVilasecaRadio1 server=dhcp-wlan2
add address=10.138.194.200 mac-address=ff:ff:ff:ff:ff:ff client-id=SQBamadeublascoRadio1 server=dhcp-wlan2
add address=10.138.194.201 mac-address=00:16:01:F2:05:D9 client-id=SQBjosol1967 server=dhcp-wlan2
add address=10.138.194.202 mac-address=ff:ff:ff:ff:ff:ff client-id=SQBjosepsalaRadio1 server=dhcp-wlan2
add address=10.138.194.203 mac-address=ff:ff:ff:ff:ff:ff client-id=SQBABorgesRadio1 server=dhcp-wlan2
add address=10.138.194.204 mac-address=00:16:01:B0:02:B8 client-id=SQBETubertRadio1 server=dhcp-wlan2
add address=10.138.194.205 mac-address=00:16:01:F2:2B:4C client-id=enricbgsRadio1 server=dhcp-wlan2
add address=10.138.194.206 mac-address=00:16:01:B0:03:9E client-id=SoraXCapdevilaRadio1 server=dhcp-wlan2
add address=10.138.194.207 mac-address=00:12:17:07:AD:AE client-id=SQBNeusRadio1 server=dhcp-wlan2
add address=10.138.194.208 mac-address=ff:ff:ff:ff:ff:ff client-id=SQBMPuigRadio1 server=dhcp-wlan2
add address=10.138.194.209 mac-address=ff:ff:ff:ff:ff:ff client-id=SQBMarinaRadio1 server=dhcp-wlan2
add address=10.138.194.210 mac-address=00:16:01:AF:E6:69 client-id=SQBRoloRadio1 server=dhcp-wlan2
add address=10.138.194.211 mac-address=00:1E:E5:36:03:EA client-id=SQBCRuizRadio1 server=dhcp-wlan2
add address=10.138.194.212 mac-address=00:13:10:E5:8A:F1 client-id=sqbjordisRadio1 server=dhcp-wlan2
add address=10.138.194.213 mac-address=ff:ff:ff:ff:ff:ff client-id=SQDBMiquelCRadio1 server=dhcp-wlan2
:foreach i in [/ip dhcp-server network find address="10.138.194.192/26"] 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.194.219-10.138.194.254
/ip dhcp-server network add address=10.138.194.192/26 gateway=10.138.194.193 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=no
#
:delay 1
#
# Routed device
#
# Other cable connections
/ 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.25.226.0/30] do={/routing ospf network remove $i;}
add network=172.25.226.0/30 area=backbone disabled=no
/ routing bgp peer
:foreach i in [find name=SQBRepetidor2] do={/routing bgp peer remove $i;}
add name="SQBRepetidor2" instance=default remote-address=172.25.226.1 remote-as=2798 \
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.226.2/30"] do={/ip address remove $i;}
:delay 1
/ ip address add address=172.25.226.2/30 network=172.25.226.0 broadcast=172.25.226.3 interface=ether2 disabled=no comment="SQBRepetidor2"
#
# 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.194.193 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.194.193 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=2788 router-id=10.138.194.193 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.194.193 redistribute-connected=as-type-1 redistribute-static=as-type-1 redistribute-bgp=as-type-1
#
:log info "Unsolclic for 2788-SQBRepetidor executed."
/