Compare commits

...

4 commits
master ... ipv6

Author SHA1 Message Date
a3fed869bf
direnv pyenv keep python up to date 2025-07-24 10:11:20 +02:00
fc00da4288
wip 2025-07-16 15:33:01 +02:00
37367d863c
wip 2025-07-14 17:30:27 +02:00
bdbfcc3043
wip 2025-07-13 22:35:01 +02:00
10 changed files with 121 additions and 6 deletions

View file

@ -2,6 +2,8 @@
cd "$OLDPWD" cd "$OLDPWD"
pyenv install --skip-existing
if test -f .venv/bin/python && test "$(realpath .venv/bin/python)" != "$(realpath "$(pyenv which python)")" if test -f .venv/bin/python && test "$(realpath .venv/bin/python)" != "$(realpath "$(pyenv which python)")"
then then
echo "rebuilding venv für new python version" echo "rebuilding venv für new python version"

View file

@ -50,7 +50,7 @@ def units(metadata):
}, },
'Network': { 'Network': {
'DHCP': network_conf.get('dhcp', 'no'), 'DHCP': network_conf.get('dhcp', 'no'),
'IPv6AcceptRA': network_conf.get('dhcp', 'no'), 'IPv6AcceptRA': network_conf.get('IPv6AcceptRA', 'no'),
'VLAN': set( 'VLAN': set(
other_network_name other_network_name
for other_network_name, other_network_conf in metadata.get('network', {}).items() for other_network_name, other_network_conf in metadata.get('network', {}).items()

View file

@ -0,0 +1,7 @@
# /etc/dhcpcd.conf
allowinterfaces ppp0
ipv6only
interface ppp0
waitip 6

View file

@ -0,0 +1,48 @@
#!/bin/sh
logger -t dhcpcd "===== dhcpcd.exit-hook gestartet: interface=$interface, reason=$reason ====="
# 1) nur auf ppp0 reagieren
if [ "$interface" != "ppp0" ]; then
logger -t dhcpcd "Skipping hook: interface ist '$interface' (nicht ppp0)"
return 0
fi
logger -t dhcpcd "Hook für ppp0, reason=$reason"
# 2) nur bei ROUTERADVERT (RA vom Provider)
if [ "$reason" != "ROUTERADVERT" ]; then
logger -t dhcpcd "Skipping hook: reason ist '$reason' (nicht ROUTERADVERT)"
return 0
fi
logger -t dhcpcd "Verarbeite ROUTERADVERT"
# 3) IPv6-Prefix auf ppp0 ermitteln
PREFIX=$(ip -6 addr show dev ppp0 scope global dynamic \
| awk '/scope global/ { print $2; exit }')
logger -t dhcpcd "Ermittelter PREFIX: ${PREFIX:-<leer>}"
if [ -z "$PREFIX" ]; then
logger -t dhcpcd "Fehler: kein gültiger IPv6-Prefix auf ppp0 gefunden"
return 1
fi
# 4) radvd.conf erzeugen
logger -t dhcpcd "Erzeuge /etc/radvd.conf aus Template"
if sed "s|__IP6PREFIX__|$PREFIX|g" /etc/radvd.conf.template > /etc/radvd.conf; then
logger -t dhcpcd "Template erfolgreich ersetzt"
else
logger -t dhcpcd "Fehler beim Ersetzen des Templates"
return 1
fi
# 5) radvd neu laden
logger -t dhcpcd "Lade radvd neu"
if systemctl reload-or-restart radvd; then
logger -t dhcpcd "radvd neu geladen"
else
logger -t dhcpcd "Fehler beim Neuladen von radvd"
return 1
fi
logger -t dhcpcd "===== dhcpcd.exit-hook erfolgreich beendet ====="
return 0

View file

@ -11,7 +11,7 @@ replacedefaultroute # ersetzt vorherige Default-Route
+ipv6 # IPv6CP aktivieren +ipv6 # IPv6CP aktivieren
ipv6cp-accept-local # lokale IPv6 vom ISP übernehmen ipv6cp-accept-local # lokale IPv6 vom ISP übernehmen
ipv6cp-accept-remote # remote IPv6 vom ISP übernehmen ipv6cp-accept-remote # remote IPv6 vom ISP übernehmen
ipv6cp-use-ipaddr # statt Link-Local die zugewiesene IPv6 nutzen #ipv6cp-use-ipaddr # statt Link-Local die zugewiesene IPv6 nutzen
defaultroute6 defaultroute6
# --- Verbindungsmanagement --- # --- Verbindungsmanagement ---

View file

@ -0,0 +1,9 @@
interface enp1s0f0 {
AdvSendAdvert on;
prefix __IP6PREFIX__ {
AdvOnLink on;
AdvAutonomous on;
AdvValidLifetime 86400;
AdvPreferredLifetime 14400;
};
};

View file

@ -25,6 +25,22 @@ files = {
'pkg_apt:pppoe', 'pkg_apt:pppoe',
}, },
}, },
'/etc/dhcpcd.conf': {
'content_type': 'mako',
},
'/etc/dhcpcd.exit-hook': {
'mode': '0755',
},
'/etc/radvd.conf.template': {
'content_type': 'mako',
},
}
actions = {
'touch_radvd.conf': {
'command': 'touch /etc/radvd.conf',
'unless': 'ls /etc/radvd.conf',
},
} }
svc_systemd = { svc_systemd = {
@ -39,4 +55,17 @@ svc_systemd = {
'svc_systemd:pppoe-isp.service', 'svc_systemd:pppoe-isp.service',
}, },
}, },
'dhcpcd.service': {
'needs': {
'pkg_apt:dhcpcd5',
'file:/etc/dhcpcd.conf',
'file:/etc/dhcpcd.exit-hook',
'action:touch_radvd.conf',
},
},
'radvd.service': {
'needs': {
'pkg_apt:radvd',
},
},
} }

