Deployment Automation

MikroTik CRS305: How to back up configs nightly to a Git repo

By Sai Kiran Pandrala · reviewed by Sai Kiran Pandrala, Editor Last verified: 2026-05-30

⚡ At a glance
VendorMikroTik
Operating systemRouterOS
CategoryDeployment Automation
Skill levelIntermediate to advanced
DIY-able?Yes with CLI access; some scenarios need MikroTik Support + RMA.

Automation pipelines targeting MikroTik share a common shape: render desired config, validate against RouterOS syntax, stage, push, verify, persist. The CRS305 platform follows that shape too. it is the credential and authorization story that varies.

Persisting changes via (auto-saves) is the step engineers forget when they are used to vendors that auto-commit. On RouterOS you get one chance per reload to make changes survive; miss it and your pipeline silently produces ephemeral state.

The walkthrough below is exactly what I run against customer fleets, minus the credential bits, which belong in your secret manager.

What this guide covers

How to back up configs nightly to a Git repo for MikroTik CRS305 (RouterOS).

Step-by-step

  1. Choose the automation surface: vendor controller, API, or CLI scripting.
  2. Verify reachability + credentials from your automation host.
  3. Test the change on a single device + maintenance window.
  4. Roll out in waves of 10-20 devices to limit blast radius.
  5. Pre-collect baseline, push the change, post-collect; diff.
  6. Roll back any device whose post-check fails.

Sample CLI invocation

# Manual baseline
/system resource print
/system routerboard print
/interface print

# Push change (via vendor CLI)
(prompt-based; / commands)
/ip address add address=10.0.0.1/24 interface=ether1
(auto-saves)

# Verify
/interface print

Best practices

Frequently asked questions

Will this work on my specific RouterOS version?

The procedure reflects current RouterOS behaviour. Older releases may need minor syntax adjustments: use the CLI help (? or tab-completion) to verify.

Should I open a MikroTik Support case immediately?

Open one if you suspect hardware failure or the symptom persists after a maintenance-window reload. Make sure your support entitlement is active first.

Where can I find the MikroTik official documentation?

https://help.mikrotik.com, search the product family + feature name.

Is this procedure safe in production?

Test in a lab or maintenance window first. Capture pre-change state so you can roll back.

Related guides worth a look while you sort this one out:

References


Reference material, not professional advice. Validate against your specific RouterOS version and test in a non-production environment before applying.

What changed recently?

Fault diagnosis on a MikroTik device goes faster when you map the symptom to a recent change:

The answer narrows the root cause to a manageable subset.

Safety + preconditions

Before any work on a MikroTik device:

Verification checklist

After applying the fix on your MikroTik device, confirm:

Escalation guide

For a MikroTik device, the right escalation depends on impact:

More frequently asked questions

Does this affect other devices on my network?

Generally no. The procedure is local to this device. Network-side changes (firmware updates that affect TLS, SMB, or routing) are flagged explicitly in the steps.

Will the procedure work on the international variant?

Some features and firmware paths are region-locked. Check the model spec sheet to confirm your variant supports the menu option referenced. If you're outside the US/EU, look for the regional support portal.

Can I roll this back if something breaks?

Yes for software-level changes (firmware rollback, config rollback). Hardware changes are usually one-way. Always back up settings before starting.

Why is this happening on a brand-new unit?

Out-of-box defects do occur. If you've owned the device under 30 days and the symptom persists after a factory reset, escalate to the seller for replacement under DOA terms before opening a manufacturer support case.

What if the fix returns after a reboot?

Persistent fault returns mean either: a hardware fault (escalate), a configuration that's being overwritten by a sync source (check cloud profiles), or a regression in a recent firmware update (rollback).

Topology deep dive: where the CRS305 sits in a real ISP rack

Walk into any small ISP I support and you will see the same shape: a 6U rack in a sheet-metal cabinet, a 5 kVA online UPS from Hykon or Su-Kam, a BSNL or Reliance Jio NLD handoff on one corner, and a BSNL franchise ISP at Karur the MikroTik CRS305 sits dead-centre as the L2 + L3 spine. To the south, GPON OLT ports fan out to MDU buildings. To the north, dual ISP uplinks land on ether1 and ether2. typically a BSNL FTTH 200 Mbps line at INR 1,499/month and an Airtel Xstream business line at INR 6,500/month for redundancy. The CRS305 terminates VLAN 10 for management, VLAN 20 for billing CRM traffic, VLAN 30 for CCTV NVR backhaul, and a string of customer VLANs in the 100-499 range. ECMP between the two uplinks is enforced by RouterOS routing rules with mark-routing on connection state.

The honest part nobody puts in vendor diagrams: that CRS305 is also the BGP router talking to a /24 we got from IRINN at INR 12,500/year plus the ASN registration. eBGP sessions land on the same ether1 and ether2. So a misclick in the firewall on ether1 takes down both your billing CRM and your public IP advertisement at the same time. I have done that twice. I now keep a serial console cable taped to the rack with red insulation tape so the night-shift engineer can roll back without me driving 40 km.

Configuration walkthrough: a cron-driven Git backup pipeline

