Leave a reply

DayOwl – Network

This guide should help you to set up networks with higher ranges and should set the default „ip-ranges“ for devices, like I do. It is thought for home networks and small business networks. In the last 10 years the numbers of Network Access Devices (NAD) has increased a lot. Even if you have one machine it can have different network interfaces and will require ip-adresses on all of them. So it can easy happen that your subnet with a /24 range is getting quite small after a few months. Changing this later makes you a lot of work, because you have to change the subnetmask on every device. Devices with enabled DHCP Client Service will not make you the problem, but static IP Adresses like switches, printers… will not be able to communicate with network devices out of their subnet. For example if you forget to change the subnet on a printer, you can use it from all devices which are in the network range of the subnet. But if you sent a printer job from a machine outside this subnet this will not work because the tcp connection can not be answered from the printer.

My solution is to create bigger networks from scratch on. I never use /24 subnets (with about 255 usable addresses).
I also recommend to use A-Class Networks. Starting 10.X.X.X and then use something like the postal code or the door number to easier remember the range.

For example:
Vienna – 4th district (ZIP-1040) is then 10.104.X.X
Korneuburg – (ZIP-2100) is then 10.210.X.X

This will save you time with routing issues with you want to make site-to-site VPNs or even normal VPNs.

You can use this online tool to calculate your Host Address Range.
http://www.subnet-calculator.com

My home network uses following:
IP Address: 10.104.0.0
Subnet Mask: 255.255.240.0
Host Address Range: 10.104.0.1 – 10.104.15.254

The first 255 Addresses are reserved for administrativ devices:
IP Range: 10.104.0.0 – 10.104.1.0

Network Hardware (1-19)
10.104.0.1 – 10.104.0.19

in this range I use following rules:
Firewall (1-4)
10.104.0.1 – 10.104.0.4
Switches (5-15)
10.104.0.5 – 10.104.0.15
Internal Servers (20-40)
10.104.0.20 – 10.104.0.40
Printers (70-79)
10.104.0.70 – 10.104.0.79
Access Points (80-110)
10.104.0.80 – 10.104.0.110

I love when the DHCP Server is doing an IP-Mac binding and gives the fix IP-Addresses. But I would recommend to give the essential heart of you network manual fix IP-Addresses (switches and firewall).



Leave a reply

auto-convert to h265

My NAS has a lot of old privat video files and I want to convert them to the new h265-codec to save a lot of space. First thing to say is that you need a lot of CPU Power to process the video transcoding. Plan is to create a script that search the folder structure and then convert the file, remove the old (mov or mp4 file) and replace it with the new h265 encoded file.

After some research I got to following:
with help of Marcel in this post and Thomas Böhm

CPU rendering

find * -type f \( -iname \*.mp4 -o -iname \*.mov \) -exec ffmpeg -i {} -vcodec libx265 -crf 18 -vtag hvc1 temp_{} \; -exec mv temp_{} {} \;

If you just convert one file you use following command:

ffmpeg -i <path_to_orignal_file> -c:v libx265 -vtag hvc1 -crf 18 <path_to_output_file>

You can change the setting -crf to optimise you output files bitrate
If you want to know more about it visit Werner Robitza Homepage LINK

Apple T2 Chip – faster transcoding

If you use an Apple Mac Device with an T2 Chip (most OS devices after 2018) you can speed up the conversation a lot by using the hevc_videotoolbox of ffmpeg. This will increase the speed more than 30 times, compared to CPU rendering. BUT the quality is getting really bad. I would recommend to use the classical CPU rendering.

ffmpeg -i <path_to_orignal_file> -vcodec hevc_videotoolbox -vtag hvc1 -crf 18 <path_to_output_file>

After some testing and playing around I created following script. The logging is in englisch and german mixed, sorry for that.

You need to install ffmpeg and exiftool (this will help copy the metadata of the original video file to the new created one, so you do not lose the creation date). On a Mac you can use Homebrew to install the packages.

First install Homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

then ffmpeg:

brew install ffmpeg

and now exiftool:

brew install exiftool

Now you can create a new shell script and copy the content into your empty file. Move the file to the folder which you want to transcode (take care the it will automatically do it recursive). Then you have to change the last line in the script to the folder path you have stored the script. Now you can start the transcoding with

