Tag Archives: network

Mikrotik todo

My work document for my Mikrotiks
(Also for my friend Vincent, with a similar setup.)

I’m going to collect information on this page for below changes.

WIFI

  • Access list connections only
  • Default forward – only certain clients
  • Guest network – better setup.
    I’ve got a folkband guest network right now and
    a captive portal AP on my internet router. (Outside my network)
    This is for colleagues of Coline.
  • Vlan for certain clients

Zerotier

  • Network routing
  • Security

IOT

Move all clients to own vlan
New or better VLAN setup

  • Redo Guest network
  • IOT Vlan
  • Manage Vlan better setup
  • Lab – a redo because of changes in DMZ

Info

YT : https://www.youtube.com/watch?v=Hqu8JlieSq4

Glade and python – network tester

THIS IS A WORK IN PROGRESS ! .. Updates follow

UPDATE: Found a glade project from 2002
https://www.henriaanstoot.nl/2002/02/20/reverse-engineering-a-alpha-ticker-led-scoller/

The goal of this project is to have a raspberry-pi with a screen wich shows network information.
It wil be using a battery, touchscreen .. maybe some status leds.
When debugging network issues we want to have information when/if/how a network port works on our switches.

It should show:

  • dhcp ip
  • gateway
  • can access internet?
  • speedtest
  • detect if vlan tagged network packets are present on the port?
  • icmp test
  • list of detected nearby hosts?

A long time ago i played with glade and C / Perl.

But i’d rather use python so i’m looking into glade/python combi for this little project.

Glade is a gnome/GTK user interface RAD tool. (Rapid Application Development)

i’ve used zenity and yad before to create simple gui’s for bash scripts, these where only for quick and dirty solutions. (See other posts)
Glade is a far better solution, but a little harder to use.

Below is a little framework i started with

Python script

import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

class Handler:
    def onDestroy(self, *args):
        Gtk.main_quit()

    def on_firstbutton_clicked(self, button):
        print("Ping test")

builder = Gtk.Builder()
builder.add_from_file("mytest.glade")
builder.connect_signals(Handler())

window = builder.get_object("Main")
window.show_all()

Gtk.main()

Glade file

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkWindow" id="Main">
    <property name="can-focus">False</property>
    <property name="title" translatable="yes">Networktool</property>
    <property name="default-width">440</property>
    <property name="default-height">250</property>
    <property name="icon-name">network-wired</property>
    <child>
      <object class="GtkFixed" id="fixed1">
        <property name="visible">True</property>
        <property name="can-focus">False</property>
        <child>
          <object class="GtkButton" id="firstbutton">
            <property name="label" translatable="yes">Ping test</property>
            <property name="width-request">100</property>
            <property name="height-request">16</property>
            <property name="visible">True</property>
            <property name="can-focus">True</property>
            <property name="receives-default">True</property>
            <signal name="clicked" handler="on_firstbutton_clicked" swapped="no"/>
          </object>
          <packing>
            <property name="x">56</property>
            <property name="y">40</property>
          </packing>
        </child>
        <child>
          <object class="GtkButton" id="speedtest">
            <property name="label" translatable="yes">Speed test</property>
            <property name="width-request">100</property>
            <property name="height-request">16</property>
            <property name="visible">True</property>
            <property name="can-focus">True</property>
            <property name="receives-default">True</property>
          </object>
          <packing>
            <property name="x">56</property>
            <property name="y">89</property>
          </packing>
        </child>
        <child>
          <object class="GtkTextView">
            <property name="width-request">179</property>
            <property name="height-request">166</property>
            <property name="visible">True</property>
            <property name="can-focus">True</property>
          </object>
          <packing>
            <property name="x">222</property>
            <property name="y">36</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>

Which is generated using the Glade designer

When running you get below screen

Old glade program (2003)

DrawIO

I used to draw my network using inkscape, or graphviz. But the last years i’ve been using DrawIO. A friend is drawing his. So i posted some tips.

When using inkscape, i liked the way that i could view more or less details using layers. But editing was hard.

Getting DrawIO:

