Community discussions

MikroTik App
 
ejmerkel
newbie
Topic Author
Posts: 33
Joined: Wed Jun 03, 2009 8:26 pm

Programming Generic Default Configs

Fri May 21, 2010 4:35 pm

We are planning on using some RB/411's as a wireless customer premise equipment. Basically we will have some people assembling the units into a Rootenna that are not MT saavy.

That being said what is the best way load a default configuration on the unit that sets up IP addresses, DHCP, NAT, DNS, and a generic wireless config without user intervention?

For simplicity I've been having our assemblers just copy up a backup config and then do a restore and I was curious if there was a good way to script or automate this?

Thanks for pointing me in the right direction!

Eric
 
changeip
Forum Guru
Forum Guru
Posts: 3833
Joined: Fri May 28, 2004 5:22 pm

Re: Programming Generic Default Configs

Fri May 21, 2010 5:35 pm

You can place a default script to be run when the routerboard is reset to factory. Use netinstall to place this script onto the router. This script cannot be very long, but should get the job done for what you need. I really like to take either pieces from the MAC address or system ID and place them into dhcp client hostnames, system identity name, etc so you can identify them from headquarters once deployed.
 
ejmerkel
newbie
Topic Author
Posts: 33
Joined: Wed Jun 03, 2009 8:26 pm

Re: Programming Generic Default Configs

Fri May 21, 2010 8:46 pm

Do you have to reload the entire unit via netinstall to do this? I was thinking more of just scripting the upload of a configuration or backup.
 
changeip
Forum Guru
Forum Guru
Posts: 3833
Joined: Fri May 28, 2004 5:22 pm

Re: Programming Generic Default Configs

Sat May 22, 2010 12:56 am

You can do this as well, just make the script a .rsc.auto and upload it. It will auto execute when finished uploading. (double check the file extension, I am going from memory.)
 
User avatar
roc-noc.com
Forum Veteran
Forum Veteran
Posts: 874
Joined: Sun Dec 02, 2007 3:27 am
Location: Rockford, IL USA
Contact:

Re: Programming Generic Default Configs

Sat May 22, 2010 4:43 am

You can do this as well, just make the script a .rsc.auto and upload it. It will auto execute when finished uploading. (double check the file extension, I am going from memory.)
from an early 3.0 beta changelog reference:

automatically execute uploaded scripts that have name *.auto.rsc

Tom
 
charliebrown
Member Candidate
Member Candidate
Posts: 130
Joined: Wed Dec 17, 2008 3:27 am

Re: Programming Generic Default Configs

Wed Jun 23, 2010 4:17 am

Thought I'd post in here rather than start a new topic since this is close to what we want to do. Is there anyway to upload a script to a router and have it reset the config back to defaults and load that file? This would be extremely handy for our remote sites that may need clean config from time to time
 
ejmerkel
newbie
Topic Author
Posts: 33
Joined: Wed Jun 03, 2009 8:26 pm

Re: Programming Generic Default Configs

Wed Jun 23, 2010 2:17 pm

The way I have scripted uploading a default config is to use a couple of programs that come with putty. PSCP allows you to copy up backups or ROS images etc to the MT device. Then I use PLINK which allows you to login and run commands either individually or give PLINK a text file with MT commands. My batch file does the following:

1) Copy up latest ROS with PSCP
2) Copy a backup file with my base IP/pasword config to the router with PSCP
3) Restore backup and reboot base config via PLINK
4) After router comes back up, run all setup commands from a text file via PLINK
5) Upgrade routerboard firmware
6) Install :)

Here are a couple examples of using PSCP and PLINK.

Copy up ROS to a unit that has a default IP and no password.
pscp.exe admin@192.168.88.1 -scp routeros-mipsbe-4.10.npk admin@192.168.88.1

Run a single command on unit with password
plink.exe -pw YourPassword admin@192.168.88.1 "/system routerboard upgrade"

Run setup commands on unit from a text file called setup-commands.txt
plink.exe -pw YourPassword -m setup-commands.txt admin@192.168.88.1

Hope this helps.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Programming Generic Default Configs

Thu Jun 24, 2010 1:45 am

you may use NetInstall with some config provided. then that config will be used on reset-configuration, afair
 
charliebrown
Member Candidate
Member Candidate
Posts: 130
Joined: Wed Dec 17, 2008 3:27 am

Re: Programming Generic Default Configs

Thu Jun 24, 2010 2:16 am

Hmm seems I cant do it then,

The trouble is these sites are remote with wireless access only, as soon as i reset the config the wireless will default back to disabled.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Programming Generic Default Configs

Thu Jun 24, 2010 2:18 am

then use
/system reset-configuration run-after-reset=bla-bla-bla
just don't forget to test it locally =)
 
charliebrown
Member Candidate
Member Candidate
Posts: 130
Joined: Wed Dec 17, 2008 3:27 am

Re: Programming Generic Default Configs

Thu Jun 24, 2010 6:26 am

Just the command i've been looking for!! :D

Thanks!