# Gerado para:
# RouterOSv6.x
:log info "Unsolclic for 114265-QRSPedroveya-RB going to be executed."
#
# Configuration for RouterOSv6.x
# Device: 114265-QRSPedroveya-RB
#
# Métodos para carregar/executar este script:
# 1.-Como um script. Envia este resultado como um script ou com:
# a.Winbox (Linux, wine requerido)
# b.Terminal (telnet, ssh ...)
# Em seguida, executa o script com:
# > Script_name run / sistema de script
# 2.-Ficheiro importado:
# Guardar este resultado num ficheiro, em seguida, enviá-lo para o router
# usando ftp com um nome como "script_name.rsc".
# (Repara que a extensão ".rsc" é obrigatória)
# Executa o ficheiro de importação com o comando:
# > import/script_name
# 3.-Copiar&colar Telnet:
# Abre uma sessão de terminal, corta e cola este resultado
# directamente para o terminal input.
#
# Notas:
# O pacote de -routing-test é necessário se usares RouterOSv2.9, certifica-te que está ativo nos pacotes do sistema
# -wlans deve ser ativado manualmente, certifica-te de que está definida uma antena correta (a ou b)
# &nbps;&nbps;segundo a ligação que fizeste do cabo ao miniPCI. Mantém a
# &nbps;&nbps;energia no mínimo possível e verifica o canal.
# -O script não faz reset do router, podes ter que o fazer manualmente
# -Tu deves ter acesso à escrita no router
# -o método de acesso MAC (WinBox, MAC telnet ...) é recomendado
# &nbps;&nbps;(o script reconfigura alguns endereços de IP, por isso pode ser perdida a comunicação)
# -Nenhuma alteração foi feita em senhas de utilizadoras no dispositivo
# -Será criada uma conta Read Only Convidadas, sem senha, para permitir o acesso a convidadas
# ao router sem perigo de danos, mas capaz de ver a configuração.
# -Certifica-te que todos os pacotes estão ativados.
# -Não executes o script a partir da telnet e estando conetada através de uma ligação IP
# na interface wLan/Lan: Esta interface será apagada durante o script.
#
/ system identity set name=QRSPedroveya-RB
#
# DNS (client & server cache) zone: 130176
:delay 1
#
# NTP (client & server cache) zone: 130176
:delay 1
#
# Servidor de largura de banda
/ tool bandwidth-server set enabled=yes authenticate=no allocate-udp-ports-from=2000
#
# SNMP
/snmp community set public addresses=10.0.0.0/8
/snmp set contact="guifi@guifi.net" enabled=yes location="QRSPedroveya" trap-community=public
#
# 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
# Apagar a ponte atual wLan/Lan, se existir
: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;}
:delay 1
#
# Radio#: 0 QRSPedroveya-Linares
/interface wireless set wlan1 name="wlan1" \
radio-name="QRSPedroveya-Linares" mode=ap-bridge ssid="guifi.net-QRSPedroveya-Linares" \
band="5ghz-a" channel-width=20mhz \
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: wdsQRSPedroveya-Linares
# Apagar todas as interfaces WDS existentes
: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_PRZLinaresRB" master-interface=wlan1 wds-address=00:00:00:00:00:00 disabled=no
/ ip address add address=172.16.20.106/30 network=172.16.20.104 broadcast=172.16.20.107 interface=wds_PRZLinaresRB disabled=no comment="wds_PRZLinaresRB"
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=wds_PRZLinaresRB] do={/routing ospf interface remove $i;}
add interface=wds_PRZLinaresRB
/ routing ospf network
:foreach i in [/routing ospf network find network=172.16.20.104/30] do={/routing ospf network remove $i;}
add network=172.16.20.104/30 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=PRZLinaresRB] do={/routing bgp peer remove $i;}
add name="PRZLinaresRB" instance=default remote-address=172.16.20.105 remote-as=81110 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=no
#
:delay 1
#
# Radio#: 1 QRSPedroveya-APSO
/interface wireless set wlan2 name="wlan2" \
radio-name="QRSPedroveya-APSO" mode=ap-bridge ssid="guifi.net-QRSPedroveya-APSO" \
band="5ghz-a" channel-width=20mhz \
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: wLan
/ip address
:foreach i in [find address="10.64.94.33/27"] do={remove $i}
/ ip address add address=10.64.94.33/27 network=10.64.94.32 broadcast=10.64.94.63 interface=wlan2 disabled=no
/ routing bgp network
:foreach i in [/routing bgp network find network=10.64.94.32/27] do={/routing bgp network remove $i;}
add network=10.64.94.32/27 synchronize=no 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.64.94.32/27] do={/routing ospf network remove $i;}
add network=10.64.94.32/27 area=backbone disabled=no
:delay 1
#
# DHCP
:foreach i in [/ip pool find name=dhcp-wlan2] do={/ip pool remove $i;}
/ip pool add name=dhcp-wlan2 ranges=10.64.94.39-10.64.94.62
: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
:foreach i in [/ip dhcp-server network find address="10.64.94.32/27"] do={/ip dhcp-server network remove $i;}
/ip dhcp-server network add address=10.64.94.32/27 gateway=10.64.94.33 domain=guifi.net comment=dhcp-wlan2
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
add address=10.64.94.34 mac-address=00:00:00:00:00:00 client-id=QRSPedroveyabisAPSO server=dhcp-wlan2
add address=10.64.94.35 mac-address=F4:92:BF:FC:A6:48 client-id=QRSLaRebollada7LBAC server=dhcp-wlan2
add address=10.64.94.36 mac-address=F4:92:BF:FC:B6:19 client-id=QRSRebollada1aLBAC server=dhcp-wlan2
add address=10.64.94.37 mac-address=68:D7:9A:98:B8:8E client-id=QRSLaRebollada20LBAC server=dhcp-wlan2
add address=10.64.94.38 mac-address=68:D7:9A:98:B0:F0 client-id=QRSLaRebollada22LBAC server=dhcp-wlan2
add address=10.64.94.39 mac-address=68:D7:9A:98:B9:02 client-id=QRSLaRebollada2LBAC server=dhcp-wlan2
add address=10.64.94.40 mac-address=68:D7:9A:AA:1A:98 client-id=QRSRebollada8LBAC server=dhcp-wlan2
add address=10.64.94.41 mac-address=68:D7:9A:AA:18:1A client-id=QRSRebollada16LBAC server=dhcp-wlan2
add address=10.64.94.42 mac-address=68:D7:9A:AA:18:06 client-id=QRSLaRebollada12LBAC server=dhcp-wlan2
add address=10.64.94.43 mac-address=AC:8B:A9:C2:08:0F client-id=QRSRebollada24LBAC server=dhcp-wlan2
add address=10.64.94.44 mac-address=AC:8B:A9:C2:05:2D client-id=QRSRebollada4LBAC server=dhcp-wlan2
#
:delay 1
#
# Radio#: 2 QRSPedroveya-APNO
/interface wireless set wlan3 name="wlan3" \
radio-name="QRSPedroveya-APNO" mode=ap-bridge ssid="guifi.net-QRSPedroveya-APNO" \
band="5ghz-a" channel-width=20mhz \
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: wLan
/ip address
:foreach i in [find address="10.64.94.65/27"] do={remove $i}
/ ip address add address=10.64.94.65/27 network=10.64.94.64 broadcast=10.64.94.95 interface=wlan3 disabled=no
/ routing bgp network
:foreach i in [/routing bgp network find network=10.64.94.64/27] do={/routing bgp network remove $i;}
add network=10.64.94.64/27 synchronize=no 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.64.94.64/27] do={/routing ospf network remove $i;}
add network=10.64.94.64/27 area=backbone disabled=no
:delay 1
#
# DHCP
:foreach i in [/ip pool find name=dhcp-wlan3] do={/ip pool remove $i;}
/ip pool add name=dhcp-wlan3 ranges=10.64.94.71-10.64.94.94
: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
:foreach i in [/ip dhcp-server network find address="10.64.94.64/27"] do={/ip dhcp-server network remove $i;}
/ip dhcp-server network add address=10.64.94.64/27 gateway=10.64.94.65 domain=guifi.net comment=dhcp-wlan3
/ip dhcp-server lease
:foreach i in [find comment=""] do={remove $i;}
:delay 1
add address=10.64.94.66 mac-address=00:00:00:00:00:00 client-id=QRSPedroveyabisAPNO server=dhcp-wlan3
add address=10.64.94.67 mac-address=68:D7:9A:AA:25:42 client-id=SDRDosango23LBAC server=dhcp-wlan3
add address=10.64.94.68 mac-address=68:D7:9A:98:BA:35 client-id=SDRDosango24LBAC server=dhcp-wlan3
add address=10.64.94.69 mac-address=68:D7:9A:98:B9:B7 client-id=SDRDosango1LBAC server=dhcp-wlan3
add address=10.64.94.70 mac-address=68:D7:9A:AA:1C:15 client-id=SDRDosango3487LBAC server=dhcp-wlan3
add address=10.64.94.71 mac-address=AC:8B:A9:C2:00:D5 client-id=SDRDosango2aLBAC server=dhcp-wlan3
#
:delay 1
#
# Routed device
#
# Outras ligações por cabo
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=Lan] do={/routing ospf interface remove $i;}
add interface=Lan
/ routing ospf network
:foreach i in [/routing ospf network find network=10.64.94.0/28] do={/routing ospf network remove $i;}
add network=10.64.94.0/28 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=QRSPedroveyaAPSO] do={/routing bgp peer remove $i;}
add name="QRSPedroveyaAPSO" instance=default remote-address=10.64.94.6 remote-as=114267 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=Lan] do={/routing ospf interface remove $i;}
add interface=Lan
/ routing ospf network
:foreach i in [/routing ospf network find network=10.64.94.0/28] do={/routing ospf network remove $i;}
add network=10.64.94.0/28 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=QRSPedroveyaAPNO] do={/routing bgp peer remove $i;}
add name="QRSPedroveyaAPNO" instance=default remote-address=10.64.94.7 remote-as=114268 \
multihop=no route-reflect=no ttl=default in-filter=ebgp-in out-filter=ebgp-out disabled=no
/ routing ospf interface
:foreach i in [/routing ospf interface find interface=Lan] do={/routing ospf interface remove $i;}
add interface=Lan
/ routing ospf network
:foreach i in [/routing ospf network find network=10.64.94.0/28] do={/routing ospf network remove $i;}
add network=10.64.94.0/28 area=backbone disabled=yes
/ routing bgp peer
:foreach i in [find name=QRSPedroveyaLinares] do={/routing bgp peer remove $i;}
add name="QRSPedroveyaLinares" instance=default remote-address=10.64.94.2 remote-as=114266 \
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.64.94.1/28"] do={/ip address remove $i;}
:delay 1
/ ip address add address=10.64.94.1/28 network=10.64.94.0 broadcast=10.64.94.15 interface=Lan disabled=no comment="QRSPedroveyaAPSO,QRSPedroveyaAPNO,QRSPedroveyaLinares"
:foreach i in [/ip address find address="10.64.94.17/28"] do={/ip address remove $i;}
:delay 1
/ ip address add address=10.64.94.17/28 network=10.64.94.16 broadcast=10.64.94.31 interface=Local disabled=no comment="QRSPedroveyaAPSO,QRSPedroveyaAPNO,QRSPedroveyaLinares"
:foreach i in [/ip address find address="10.64.94.0/24"] do={/ip address remove $i;}
:delay 1
/ ip address add address=10.64.94.0/24 network=10.64.94.0 broadcast=10.64.94.255 interface=Reserva disabled=no comment="QRSPedroveyaAPSO,QRSPedroveyaAPNO,QRSPedroveyaLinares"
#
# Endereços internos 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.64.94.1 comment="" disabled=no
#
# BGP Routing
# Filtros BGP & 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;}
: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.64.94.1" 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.64.94.1"
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=114265 router-id=10.64.94.1 \
redistribute-connected=no redistribute-static=no redistribute-rip=no \
redistribute-ospf=yes redistribute-other-bgp=yes out-filter=ebgp-out \
client-to-client-reflection=yes comment="" disabled=no
#
# OSPF Routing
/routing ospf instance set default name=default router-id=10.64.94.1 comment="" disabled=no distribute-default=never \
redistribute-bgp=as-type-1 redistribute-connected=no redistribute-other-ospf=no redistribute-rip=no redistribute-static=no in-filter=ospf-in out-filter=ospf-out
#
:log info "Unsolclic for 114265-QRSPedroveya-RB executed."
/