I have the following dilemma I have two configurations we use for our CPE devices.
- Router (w/ PPPoE interface)
- Bridge (WDS)
So I don’t have to train all my techs on the intricacies of RouterOS I’ve written two scripts to automatically configure the devices on the bench..
However sometimes they need to change these configurations in the field. Right now to allow easy reconfiguration I’ve loaded the bridge script, created backup called cpe-bridge, reset the settings to defaults, loaded the second script, and created a second backup called cpe-router.
Works great, but if I’m not mistaken if any of the MAC addresses change (ie they have to swap the WLAN card for whatever reason) then the backup wont restore successfully. The other issues is I have to do this process for every unit, as one backup script wont load correctly on a different routerboards (I’m assuming this is due to the varying MAC addresses).
Is there a way in the scripts I can have it wipe the current settings (/system reset-configuration) and upon reboot load the configuration script?
That way the tech would just type:
/import scriptname
And it would reset the current configs to default and load the selected configs. I have the scripts setup so they put in the settings by the default interface names (ie: ether1 and wlan1)
Here’s an example of the scripts:
Router:
/interface wireless set wlan1 mode=station
/ip address add address=192.168.100.1/24 interface=ether1
/ip firewall nat add chain=srcnat src-address=192.168.100.0/24 action=masquerade
/ip firewall connection tracking set enabled=yes
/ip dns set allow-remote-requests=yes
/ip pool add name=dhcp1 ranges=192.168.100.200-192.168.100.254
/ip dhcp-server network add address=192.168.100.0/24 gateway=192.168.100.1 dns-server=192.168.100.1
/ip dhcp-server add interface=ether1 lease-time=3d address-pool=dhcp1 authoritative=yes add-arp=yes name=dhcp1
/ip dhcp-server enable dhcp1
/interface pppoe-client add interface=wlan1 user=default password=changeme add-default-route=yes use-peer-dns=yes
/system ntp client set enabled=yes primary-ntp=aa.bb.cc.dd
/system clock set time-zone-name=America/Los_Angeles
/snmp set enabled=yes
/snmp community add name=xyz address=0.0.0.0/0 read-access=yes
/snmp community remove public
Bridge:
/interface bridge add protocol-mode=rstp
/interface bridge port add interface=wlan1 bridge=bridge1
/interface bridge port add interface=ether1 bridge=bridge1
/interface wireless set wlan1 mode=station-wds
/system ntp client set enabled=yes primary-ntp=10.0.1.1
/system clock set time-zone-name=America/Los_Angeles
/snmp set enabled=yes
/snmp community add name=z3t@ address=0.0.0.0/0 read-access=yes
/snmp community remove public
/ip address add interface=bridge1 address=10.100.1.1/24 comment="Change ME! And the route too!"
/ip route add dst-address=0.0.0.0/0 gateway=10.100.1.254 comment="Change ME! Don't forget the password"