View file

@ -2,6 +2,8 @@ defaults = {
'apt': { 'apt': {
'packages': { 'packages': {
'pppoe': {}, 'pppoe': {},
'dhcpcd5': {},
'radvd': {},
}, },
}, },
'nftables': { 'nftables': {
@ -11,6 +13,11 @@ defaults = {
}, },
'systemd': { 'systemd': {
'units': { 'units': {
'dhcpcd.service.d/override.conf': {
'Service': {
'ReadWritePaths': {'/etc/radvd.conf'},
},
},
'pppoe-isp.service': { 'pppoe-isp.service': {
'Unit': { 'Unit': {
'Description': 'PPPoE Internet Connection', 'Description': 'PPPoE Internet Connection',
@ -18,7 +25,7 @@ defaults = {
}, },
'Service': { 'Service': {
'Type': 'forking', 'Type': 'forking',
'ExecStart': '/usr/sbin/pppd call isp', 'ExecStart': '/usr/sbin/pppd call isp updetach',
'Restart': 'on-failure', 'Restart': 'on-failure',
'RestartSec': 5, 'RestartSec': 5,
}, },
@ -26,16 +33,23 @@ defaults = {
'qdisc-ppp0.service': { 'qdisc-ppp0.service': {
'Unit': { 'Unit': {
'Description': 'setup queuing discipline for interface ppp0', 'Description': 'setup queuing discipline for interface ppp0',
'After': 'sys-devices-virtual-net-ppp0.device', 'After': {
'pppoe-isp.service',
'sys-devices-virtual-net-ppp0.device',
},
'PartOf': 'pppoe-isp.service',
'BindsTo': 'sys-devices-virtual-net-ppp0.device', 'BindsTo': 'sys-devices-virtual-net-ppp0.device',
}, },
'Service': { 'Service': {
'Type': 'oneshot', 'Type': 'oneshot',
'ExecStart': '/sbin/tc qdisc replace root dev ppp0 cake bandwidth 30Mbit rtt 50ms diffserv4 nat egress', 'ExecStart': '/sbin/tc qdisc replace root dev ppp0 cake bandwidth 37Mbit internet besteffort triple-isolate nat egress memlimit 256mb',
# - no drops save
# - bis 37MBit keine retries bei: iperf3 --client 49.12.184.229 -t999 -i5 --bidir
#'ExecStart': '/sbin/tc qdisc replace root dev ppp0 cake bandwidth 37Mbit internet besteffort nat egress memlimit 256mb',
'RemainAfterExit': 'yes', 'RemainAfterExit': 'yes',
}, },
'Install': { 'Install': {
'WantedBy': 'network-online.target', 'WantedBy': 'multi-user.target',
}, },
} }
}, },

View file

@ -21,6 +21,8 @@
'interface': 'enp1s0f0', 'interface': 'enp1s0f0',
'ipv4': '10.0.0.5/24', 'ipv4': '10.0.0.5/24',
'gateway4': '10.0.0.1', 'gateway4': '10.0.0.1',
#'ipv6': 'fd00:10:0:0::5/64',
'IPv6AcceptRA': 'yes',
'mac': '98:b7:85:01:ca:a6', 'mac': '98:b7:85:01:ca:a6',
}, },
'wakeonlan': { 'wakeonlan': {

View file

@ -19,6 +19,7 @@
'internal': { 'internal': {
'interface': 'enp1s0f0', 'interface': 'enp1s0f0',
'ipv4': '10.0.0.1/24', 'ipv4': '10.0.0.1/24',
#'IPv6AcceptRA': 'yes',
'dhcp_server': True, 'dhcp_server': True,
}, },
'iot': { 'iot': {
@ -71,6 +72,9 @@
'ipv4': { 'ipv4': {
'ip_forward': 1, 'ip_forward': 1,
}, },
'ipv6': {
'ip_forward': 1,
},
}, },
}, },
'wireguard': { 'wireguard': {