chmod + x <your-script-name>
#and then
./<your-script-name>
#!/bin/zsh
# this script can help you to convert files in folders and subfolder to h265 files (using CPU rendering, you can change the ffmpeg parameters if you need)
# copy the script to the folder you want to convert files, and change the path in the last lines of the script
# you need ti have ffmpeg and exiftool installed. On the mac you can use Homebrew

mkdir ~/Documents/log

machwas() {
    wo_bin_ich=$( pwd )
    echo $date "bearbeite Ordner ${wo_bin_ich}/ -------" >> ~/Documents/log/H265_transcoding.log
    SAVEIFS=$IFS
    IFS=$(echo -en "\n\b")
    for f in *; do
        # fuer alle Ordner
        if [ -d "$f" ]; then
            echo $date "habe Ordner $f erkannt" >> ~/Documents/log/H265_transcoding.log
            (cd -- "$f" && machwas)
        fi
                if [ $(find $f -type f -maxdepth 0 -iname "*.mp4" -o -iname "*.mov"| wc -l) -gt 0 ]
                  then
                    echo $date $f 'is mov or mp4' >> ~/Documents/log/H265_transcoding.log
                    if mdls -name kMDItemCodecs $f | grep -q "HEVC"
                      then
                        echo $date $f 'is HEVC' >> ~/Documents/log/H265_transcoding.log
                      else
                        echo $date $f 'is not HEVC, starting to prozess the files ATTENTION' >> ~/Documents/log/H265_transcoding.log
  #                      echo $f
                        name=$(basename "$f")
  #                      echo $name
                        ffmpeg -i $f -vcodec libx265 -crf 18 -vtag hvc1 /tmp/$name >> ~/Documents/log/H265_transcoding.log
                        exiftool -tagsFromFile $f -api largefilesupport=1 -extractEmbedded -all:all -FileModifyDate -overwrite_original /tmp/$name >> ~/Documents/log/H265_transcoding.log
                        mv /tmp/$name $f
                      fi
                  else
                    echo $date $f ' this is not an video file of the type mp4 or mov' >> ~/Documents/log/H265_transcoding.log
                  fi
    done
}
    IFS=$SAVEIFS

# Aufruf des Ganzen
cd  /Users/admin/Movies
machwas

Maybe I will get time in the next weeks to change the language to english and optimize the workflow.


Leave a reply

WireGuard VPN – Ubuntu Server

WireGuard is the most modern and easiest way to go if you want to create an VPN Server. The guys from PiVPN created a great installer for RaspberryPi’s. But I need some more Power 🙂 So here is the fast installation guide for this:

Update and Upgrade your Server

sudo apt update
sudo apt full-upgrade

Install all needed packages

sudo apt-get install --assume-yes iptables-persistent dnsutils iptables-persistent wireguard-tools qrencode  net-tools

Now you can use the pivpn.io script to install

curl -L https://install.pivpn.io | bash

After the successful install you can create the user by typing

sudo pivpn -a

now you can edit the user profile you have created right now

nano /home/pi/configs/vs_mbp.conf 

If you leave the last line „AllowedIPs = 0.0.0.0/0, ::0/0“ like it is. Every traffic will be routed in your WireGuard VPN. If you want to have only the packages for the destination network routed you have to change it to your ip address range. For example: AllowedIPs = 10.210.0.0/24

[Interface]
PrivateKey = kPcrDnyRhjhNh+g6x3iqSR6DrFj0jRiR2GbUNgc1qFDxx=
Address = 10.6.0.2/24
DNS = 10.210.0.1, 1.1.1.1

[Peer]
PublicKey = YoKGLSuXRxv2WcaSzyVCDkIRqCW+BxHuK5VYvZg/7w0=
PresharedKey = hPvRvm5DqEreE8EXydEczi9R7Ygn4qKcrVKAVxvgH+W8=
Endpoint = X.X.X.X:51820
AllowedIPs = 0.0.0.0/0, ::0/0

I tested this installer with an Synology Virtual Machine Manager and Proxmox installation

If you don’t install the needed packages then you get following errors:

:::
::: sudo will be used for the install.
::: Hostname length OK
::: Verifying free disk space...
:::
::: Checking apt-get for upgraded packages.... done!
:::
::: Your system is up to date! Continuing with PiVPN installation...
:::    Checking for git... already installed!
:::    Checking for tar... already installed!
:::    Checking for wget... already installed!
:::    Checking for curl... already installed!
:::    Checking for grep... already installed!
:::    Checking for dnsutils... not installed!
:::    Checking for whiptail... already installed!
:::    Checking for net-tools... not installed!
:::    Checking for bsdmainutils... already installed!
:::    Checking for iptables-persistent... not installed!
/usr/bin/debconf-apt-progress: can't open /tmp/tmp.0xfbAZFK8b: Permission denied at /usr/bin/debconf-apt-progress line 249, <STDIN> line 3.
:::    Failed to install dnsutils!
:::    Failed to install net-tools!
:::    Failed to install iptables-persistent!

