Tag Archives: networking

Schedule auto backup and rsc files from a Mikrotik using FTP

Schedule below script after changing the first few lines

### Set local variables. Change the value between "" to reflect your environment. Do not delete quotation marks. 
:local ftpserver "ftpserver"
:local username "ftpuser"
:local password "ftppass"
:local ftppath "mikrotik/hapac2"

:local hostname [/system identity get name]
:local localfilename "$hostname-Backup-Daily";
:global thisdate [/system clock get date]
:global thistime [/system clock get time]
:global date ([:pick $thisdate 0 10])
:local remotebackup ([/system identity get name]."-".$date.".backup")
:local remotersc ([/system identity get name]."-".$date.".rsc")

### Create backup file and export the config.
export compact file="$localfilename"
/system backup save name="$localfilename"
:log info "Backup Created Successfully"

### Upload config file to FTP server.
/tool fetch address=$ftpserver src-path="$localfilename.backup" \
user=$username mode=ftp password=$password \
dst-path=($ftppath."/".$remotebackup) upload=yes
:log info "Config Uploaded Successfully"

### Upload backup file to FTP server.
/tool fetch address=$ftpserver src-path="$localfilename.rsc" \
user=$username mode=ftp password=$password \
dst-path=($ftppath."/".$remotersc) upload=yes
:log info "Backup Uploaded Successfully"

Files are written on the FTP server like this:

MikroTikHAP1-2024-03-14.backup
MikroTikHAP1-2024-03-14.rsc

Mikrotik fix corrupt update.

Mikrotik is in netboot mode only, not accessible using winbox/web or IP.
(This is one of my smaller AP’s)

Below the log from my DHCP server

Mar 12 23:30:43 shibari dhcpd[3559351]: BOOTREQUEST from c4:ad:34:aa:aa:39 via p1p1.10
Mar 12 23:30:43 shibari dhcpd[3559351]: BOOTREPLY on to c4:ad:34:aa:aa:39 via p1p1.10

Download netinstall (linux cli) from here:

https://mikrotik.com/download

Also the latest routeros, and in my case also wireless package for HAP2.
(There was a change in packaging, due to the limited size of the Hap2.)

Steps to take: Use a UTP cable to connect the hap to a pc or laptop.

config your ethernet to 192.168.88.2/24 and make sure you change the default gateway to 192.168.1.1 !
(Disable wifi)

Start below command

./netinstall -r -a 192.168.88.1 routeros-7.14.1-arm.npk

Disconnect/connect power and uploading should start.

Here is the text from my console

root@zspot:/home/henri/Downloads/mt# route add default gw 192.168.88.1
root@zspot:/home/henri/Downloads/mt# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.88.1    0.0.0.0         UG    0      0        0 enp0s31f6
192.168.88.0    0.0.0.0         255.255.255.0   U     0      0        0 enp0s31f6
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
root@zspot:/home/henri/Downloads/mt# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether e0:70:ea:53:b3:6e brd ff:ff:ff:ff:ff:ff
    inet 192.168.88.2/24 brd 192.168.88.255 scope global enp0s31f6
       valid_lft forever preferred_lft forever
3: wlp0s20f3: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether f4:4e:e3:91:27:24 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:b1:16:1a brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
root@zspot:/home/henri/Downloads/mt# ./netinstall -r -a 192.168.88.1 routeros-7.14.1-arm.npk 
Will reset config
Using server IP: 192.168.88.2
Starting PXE server
Waiting for RouterBOARD...
PXE client: C4:AD:34:AA:AA:39
Sending image: arm
Discovered RouterBOARD...
Formatting...
Sending package routeros-7.14.1-arm.npk ...
Ready for reboot...
Sent reboot command
See missing Wifi, upload Wifi package and reboot
Configure and enable your Wifi interfaces

Mikrotik day (dhcp and thedude)

Moving dhcp from isc-dhcp-server to Mikrotik.
And playing with theDude and speedtesting.

I got an old linux gateway which only runs a dhcp server.
Time to move this to a Mikrotik router.

The config on this isc-dhcp-server is huge!
So i was planning to migrate some one by one by hand.
Maybe writing a script to do this automatically later on.

I’ve got loads of static configured hosts, so I change these

  • Change static entry in dhcp to a deny booting entry
  • Add a static lease to the Mikrotik
  • Restart dhcp service

Example host

#                # kodiserver
#                host kodi.example.com {
#                fixed-address 10.11.12.13;
#                hardware ethernet ae:ae:ae:ae:ae:ea;
#                }

host movekodito4011 {
   hardware ethernet ae:ae:ae:ae:ae:ea;
   deny booting;
}

Mikrotik config (static single entry config)
See other post about dhcp config

/ip dhcp-server lease
add address=10.11.12.13 mac-address=EA:EA:EA:EA:EA:EA:EA

The Dude

The dude is a cool tool which connects to your MT and generates all kinds of cool info.
I was trying to get the frequency spectral scan working.
But it generates a nice network map also.

Easy to install under linux

  • Install wine
  • Download thedude from the MT website
  • start “wine dude_install.exe”
  • cd ” /home/$USER/.wine/drive_c/Program Files (x86)/Dude”
  • wine dude.exe

While moving a lot from my gateway to Mikrotik, I still have to come up with a plan to migrate my netboot.xyz PXE server to TFTP/ipxe using a migrated dhcpd server.
I probably end up using a separate dhcp instance which handles only the PXE requests.

Mikrotik and Zerotier

Today i’ve upgraded one of my Mikrotiks to 7.8.

And installed the zerotier extra package!
I’m not going to explain what zerotier is .. read it here:
https://www.zerotier.com/

I already did some tests using my phone and a linux server.

  1. Upgrade to the latest stable version (at this time : 7.8)
  2. Install from the extra packages zerotier-7.8.arm.npk
    upload to the files folder and reboot your MT

Add zerotier network

Allow connection in the Zerotier Gui

Mikrotik changes from ACCESS_DENIED to OK

Ping test from MT to my Phone !

Maybe we could setup a adhoc zerotier network with some of my friends to do some remote assisting when needed!

Android and devices in your neighbourhood

When i play around with Arduino’s which i have flashed and start with their own access points. It’s sometimes not clear which remote IP is connected.

Applications like Tasmota,Wled and Easyesp startup with their own Access Point, which you can use to connect to and configure them to your real accesspoint.
So you connect to this temporary AP, and want to remote access it with your phone’s browser. Not all apps (certainly not my apps) have a captive portal. Most won’t .. Which ip to use to connect?

Install JuiceSSH of you don’t have it .. it’s a must have really

Select quick connect – local device

Enter command “ip neigh”, It wil show devices connected to your android phone or which where broadcasting in your network-neighbourhood

Most of the times it also your default gw .. which can be found in settings. But above gives you more information.

Phpipam – Added Switch port Custom Field

Added custom fields to Phpipam, so i can remove my port sheet and administer everything in Phpipam. And to prepare for a Augmented reality project i want to create.

Howto add fields:
Go to the administrator menu on the right.
Select IP related management > Custom fields
Custom IP addresses fields press the plus sign
Give it a name and description.
I’m using varchar(10) at the moment
so i can enter switchname:port (media:4)

See below for a example: Using a QR code and the information, i want to display port information using a app.

Example Augmented switch ports