Community discussions

MikroTik App
 
mvcorrea
just joined
Topic Author
Posts: 13
Joined: Tue Aug 08, 2017 2:25 am

restore with basic template

Tue Nov 05, 2019 9:25 pm

Hi there,
I would like to apply a basic template when reseting the board:
System > Reset Configuration > (no default configuration/no backup) and a simple *rsc file in "run after reset".
or via [/system reset-configuration skip-backup=yes no-defaults=yes run-after-reset=file.rsc]
I am not able to make it work. In my case I took out all wifi configuration and only allowed the eth* interfaces to make it simpler.
I am not able to get ip's on eth2-5 interfaces, nothing seems to work
A little help please :)
/interface bridge
add admin-mac=64:D1:54:52:5F:EF auto-mac=no name=bridge-net10
/interface pppoe-client
add add-default-route=yes disabled=no interface=ether1 name=pppoe-out1 \
    password=XXX service-name=vivo use-peer-dns=yes user=turbonet@turbonet
/interface list
add name=WAN
add name=LAN
add name=DMZ
/ip pool
add name=pool-net10 ranges=10.10.10.100-10.10.10.254
/ip dhcp-server
add address-pool=pool-net10 disabled=no interface=bridge-net10 name=dhcp-net10
/interface bridge port
add bridge=bridge-net10 interface=ether2
add bridge=bridge-net10 interface=ether3
add bridge=bridge-net10 interface=ether4
add bridge=bridge-net10 interface=ether5
/interface list member
add interface=bridge-net10 list=LAN
add interface=ether1 list=WAN
add interface=pppoe-out1 list=WAN
/ip address
add address=10.10.10.1/24 interface=bridge-net10 network=10.10.10.0
/ip dhcp-client
add dhcp-options=hostname,clientid disabled=no interface=ether1
/ip dhcp-server network
add address=10.10.10.0/24 dns-server=8.8.8.8,8.8.4.4 domain=local.lan \
    gateway=10.10.10.1
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip firewall filter
add chain=input action=accept connection-state=established,related,untracked
add chain=input action=drop connection-state=invalid
add chain=input action=accept protocol=icmp
add chain=input action=drop in-interface-list=!LAN
add chain=forward action=fasttrack-connection connection-state=established,related
add chain=forward action=accept connection-state=established,related,untracked
add chain=forward action=drop connection-state=invalid
add chain=forward action=drop connection-nat-state=!dstnat connection-state=new in-interface-list=WAN
/ip firewall nat
add chain=srcnat action=masquerade ipsec-policy=out,none out-interface-list=WAN
/system clock
set time-zone-name=America/Fortaleza
/system ntp client
set enabled=yes primary-ntp=188.165.236.162 secondary-ntp=200.160.7.193
/system ntp server
set enabled=yes multicast=yes
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 13135
Joined: Thu Mar 03, 2016 10:23 pm

Re: restore with basic template  [SOLVED]

Tue Nov 05, 2019 9:36 pm

The most probable cause is that interfaces don't get initialized soon enough for the script to configure them. Default config script on my RBD52G running ROS 6.45..7 has this code right on top:

                     # wait for interfaces
                      :local count 0;
                      :while ([/interface ethernet find] = "") do={
                        :if ($count = 30) do={
                          :log warning "DefConf: Unable to find ethernet interfaces";
                          /quit;
                        }
                        :delay 1s; :set count ($count +1);
                      };
                      :local count 0;
                      :while ([/interface wireless print count-only] < 1) do={
                        :set count ($count +1);
                        :if ($count = 40) do={
                          :log warning "DefConf: Unable to find wireless interface(s)";
                          /ip address add address=192.168.88.1/24 interface=ether1 comment="defconf";
                          /quit
                        }
                        :delay 1s;
                      };
 
mvcorrea
just joined
Topic Author
Posts: 13
Joined: Tue Aug 08, 2017 2:25 am

Re: restore with basic template

Tue Nov 05, 2019 9:46 pm

cool, thanks for your help,
quickly searching the internet a site asks to put ":delay 15s" on the beginning of the rsc file
do you think it can help?
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 13135
Joined: Thu Mar 03, 2016 10:23 pm

Re: restore with basic template

Tue Nov 05, 2019 10:03 pm

The original code I posted above adds delay of up to 30 seconds ... less if interfaces become available earlier. I'd say that static delay of 15 seconds does the trick most of times