This commit is contained in:
Thomas Kruse
2026-02-03 22:29:46 +01:00
commit 8fdf5827e4
156 changed files with 23069 additions and 0 deletions

View File

@ -0,0 +1,7 @@
services:
mosquitto:
image: eclipse-mosquitto
ports:
- "1883:1883"
volumes:
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf:ro

55
01-basics/lab12/lab.txt Normal file
View File

@ -0,0 +1,55 @@
= QoS 0 TCP Absicherung
Ziel ist zu sehen, wie TCP bei Verbindungsproblemen die Applikationsschicht absichert.
Dazu wird für den TCP Port 1883 ein Paketverlust von 50% konfiguriert und Anschließend
Nachrichten versendet und konsumiert.
$ docker run --rm -it --net host eclipse-mosquitto \
mosquitto_sub --debug --topic demo/qos0 -q 0
$ docker run --rm -it --net host eclipse-mosquitto \
mosquitto_pub --topic demo/qos0 -q 0 --message "before tcp loss"
In separatem Terminal wird nun das Netzwerk so konfiguriert, dass es
hohen IP Paketverlust (50%) gibt:
(falls Docker genutzt wird)
$ docker run --rm -it --net host --cap-add NET_ADMIN alpine:3
# apk -U add iptables iproute2 iproute2-ss
(ohne Docker, Debian/Ubuntu)
$ sudo apt install -y iptables iproute2
$ sudo bash
# iptables -t mangle -A POSTROUTING -o lo -p tcp --sport 1883 -j MARK --set-mark 1
# iptables -t mangle -A PREROUTING -i lo -p tcp --dport 1883 -j MARK --set-mark 1
# tc qdisc add dev lo root handle 1: prio
# tc filter add dev lo parent 1:0 protocol ip handle 1 fw flowid 1:1
# tc qdisc add dev lo parent 1:1 handle 10: netem loss 50%
Im ersten Terminal werden nun mehrere Nachrichten versandt:
$ docker run --rm -it --net host eclipse-mosquitto \
mosquitto_pub -t demo/qos0 -q 0 -m "this will be save #1"
$ docker run --rm -it --net host eclipse-mosquitto \
mosquitto_pub -t demo/qos0 -q 0 -m "this will be save #2"
$ docker run --rm -it --net host eclipse-mosquitto \
mosquitto_pub -t demo/qos0 -q 0 -m "this will be save #3"
Anschließendes Aufräumen:
# iptables -t mangle -F
# tc qdisc del dev lo root
= Quellen
Wireshark: https://www.wireshark.org/

View File

@ -0,0 +1,4 @@
listener 1883
allow_anonymous true
# sys_interval 3