There is a online version: https://app.diagrams.net/
You can download a AppImage
And .. install it in your nextcloud, which is the way i’m using it.
(Login as admin, click Apps and search for draw.io)

Some tips on using images ..
Below is a example of a Mikrotik switch with connector points.

Use a search engine to look for images, the ones with front facing connectors are easier to use.
I always look for images which have a transparent background.
Using google you can use below ‘trick’
google > images > tools > color > transparent
Just copy-paste into your DrawIO document, it is better to have a large picture which you can resize as the other way around.

Adding connection points:

Left click the image in DrawIO, right mouse and Edit connection points

Now you can place/remove edit connection points.

Due to security reasons i won’t be posting my complete network image ..

Another tip:

Network sheet a friend is working on

Device is not straight, so its harder to get the connections right. Besides that, the lines are below the device. Click line and select bring to front.

Weird things at work

From a long time ago

(two examples)

There was a place i’ve worked, they did something weird with network masks.
The cause was probably because of changes in the network, and some things had to be re-routed.
When doing routing you use a network mask, this mask is used in tcp/ip routing. When an IP is not in a local network, which boundaries are set by the mask, the protocol will use the gateway to break out of the network.

Example time!

192.168.1.2 – computer IP
192.168.1.0 – network it sees as local
255.255.255.0 – network mask
192.168.1.1 – gateway of example

in binary

11000000.10101000.00000001.00000010 – computer IP
11000000.10101000.00000001.00000000 – network
11111111.11111111.11111111.00000000 – mask (should be al 1’s until the boundary of the network)

The 1’s in the mask should work as a filter!

What i’ve seen was something like a mask
11111111.1111111.00111111.00000000 !
This gave the network a gap into another network!

This is NOT encouraged, don’t do this.
Theoretical and seen in a real live environment .. it CAN work

Another weird one

I was asked to look into a problem at the Johan Cruyff Foundation.
Btw I ran into the guy, but I didn’t know who he was, they had to explain.
(I ‘m not into football)

Some PC’s sometimes could not connect to the network. Sometimes the printer didn’t work.
A colleague of mine looked into it and could not find it.

  • The order in which powered up the PC’s and printer seems to matter.
  • From the 7-8 devices only 6 worked.

So I drove to Amsterdam, turned on a pc, and looked at its network settings.
It was getting a IP, but it was a PUBLIC one!
Looking at another machine, it was also a public one!

The router was locked inside a cabinet, but I knew the famous dutch telecom provider had done something like this! (below)

As it should be (4 ports example)

The organisation had a range of 6 public addresses, thats why not all machines could connect.
These windows pc where connected directly to the internet!
(Some virusscanning required I think!)

Arpscanner

Changed stuff in my arpscanner

I want to know whats on my network, and be informed when a alien device connects.
This also helps me gathering all devices and macaddresses for a cmdb.

I’ve got below in my crontab

5 * * * * root /usr/local/bin/arpscanner

And the script:

#!/bin/bash
# Using a scanner on a specific vlan/interface
arp-scan -l -g  -I p1p1.10 | grep ^10 | grep -vi packets > /var/log/arpscanner
cat /var/log/arpscanner | awk '{ print $2 }'| while read ; do
grep $REPLY /var/local/arpscanner.lst >/dev/null || echo $REPLY | mail -s arpscanner henri@henriaanstoot.nl
done

New and checked devices i put in the file mentioned above:
/var/local/arpscanner.lst

                00:21:5d:gg:gg:7a       Description
                ac:67:b2:gg:gg:a0       Liligo Twatch
                b8:27:eb:gg:dd:fd       Nieuwe octoprint
                d8:f1:5b:gg:gg:4a       WLAN Dungeon
                48:3f:da:gg:gg:fe       Uboot ESP
                8e:93:79:gg:gg:5d       Tablet Monique
                d8:f1:5b:gg:gg:06       ESP Radar
                dc:a6:32:gg:gg:fb       RPI4
                00:1e:ec:gg:gg:ab       laptop
                68:05:ca:gg:gg:68       storage bak

        etcetera