# Gerado para:
# RouterOSv6.x
:log info "Unsolclic for 118999-rmtdSntSxt4Rd2 going to be executed."
#
# Configuration for RouterOSv6.x
# Device: 118999-rmtdSntSxt4Rd2
#
# 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=rmtdSntSxt4Rd2
#
# DNS (client & server cache) zone: 2472
/ip dns set servers=10.138.160.98,10.138.0.2 allow-remote-requests=yes
:delay 1
#
# NTP (client & server cache) zone: 2472
/system ntp client set enabled=yes mode=unicast primary-ntp=10.138.160.98 secondary-ntp=10.138.0.2
: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="rmtdSntSxt4" 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 VicrmtdSntSxt4Rd2CPE0
/interface wireless set wlan1 name="wlan1" \
radio-name="VicrmtdSntSxt4Rd2CPE0" mode=station ssid="guifi.net-VicGenAP1" \
band="" \
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: Wan
/ip address
:foreach i in [find interface=wlan1] do={remove $i}
:foreach i in [find address="10.138.5.20/27"] do={remove $i}
/ ip address add address=10.138.5.20/27 network=10.138.5.0 broadcast=10.138.5.31 interface=wlan1 disabled=no
/ routing bgp network
:foreach i in [/routing bgp network find network=10.138.5.0/27] do={/routing bgp network remove $i;}
add network=10.138.5.0/27 synchronize=no 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.5.0/27] do={/routing ospf network remove $i;}
add network=10.138.5.0/27 area=backbone disabled=yes
:delay 1
#
:delay 1
#
# Device has firewall (setting up as CPE)
/ip route add gateway=10.138.5.1
:foreach i in [find address="192.168.1.1/24"] do={remove $i}
/ip address add address=192.168.1.1/24 network=192.168.1.0 broadcast=192.168.1.255 interface=ether1 comment="" disabled=no
:delay 1
/ip pool
:foreach i in [find name=private] do={remove $i}
add name="private" ranges=192.168.1.100-192.168.1.200
:delay 1
/ip dhcp-server
:foreach i in [find name=private] do={remove $i}
add name="private" interface=ether1 lease-time=3d address-pool=private bootp-support=static authoritative=after-2sec-delay disabled=no
:delay 1
/ip dhcp-server network
:foreach i in [find] do={remove $i}
add address=192.168.1.0/24 gateway=192.168.1.1 netmask=24 dns-server=10.138.160.98,10.138.0.2 domain="guifi.net" comment=""
:delay 1
/ip dhcp-client
:foreach i in [find] do={remove $i}
:delay 1
/ip firewall nat
:foreach i in [find] do={remove $i}
:delay 1
add chain=srcnat out-interface=wlan1 action=masquerade comment="" disabled=no
/ip firewall filter
:foreach i in [find] do={remove $i}
add chain=input connection-state=established action=accept comment="Allow Established connections" disabled=no
add chain=input protocol=udp action=accept comment="Allow UDP" disabled=no
add chain=input src-address="192.168.1.0/24" action=accept comment="Allow access to router from known network" disabled=no
add chain=input protocol=tcp dst-port=22 action=accept comment="Allow remote ssh" disabled=no
add chain=input protocol=udp dst-port=161 action=accept comment="Allow snmp" disabled=no
add chain=input protocol=tcp dst-port=8291 action=accept comment="Allow remote winbox" disabled=no
add chain=input protocol=icmp action=accept comment="Allow ping" disabled=no
add chain=forward connection-state=established action=accept comment="Allow already established connections" disabled=no
add chain=forward connection-state=related action=accept comment="Allow related connections" disabled=no
add chain=forward src-address="192.168.1.0/24" action=accept comment="Allow access to router from known network" disabled=no
add chain=input protocol=tcp connection-state=invalid action=drop comment="" disabled=no
add chain=forward protocol=tcp connection-state=invalid action=drop comment="Drop invalid connections" disabled=no
add chain=forward action=drop comment="Drop anything else" disabled=no
add chain=input action=drop comment="Drop anything else" disabled=no
:delay 1
#
:log info "Unsolclic for 118999-rmtdSntSxt4Rd2 executed."
/