Leave a reply

Zabbix – Proxy (docker-compose) Version 5

You can easy install you Zabbix – Proxy with this docker-compose.yml file. Download LINK

Follow this steps:
– Make sure that you have the same path created if not use mkdir -p /volume1/docker/Zabbix/
– Generate PSK FILE by tipping this in your ssh session:“openssl rand -hex 32 >> /volume1/docker/Zabbix/zabbix_agentd.psk“
– change „XXX-IDENTITY“ to the Proxy Name
– change „xxx.xxx.xxx“ to the IP Adress or the DNS name of you Zabbix Server
– save the PSK Key (zabbix_agentd.psk) content and the „Proxy Name“ you will need it to install the proxy on you Zabbix Server

after downloading the docker-compose.yml you have to type:

sudo docker-compose up -d

Now you Proxy should start soon (depending on the Hardware it can take up to 5 minutes)

# Make sure that you have the same path created
# if not use mkdir -p /volume1/docker/Zabbix/
# Generate PSK FILE: 
# "openssl rand -hex 32 >> /volume1/docker/Zabbix/zabbix_agentd.psk"
# change "XXX-IDENTITY" to the Proxy Name 
# change "xxx.xxx.xxx" to the IP Adress or the DNS name of you Zabbix Server

version: "3"

services:
  Zabbix-Proxy:
    container_name: Zabbix-Proxy
    restart: always
    image: zabbix/zabbix-proxy-sqlite3:ubuntu-5.0-latest
    environment:
      ZBX_TLSCONNECT: psk
      ZBX_TLSACCEPT: psk
      ZBX_TLSPSKIDENTITY: XXX-IDENTITY
      ZBX_HOSTNAME: XXX-IDENTITY
      ZBX_SERVER_HOST: xxx.xxx.xxx
      ZBX_TLSPSKFILE: zabbix_agentd.psk
      ZBX_SERVER_PORT: 10051
    volumes:
      - /volume1/docker/Zabbix/zabbix_agentd.psk:/var/lib/zabbix/enc/zabbix_agentd.psk

then you can see the status by using following command:

docker container logs Zabbix-Proxy

If you want you can add following volume/folder to ingest special MIB Files to you installation (THX to Rainhardt Gabriel for this input)

/volume1/docker/Zabbix/mibs:/var/lib/snmp/mibs/

Leave a reply

TimeLapse with DSLR and RaspberryPi

You can use your RaspberryPi to create a perfect TimeLapse-System using Gphoto2. You can easy install it by typing following

sudo apt-get install gphoto2  

with

gphoto2 --auto-detect

you can see if and what camera is connected. Then (if you want to record on the SD Card) you have to check the „location“ of your memory card

gphoto2 --get-config capturetarget

the output should look like:

pi@raspberrypi:~ $ gphoto2 --get-config capturetarget
Label: Capture Target                                                          
Readonly: 0
Type: RADIO
Current: Internal RAM
Choice: 0 Internal RAM
Choice: 1 Memory card
END

Now we can set the capture target to the Memory Card with this command:

photo2 --set-config capturetarget=1

Now you can use following command to take pictures and save them direct to your SD Card

gphoto2 -–capture-image  

For timelapes I would recommend that you use the screen command to build a virtual terminal session and easy detach and attach this again
Link to Screen Help

Now you can start your photograph session with this command.
-I defines how long you want to wait between the pictures
-F defines how many pictures you want to take

gphoto2 -I 20 -F 10000 --capture-image 

If you want to download the pictures to your Raspberry Pi’s SD card you have to use following:

gphoto2 --capture-image-and-download

All other commands can be found here LINK


Durch die weitere Nutzung der Seite stimmst du der Verwendung von Cookies zu. Weitere Informationen

Die Cookie-Einstellungen auf dieser Website sind auf "Cookies zulassen" eingestellt, um das beste Surferlebnis zu ermöglichen. Wenn du diese Website ohne Änderung der Cookie-Einstellungen verwendest oder auf "Akzeptieren" klickst, erklärst du sich damit einverstanden.

SchlieĂźen