Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
a3fed869bf | |||
fc00da4288 | |||
37367d863c | |||
bdbfcc3043 |
10 changed files with 121 additions and 6 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
cd "$OLDPWD"
|
||||
|
||||
pyenv install --skip-existing
|
||||
|
||||
if test -f .venv/bin/python && test "$(realpath .venv/bin/python)" != "$(realpath "$(pyenv which python)")"
|
||||
then
|
||||
echo "rebuilding venv für new python version"
|
||||
|
|
|
@ -50,7 +50,7 @@ def units(metadata):
|
|||
},
|
||||
'Network': {
|
||||
'DHCP': network_conf.get('dhcp', 'no'),
|
||||
'IPv6AcceptRA': network_conf.get('dhcp', 'no'),
|
||||
'IPv6AcceptRA': network_conf.get('IPv6AcceptRA', 'no'),
|
||||
'VLAN': set(
|
||||
other_network_name
|
||||
for other_network_name, other_network_conf in metadata.get('network', {}).items()
|
||||
|
|
7
bundles/pppoe/files/dhcpcd.conf
Normal file
7
bundles/pppoe/files/dhcpcd.conf
Normal file
|
@ -0,0 +1,7 @@
|
|||
# /etc/dhcpcd.conf
|
||||
|
||||
allowinterfaces ppp0
|
||||
ipv6only
|
||||
|
||||
interface ppp0
|
||||
waitip 6
|
48
bundles/pppoe/files/dhcpcd.exit-hook
Normal file
48
bundles/pppoe/files/dhcpcd.exit-hook
Normal 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
|
|
@ -11,7 +11,7 @@ replacedefaultroute # ersetzt vorherige Default-Route
|
|||
+ipv6 # IPv6CP aktivieren
|
||||
ipv6cp-accept-local # lokale 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
|
||||
|
||||
# --- Verbindungsmanagement ---
|
||||
|
|
9
bundles/pppoe/files/radvd.conf.template
Normal file
9
bundles/pppoe/files/radvd.conf.template
Normal file
|
@ -0,0 +1,9 @@
|
|||
interface enp1s0f0 {
|
||||
AdvSendAdvert on;
|
||||
prefix __IP6PREFIX__ {
|
||||
AdvOnLink on;
|
||||
AdvAutonomous on;
|
||||
AdvValidLifetime 86400;
|
||||
AdvPreferredLifetime 14400;
|
||||
};
|
||||
};
|
|
@ -25,6 +25,22 @@ files = {
|
|||
'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 = {
|
||||
|
@ -39,4 +55,17 @@ svc_systemd = {
|
|||
'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',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ defaults = {
|
|||
'apt': {
|
||||
'packages': {
|
||||
'pppoe': {},
|
||||
'dhcpcd5': {},
|
||||
'radvd': {},
|
||||
},
|
||||
},
|
||||
'nftables': {
|
||||
|
@ -11,6 +13,11 @@ defaults = {
|
|||
},
|
||||
'systemd': {
|
||||
'units': {
|
||||
'dhcpcd.service.d/override.conf': {
|
||||
'Service': {
|
||||
'ReadWritePaths': {'/etc/radvd.conf'},
|
||||
},
|
||||
},
|
||||
'pppoe-isp.service': {
|
||||
'Unit': {
|
||||
'Description': 'PPPoE Internet Connection',
|
||||
|
@ -18,7 +25,7 @@ defaults = {
|
|||
},
|
||||
'Service': {
|
||||
'Type': 'forking',
|
||||
'ExecStart': '/usr/sbin/pppd call isp',
|
||||
'ExecStart': '/usr/sbin/pppd call isp updetach',
|
||||
'Restart': 'on-failure',
|
||||
'RestartSec': 5,
|
||||
},
|
||||
|
@ -26,16 +33,23 @@ defaults = {
|
|||
'qdisc-ppp0.service': {
|
||||
'Unit': {
|
||||
'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',
|
||||
},
|
||||
'Service': {
|
||||
'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',
|
||||
},
|
||||
'Install': {
|
||||
'WantedBy': 'network-online.target',
|
||||
'WantedBy': 'multi-user.target',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
'interface': 'enp1s0f0',
|
||||
'ipv4': '10.0.0.5/24',
|
||||
'gateway4': '10.0.0.1',
|
||||
#'ipv6': 'fd00:10:0:0::5/64',
|
||||
'IPv6AcceptRA': 'yes',
|
||||
'mac': '98:b7:85:01:ca:a6',
|
||||
},
|
||||
'wakeonlan': {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
'internal': {
|
||||
'interface': 'enp1s0f0',
|
||||
'ipv4': '10.0.0.1/24',
|
||||
#'IPv6AcceptRA': 'yes',
|
||||
'dhcp_server': True,
|
||||
},
|
||||
'iot': {
|
||||
|
@ -71,6 +72,9 @@
|
|||
'ipv4': {
|
||||
'ip_forward': 1,
|
||||
},
|
||||
'ipv6': {
|
||||
'ip_forward': 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
'wireguard': {
|
||||
|
|
Loading…
Reference in a new issue