====== Systemd ======
===== basics =====
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/
===== network =====
disable predictable network names:
/etc/systemd/networkd/10-eth0.link:
[Match]
OriginalName=eth0
[Link]
NamePolicy=kernel
==== 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
If setting ConfigureWithoutCarrier on DSA-Port the default-route will not be set,because address is invalid (network down at the time of configuration). Option can Only be set if no default route is needed.
For DNS resolved have to be enabled.
==== bridge ====
Create bridge in netdev-file and configuration in network-file
/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
vlans have to be created with a netdev-file first and then linked in the network-file of physical interface
/etc/systemd/network/wan.110.netdev
[NetDev]
Name=wan.110
Kind=vlan
#MACAddress=10:c3:7b:4f:58:a4
#MTUBytes=1500
[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
==== static routes ====
in the .network-file, which is the Gateway
[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 ====
=== Adress assignment ===
Like IPv4 in network-file with additional Address-value
[Network]
Address=192.168.1.1/24
Address=fd00:A::10/64
=== DHCPv6/RA ===
In combination with 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
==== issues ====
=== boot hangs 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