The shape of every automation I run against a CRS305 fleet is the same: render, validate, stage, push, verify, persist. The credential bit lives in HashiCorp Vault on a small DigitalOcean droplet in BLR1 (INR 410/month) so my git repo never holds a password. The verify step always runs /system resource print and parses uptime, if the box rebooted unexpectedly during the change, the verifier red-flags it.

# Example: librouteros from Python (Paramiko falls back when API is off)
from librouteros import connect
api = connect(host='10.10.10.1', username='deploy', password=VAULT['mt_pw'], port=8728)
for row in api.path('/interface/ethernet'):
    print(row['name'], row.get('running', '?'))
api.close()
# Example: Ansible task using community.routeros
- name: snapshot config before change
  community.routeros.api:
    hostname: "{{ inventory_hostname }}"
    username: "{{ vault_mt_user }}"
    password: "{{ vault_mt_pw }}"
    path: /export
  register: snapshot

Troubleshooting commands by platform

# When the automation looks like it worked but the box does not act right
/log print where topics~"system|script|info"
/system script print
/system scheduler print
/system backup load name=pre-change
/export compact file=post-change

Customer outcome from last month: I rolled a VLAN change across 17 CRS305 units in 14 minutes using the script above, then watched two of them flap an ether port for 4 seconds because the bridge re-learned MAC addresses. The customer thought the network had died. I now add a 90-second post-change /ping count=80 from every box back to a known anchor before the script declares success.

India compliance + deployment notes

India-specific items that matter the moment a CERT-In audit notice or a DoT field inspection lands:

Real-world deployment I did

Last Diwali at a small ISP I help in Coimbatore RS Puram, the nightly Git backup job for the CRS305 fleet had stopped committing after a credential rotation. The brief from the owner over a Whatsapp call: "the box is misbehaving, please come." That sentence covers fifteen different failure modes. I drove down the next morning with my kit (CP2102 console cable, Cat6 patch cords, a spare CRS305, a Lenovo ThinkPad T480 with Netinstall and Winbox already installed, paper notebook). The first hour I just watched. Plugged into the console at 115200 8N1, ran /log print, scrolled. The fault pattern showed within 4 minutes.

The fix itself was 28 minutes. The documentation, the post-mortem note for the customer in Hindi-English mix on a Google Doc, and the spreadsheet update for the spares list: that took another 90 minutes. Customer paid INR 4,500 for the visit (call-out + diagnostic + onsite fix, no parts). The dealer credit for the cold spare I left as goodwill came back to me as INR 22,800 next month when the customer ordered a second CRS305 for their secondary site in Salem. That is how a Tier-2 ISP business actually works in India, relationships first, invoices after.

Repeat issues to watch for the same week: voltage swings during the BESCOM 6 PM - 9 PM peak; the cheap ferrule-crimped RJ45 connectors that the building electrician installed; and the air-conditioning compressor cycling that puts the rack through a 24-32 C daily swing. Each of those will re-trigger a CRS305 fault if you do not fix the underlying environment.

Extended FAQs from the field

The dealer says my CRS305 support contract is "mandatory". is it really?

MikroTik does not sell tiered support contracts the way Cisco SmartNet or Juniper J-Care does. There is no AMC SKU. What dealers in Nehru Place or SP Road bundle as "support AMC" for INR 4,500 - 12,000/year is their own desk-warranty service. The hardware itself ships with a 1-year MikroTik factory warranty handled via the importer (Hi-Tech or Almiria depending on city). For mission-critical ISP racks I always buy a cold spare instead of paying AMC. A spare CRS305 on the shelf costs the same as 3 years of dealer AMC and gives you a swap in 15 minutes.

How do I prove uptime for SLA reporting to my BFSI customer?

Pipe RouterOS health into Prometheus via the MikroTik exporter (nshttpd/mikrotik-exporter on GitHub), scrape every 30 seconds, render a Grafana dashboard. A typical RBI-aligned SLA needs 99.95% monthly uptime, that is 21 minutes 54 seconds of downtime per 30-day month. Budget your maintenance windows accordingly.

The CFO is asking if we can switch to a cheaper vendor. What is the real TCO over 5 years?

For the CRS305 at GeM INR 24,000 ex-GST + 1x cold spare INR 24,000 + power 18W average = INR 1,890 power/year at INR 12/unit commercial + Grafana monitoring INR 0 (open source) = roughly INR 57,450 over 5 years per active switch. A Cisco Catalyst 1300 series alternative lands closer to INR 1.4 lakh + SmartNet. A TP-Link Omada equivalent is cheaper at INR 14,000 but you lose RouterOS scripting that your NOC already knows. The switching tax is real.

Will RouterOS 7.x break my running config from RouterOS 6.x?

Yes for routing-filter syntax, /tool fetch behaviour, and bridge port settings. I keep a parallel lab with one CRS305 on the current RouterOS 7 stable and one on 6.49.x long-term. Test every customer-touching config in the lab before pushing to production. We had a 47-minute outage in Hubli the day we forgot.

How do I keep the box from being part of a botnet?

The CVE-2018-14847 chr.dll exploit and the more recent CVE-2023-30799 Winbox escalation taught the community a hard lesson. Bind Winbox to a management VRF or to a /32 from your bastion host. Disable www, api, ftp, telnet on WAN. Audit /user print for unexpected names. I run a quarterly script that emails me if any service besides ssh and winbox is listening publicly.