I have a Synology DS214 NAS in my network. A folder on the NAS was shared via NFS. Connecting to this shared folder with NFS version 3 worked fine in VMware ESXi 8.0, but I was unable to get access to the folder using NFS version 4.1. Newer models may support NFS version 4.1 out of the box., check your settings.
While searching for a solution, I found that in my case the configuration of NFS had to be changed on the Synology DS214 NAS. By default it allows NFS version 4, but not NFS version 4.1.
By following these steps, it is possible to add the Synology NFS datastore to VMware ESXi 8 using NFS version 4.1:
Vanwege een nieuw internetabonnement ben ik met ingang van 31 oktober 2020 door KPN overgezet van het Telfort netwerk naar het KPN netwerk. Dit betekende onder andere het omschakelen van DHCP naar PPPoE om verbinding te kunnen maken met het internet.
Mijn uitdaging: IPv6 zonder al te veel moeite werkend krijgen.
Let op: ik maak geen gebruik van KPN iTV, dus dat wordt buiten beschouwing gelaten in deze post.
Achtergrondinformatie
Voordat ik verder inga op mijn uitdaging, eerst wat informatie. KPN gebruikt VLAN’s om hun diensten over één verbinding aan te bieden, namelijk:
vlan4: IPTV
vlan6: Internet
vlan7: VOIP
Normaal gesproken regelt de door KPN geleverde Experiabox de toegang tot deze diensten voor de apparaten die erop worden aangesloten. Aangezien de Experiabox gemaakt is voor gebruikers die er verder niet naar willen omkijken, is er weinig wat er op het apparaat aangepast kan worden. It just works.
Mijn netwerk en bijbehorende uitdaging
Mijn netwerk
Ik gebruik apparatuur van Ubiquiti in mijn netwerk:
De Unifi Security Gateway kan via de Unifi Network Management Controller worden geconfigureerd, maar daarin kunnen niet alle instellingen worden toegepast om de functies van de Experiabox over te nemen. Dat vereist meer werk.
Er zijn allerlei handleidingen te vinden waarin wordt uitgelegd hoe je door middel van een config.gateway.json bestand de functies van de Experiabox grotendeels kunt overnemen.
Mijn uitdaging
Ik wil IPv6 zonder een config.gateway.json bestand te hoeven maken. De Experiabox biedt standaard wél de mogelijkheid om via IPv6 het internet op te gaan, dus dat wil ik ook. In de Unifi Network Management Controller zijn bij de WAN drie mogelijkheden voor IPv6:
Disabled
DHCPv6 (met Prefix Delegation)
Static IP
Ik heb gekozen voor DHCPv6 met bijbehorende Prefix Delegation size van 48, maar zonder resultaat: geen IPv6 adres op de WAN.
In mijn zoektocht naar een oplossing kwam ik dit artikel tegen:
En dit blijkt de oplossing te zijn!
Mijn instellingen
Hieronder mijn instellingen in de Unifi Network Management Controller
Navigeer naar Settings > Networks > LAN > Configure IPv6 Network
Nadat deze instellingen zijn ingevoerd klik je op Save.
Vervolgens ga je naar Devices > USG > tabblad Config > Manage Device + > Force Provision > Provision. Hiermee wordt de Unifi Security Gateway opnieuw voorzien van de instellingen en wordt ook het IPv6 adres opgehaald met bijbehorende informatie.
Open Powershell / Command Prompt en voer in: ipconfig
Wanneer alles goed is verlopen, verschijnt er bij de output van ipconfig IPv6 gerelateerde informatie.
Om vanuit een eigen mailserver te kunnen mailen vanuit het netwerk van KPN, moet onderstaande toegevoegd worden aan het SPF-record van het verzendende domein:
include:spf.ews.kpnxchange.com
Hiermee worden de mailservers op het domein kpnxchange.com geautoriseerd om te mailen namens het verzendende domein.
When I was looking for something new to build I ended up building a DNS over HTTPS server. This way I can use my Pi-hole server wherever I am, without exposing port 53. I let nginx handle the encryption of the HTTPS connection, send the information to dnsdist for translation to DNS, and let Pi-hole filter the queries using my blocklists.
The configuration of nginx (saved as dns.domain.nl):
# Proxy Cache storage - so we can cache the DoH response from the upstream
proxy_cache_path /var/run/doh_cache levels=1:2 keys_zone=doh_cache:10m;
server {
listen 80;
server_name dns.domain.nl;
return 301 https://dns.domain.nl/$request_uri;
}
# This virtual server accepts HTTP/2 over HTTPS
server {
listen 443 ssl http2;
server_name dns.domain.nl;
access_log /var/log/nginx/doh.access;
error_log /var/log/nginx/doh.error error;
ssl_certificate /etc/letsencrypt/live/dns.domain.nl/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dns.domain.nl/privkey.pem;
# DoH may use GET or POST requests, Cache both
proxy_cache_methods GET POST;
# Return 404 to all responses, except for those using our published DoH URI
location / {
try_files $uri $uri/ =404;
}
# This is our published DoH URI
location /dns-query {
# Proxy HTTP/1.1, clear the connection header to enable Keep-Alive
proxy_http_version 1.1;
proxy_set_header Connection "";
# Enable Cache, and set the cache_key to include the request_body
proxy_cache doh_cache;
proxy_cache_key $scheme$proxy_host$uri$is_args$args$request_body;
# proxy pass to dnsdist
proxy_pass http://127.0.0.1:5300;
}
}
nginx sends an 404 error when you visit the address https://dns.domain.nl/. It is only a proxy to 127.0.0.1:5300 when data is sent to https://dns.domain.nl/dns-query.
Check the configuration of nginx
nginx -t
It should give the following output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Restart nginx to load the new configuration:
systemctl restart nginx.service
dnsdist
The (minimal working) configuration of dnsdist (saved as dnsdist.conf)
Note: this is a minimal configuration. No measures have been taken with regard to security or abuse. Consult the documentation for more information.
-- dnsdist configuration file, an example can be found in /usr/share/doc/dnsdist/examples/
-- disable security status polling via DNS
-- setSecurityPollSuffix("")
-- fix up possibly badly truncated answers from pdns 2.9.22
-- truncateTC(true)
-- Answer to only clients from this subnet
setACL("127.0.0.1/8")
-- Define upstream DNS server (Pi-hole)
newServer({address="192.168.2.100", name="Pi-hole", checkName="dc01.domain.nl.", checkInterval=60, mustResolve=true})
-- Create local DOH server listener in DNS over HTTP mode, otherwise the information coming from nginx won't be processed well
addDOHLocal("127.0.0.1:5300", nil, nil, "/dns-query", { reusePort=true })
A few things are important here:
I’ve set an ACL that allows dnsdist to only answer to queries from the subnet 127.0.0.1/8.
I’ve added an upstream (downstream according to dnsdist) DNS server with the IP address 192.168.2.100. It’s configured with a custom checkName and checkInterval. Normally, dnsdist sends a query to a.root-servers.net every second(!). With this configuration, it checks another server – my domain controller – every 60 seconds.
I’ve added a DOH listener on the loopback address 127.0.0.1:5300. This is configured as DNS over HTTP, because nginx takes care of the decryption of the connection.
Check the configuration of dnsdist:
dnsdist --check-config
It should give the following output:
No certificate provided for DoH endpoint 127.0.0.1:5300, running in DNS over HTTP mode instead of DNS over HTTPS Configuration '/etc/dnsdist/dnsdist.conf' OK!
Restart dnsdist to load the new configuration:
systemctl restart dnsdist.service
To check if dnsdist is listening to 127.0.0.1:5300:
Now it’s time to configure your browser to use your new DNS over HTTPS server. This website explains how to configure your web browser to use DNS over HTTPS:
To make sure it’s working properly, we need to inspect the logs. nginx keeps a log of access and error messages. We will look at those logs to see if the information is passed on correctly to dnsdist.
It’s important that you see 200 (after HTTP/2.0) in the logs. This means that nginx was able to pass the information to dnsdist. Otherwise, something has gone wrong.
When something has gone wrong, it should show up in the error logs
cat /var/log/nginx/doh.error
It should (hopefully not) give the following output:
A file is available (emailaccounts.txt) containing all email addresses for the backup
A NFS server is available to store the backup externally
A local directory (/nfs-mount) is available to connect to the NFS server
The script has to be run as root because of NFS (maybe there are other ways to do this, but it works.)
A local partition is available (/backup) from where the backup is copied to the NFS server
#!/bin/bash
#
# Functies
#
function backup_loop() {
# In het bestand emailaccounts.txt moet handmatig het emailaccount worden toegevoegd, wil het meegenomen worden in de backup.
for i in $(cat /home/maarten/emailaccounts.txt);
# De content van de gehele mailbox (dus ook agenda etc.) wordt dmv een API opgevraagd en opgeslagen in de map /backup/zimbra/
do
backup_folder_check # Controleer of de map bestaat
backup_cleanup # Verwijder bestanden ouder dan geconfigureerde dagen
export_mailbox # Exporteer de mailbox
backup_to_nas # Zet een kopie op de nas via de NFS-koppeling
# Echo welke emailadressen in de backup zijn verwerkt
echo $i;
# Klaar met exporteren
done;
}
function backup_folder_check() {
# Controleer of de map bestaat voor deze gebruiker. Is dit niet het geval, maak alsnog de map aan.
if [ ! -d /backup/zimbra/$i ];
then
mkdir -p /backup/zimbra/$i;
chown zimbra:zimbra /backup/zimbra/$i
fi
}
function export_mailbox() {
zmmailbox -z -m $i getRestURL "//?fmt=tgz" > /backup/zimbra/$i/$(date +%Y-%m-%d).tgz;
}
function backup_cleanup() {
/usr/bin/find /backup/zimbra/$i/ -type f -mtime +4 -delete; # Verwijder bestanden ouder dan 4 dagen
}
function backup_to_nas() {
cp -Rf /backup/zimbra/$i /nfs-mount/zimbra/$i # Kopieer bestanden naar de nas via /nfs-mount/
}
function mount_nfs() {
/sbin/mount.nfs4 NAS:/volume2/Backups /nfs-mount/ -w -o rsize=8192,wsize=8192 # Koppel de nas aan /nfs-mount/
}
function unmount_nfs() {
/sbin/umount.nfs4 /nfs-mount/ # Ontkoppel de /nfs-mount/
}
#
# Volgorde uit te voeren werkzaamheden
#
mount_nfs # Maak de NAS wakker en maak een NFS-koppeling --> kan alleen als root
backup_loop # Start de loop - controleer of mappen bestaan en exporteer vervolgens de mailbox naar de betreffende map
backup_cleanup # Zorg dat de lokale backup maximaal 4 dagen oud is
unmount_nfs # Ontkoppel /nfs-mount/ zodat de NAS kan slapen --> kan alleen als root
I want to receive a notification when someone rings the doorbell at my front door. For this I can buy all kinds of expensive (wireless) doorbells, but I want to use the existing wiring. Because I use Home Assistant for all kinds of automation at home, I also want to integrate this into Home Assistant. Since there is already a Raspberry Pi in the meter cupboard for reading my smart meter, this seemed a logical addition to me.
It reads the GPIO pins from the Raspberry Pi Board
It allows me to configure which pins have to be read
It allows the Pi to send the information to an MQTT broker
This allows me to use my Home Assistant installation to notify me when someone rang my doorbell, thereby always being informed when someone was at my front door, even when I’m not at home. It also makes it possible to automatically turn on a light in the hallway when it’s dark.
It was a little headache to make it work on my Raspberry Pi 3b with Raspbian, so that’s why I wrote down the instructions.
All the commands are executed as root user
Virtual Env
First you need to create a virtual environment with Python version 3, in /home/pi
/home/pi# python3 -m venv pi_mqtt_gpio
Next, you enter the virtual environment
/home/pi# . pi_mqtt_gpio/bin/activate
Your shell should now show this:
(pi_mqtt_gpio) root@rpi3:
Install the following packages with pip3 (if it’s not installed, use apt install python3-pip)
By default, every Google device uses the following configured DNS-servers:
8.8.8.8
8.8.4.4
But I don’t want my guests, who can use my WiFi, to let Google phone home and give information about who visits my network.
I use iptables to block those DNS-requests. The firewall rejects all the DNS-requests that would be sent to Google. So the clients have no other option than to use the DNS-server that’s published by my DHCP-server.
User scripts
With the AsusWRT (and asuswrt-merlin) firmware I can add user scripts. The next two lines are loaded when the firewall (iptables) has been started.
Save this code in the folder /jffs/scripts/ with the filename firewall-start.
After successfully loading the rules in iptables, when your router has (re)booted successfully, every DNS-request to Google will be rejected. When testing this with a ping to 8.8.8.8 (or 8.8.4.4), the result should be:
Pinging 8.8.8.8 with 32 bytes of data:
Reply from 192.168.2.1: Destination port unreachable.
Reply from 192.168.2.1: Destination port unreachable.
Reply from 192.168.2.1: Destination port unreachable.
Reply from 192.168.2.1: Destination port unreachable.
Probleem met PowerShell: het kan geen strings aan die langer zijn dan 255 tekens. Mijn DKIM-key is langer dan dat, en ondanks allerlei pogingen is het niet gelukt om deze met PowerShell toe te voegen aan de DNS-zone.
Gelukkig werkt dnscmd nog wel in PowerShell, dus kan ik met onderstaande code alsnog dit type TXT-records aanmaken.
Belangrijk is dat er een spatie tussen de aanhalingstekens wordt geplaatst. Dan wordt de tekst op een nieuwe regel geplaatst in de DNS-zone.
Het toevoegen van een reservering
Ik draai PiHole met een uitgebreide lijst, maar daardoor worden een aantal services geblokkeerd die ik op mijn Philips Smart TV graag wel wil gebruiken.
Om het mogelijk te maken dat deze een andere DNS-server toegewezen krijgt, maak ik eerst een reservering voor de TV: