I need help to setup a script that will reset a customers CPE and then run a edited custom script with SSID of AP + NV2,etc setting to reassociate with AP.
Hi!
Create your configuration script:
/int wirel set wlanX ssid=blabla
/system iden set blablabla and upload it to /files like “conf.rsc”
Then: /system reset-configuration run-after-reset blablabla
Configuration Reset
Command name: /system reset-configuration
Description
The command clears all configuration of the router and sets it to the default including the login name and password (‘admin’ and no password), IP addresses and other configuration is erased, interfaces will become disabled. After the reset command router will reboot.
Command Description
keep-users: keeps router users and passwords
no-defaults: doesn’t load any default cofigurations, just clears everything
skip-backup: automatic backup is not created before reset, when yes is specified
run-after-reset: specify export file name to run after reset
We use a pre-configured .rsc file to load our full config to new CPE’s (i.e default or no configuration). As we run on static IP’s, we use a text editor like notepad to “find and replace” the IP addresses/client side DHCP server info, so we can config 10-15 units in an hour. We have failover scripts, upgrade schedules and netwatches on the CPE’s, so the script is quite long.
The first few lines of the script (with instructions for the new techies):
#######################################################################################################
# 1. Edit the file below.
# 2. Replace all instances of 230.60 with 230.x , x being the new IP allocated for this unit. Use the Edit>>Replace Function (Ctrl H)
# 3. Replace all instances of 253.60 with 253.x
# 4. Replace all instances of 168.60 with 168.x
# 5. Crtl S to save this editted file.
# 6. Find Wireless Unit using Neighbourhood Viewer
# 7. Mac-Telnet into Unit with user admin and no password
# 8. Accept default config by hitting enter and wait for prompt >
# 9. Type: /ip address add and enter.......At prompt address: 192.168.0.55/24 enter interface: ether1 enter
# 10. Login to Unit via Winbox (now on IP address 192.168.0.55) with user admin and no password
# 11. Open the file tab on left menu.
# 12. Upload this correctly editted file to the file screen by "dragging" from desktop and dropping in file window on router
# 13. Drag contents of folder from Desktop Folder .npk to file window.
# 14. /system reboot y Reboot takes about 3-5 minutes.......
# 14. Open a terminal window in Winbox and type: import setup50.rsc
# 15. If loaded succesfully, /system reboot y Reboot takes about 1 minute.......
###########################################################################################################
#
# Replace the name=xxxxxxxxx below with the client surname or business name
###########################################################################################################
/system identity
set name=Smurfette
#
#DO NOT CHANGE ANYTHING BELOW THIS LINE - ALL CHANGES HAVE BEEN MADE BY USING CTRL H REPLACE COMMANDS
###########################################################################################################
/interface ethernet
set 0 name="ether1"
/interface wireless
set 0 name="wlan1"
/ip address
add address=10.254.230.60/32 disabled=yes interface=wlan1 network=10.254.230.254
add address=192.168.60.1/24 interface=ether1
add address=10.254.253.60/32 interface=wlan1 network=10.254.253.254
/interface wireless security-profiles
add authentication-types=wpa-psk group-ciphers=tkip mode=dynamic-keys name=es supplicant-identity=MikroTik unicast-ciphers=tkip wpa-pre-shared-key=startrekraider
/interface wireless
set 0 adaptive-noise-immunity=client-mode band=2ghz-b/g basic-rates-a/g=6Mbps,9Mbps basic-rates-b=1Mbps,2Mbps disabled=no disconnect-timeout=7s frequency=2412 \
hw-retries=4 l2mtu=2290 nv2-preshared-key=startrekraider nv2-security=enabled on-fail-retry-time=500ms rate-selection=legacy security-profile=es ssid=\
"ES1" supported-rates-a/g=6Mbps,9Mbps supported-rates-b=1Mbps,2Mbps,5.5Mbps wireless-protocol=nv2-nstreme-802.11
/system clock
set time-zone-name=Africa/Harare
/system logging action
set 0 memory-lines=100 memory-stop-on-full=no name=memory target=memory
set 1 disk-file-count=3 disk-file-name=log disk-lines-per-file=300 \
disk-stop-on-full=no name=disk target=disk
set 2 name=echo remember=yes target=echo
set 3 bsd-syslog=no name=remote remote-port=514 src-address=0.0.0.0 \
syslog-facility=daemon syslog-severity=auto target=remote
/system logging
set 0 action=disk disabled=no prefix="" topics=info
set 1 action=disk disabled=no prefix="" topics=error
set 2 action=disk disabled=no prefix="" topics=warning
set 3 action=disk disabled=no prefix="" topics=critical
/system ntp client
set enabled=yes mode=unicast primary-ntp=10.254.253.254 secondary-ntp=10.2.0.1
And so for another few hundred lines........
I think this might give you and idea of what/how you can accomplish what you are trying to do.
Regards
Brian
Zimbabwe
Many thanks for the replies, now and this applies only to my network and not CPE’s where after I have setup PTP’s + Ap’s etc, run export command and have a *.rsc in files, then i can reset and run /system reset-configuration run-after-reset *.rsc
Also I have a weekly script scheduled to delete another *.rsc file, then run /export which will have any new setting done (very handy for AP’s where extra CPE’s+PPPoe+ simple queues, etc are added) on the *.rsc + email
I also found to my horror that it is very important to test and check what a script will do and what would happen in different scenario’s, for example i setup netwatch to run every 10mins and ping http://www.google.com and no reply to reboot but i hadn’t considered what would happen when the router was also scheduled to reboot weekly, WOW i had a reboot loop, router starts but because of OSPF routes take time to establish and netwatch was also running at bootup, it rebooted as no ping to google, even tried setting up a static dns entry for google but no luck, most annoying when AP’s have to brought down to be reset ?
Just added
:delay5m
at the start of script solved this.
http://forum.mikrotik.com/t/router-in-reboot-loop/61770/1
My bad. I thought you were requiring assistance with CPE reset and config.
Regards
Brian
Zimbabwe