====== Systemd ======
===== Grundlagen =====
https://www.shubhamdipt.com/blog/how-to-create-a-systemd-service-in-linux/
rc.local: https://www.troublenow.org/752/debian-10-add-rc-local/
===== Netzwerk =====
==== dsa ====
/etc/systemd/network/eth0.network:
[Match]
Name=eth0
[Network]
DHCP=no
LinkLocalAddressing=no
ConfigureWithoutCarrier=true
/etc/systemd/network/wan.network
[Match]
Name=wan
[Network]
BindCarrier=eth0
Address=192.168.0.18/24
Gateway=192.168.0.10
DNS=192.168.0.10
Wird ConfigureWithoutCarrier beim DSA-Port gesetzt wird die default-route nicht gesetzt,weil die Adresse ungültig ist (da Netzwerk down zum Zeitpunkt der Konfiguration). Das darf also nur gesetzt werden,wenn keine default-route gesetzt werden muss.
Für DNS muss resolved laufen
==== Brücke ====
Erstellen der Brücke in netdev-Datei und Konfiguration in network-Datei
/etc/systemd/network/lanbr.netdev:
[NetDev]
Name=lanbr0
Kind=bridge
[Bridge]
DefaultPVID=1
VLANFiltering=1
/etc/systemd/network/lanbr.network:
[Match]
Name=lanbr0
[Network]
BindCarrier=eth0
ConfigureWithoutCarrier=true
Address=192.168.1.1/24
#Address=192.168.0.18/24
#Gateway=192.168.0.10
#DNS=192.168.0.10
==== VLAN ====
https://wiki.archlinux.org/title/VLAN#Single_interface_with_multiple_VLANs_each_with_its_own_gateway
das vlan muss in einer netdev-Datei erst erstellt und dann in der network-Datei des physikalischen Interfaces verlinkt werden
/etc/systemd/network/wan.110.netdev
[NetDev]
Name=wan.110
Kind=vlan
[VLAN]
Id=110
/etc/systemd/network/wan.network:
[Match]
Name=wan
[Link]
# Override MAC address (spoof MAC address)
MACAddress=08:22:33:44:55:66
[Network]
BindCarrier=eth0
#DHCP=ipv4
#static setup
Address=192.168.0.18/24
Gateway=192.168.0.10
DNS=192.168.0.10
VLAN=wan.110
VLAN=wan.140
==== statische Routen ====
in der .Network-datei, welche als Gateway fungiert
[Route]
Gateway=192.168.0.10
Destination=10.0.3.0/24
GatewayOnLink=yes
==== pppoe ====
https://www.sherbers.de/diy-linux-router-part-3-pppoe-and-routing/
==== IPv6 ====
=== Adresszuweisung ===
wie IPv4 in network-datei mit zusätzlichem Address-Wert
[Network]
Address=192.168.1.1/24
Address=fd00:A::10/64
=== DHCPv6/RA ===
zusammen mit ipv4-DHCP-Server (
DHCPServer=no/ohne
DHCPServer-Section => nur IPv6)
[Match]
Name=lanbr0
[Network]
BindCarrier=eth0
ConfigureWithoutCarrier=true
Address=192.168.1.1/24
Address=fd00:A::10/64
#Address=192.168.0.18/24
#Gateway=192.168.0.10
#DNS=192.168.0.10
DHCPServer=yes
IPv6SendRA=yes
DHCPv6PrefixDelegation=yes
[DHCPServer]
PoolOffset=100
PoolSize=150
[IPv6SendRA]
Managed=true
[IPv6Prefix]
Prefix=fd00:A::/64
=== Tunnel (he) ===
https://wiki.archlinux.org/title/IPv6_tunnel_broker_setup#systemd-networkd
==== probleme ====
=== boot hängt on wait-for-online ===
https://askubuntu.com/a/1245672/1294721
sudo systemctl edit systemd-networkd-wait-online.service
[Service]
ExecStart=
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online --any