More fixes and generalizing, add hypervisor WIP template
This commit is contained in:
parent
8bad04acb6
commit
a80e93ec6e
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
|
||||
. "$(dirname -- "$0")/netdev.sh"
|
||||
|
||||
# Physical
|
||||
new_if_phys "phys0"
|
||||
new_if_phys "phys1"
|
||||
new_if_phys "phys2"
|
||||
new_if_phys "phys3"
|
||||
new_if_phys "phys4"
|
||||
new_if_phys "phys5"
|
||||
|
||||
# Bridges
|
||||
IFACE="br-v6"
|
||||
new_if_bridge "$IFACE"
|
||||
bridge_property 'stp_state' "$IFACE"
|
||||
bridge_property 'mcast_router' "$IFACE"
|
||||
bridge_property 'mcast_snooping' "$IFACE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
|
||||
bridge_property 'mcast_querier' "$IFACE"
|
||||
bridge_property 'mcast_mld_version' "$IFACE" '2' ''
|
||||
|
||||
IFACE="br0"
|
||||
new_if_bridge "$IFACE"
|
||||
bridge_property 'stp_state' "$IFACE"
|
||||
bridge_property 'mcast_router' "$IFACE"
|
||||
bridge_property 'mcast_snooping' "$IFACE" '0' '' # TODO: Remove such entries when bridges play well with multicasting
|
||||
bridge_property 'mcast_querier' "$IFACE"
|
||||
bridge_property 'mcast_mld_version' "$IFACE" '2' ''
|
||||
|
||||
# Wireguard
|
||||
IFACE="wg-tunnel"
|
||||
new_if_wg "$IFACE"
|
||||
addr_static_if "$IFACE" "172.22.12.5/32"
|
||||
addr_static_if "$IFACE" "fd42:42:42::2:5/128"
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Generate s6 network definitions
|
||||
|
||||
# set -x
|
||||
set -x
|
||||
|
||||
header_eb() {
|
||||
echo '#!/bin/execlineb -P'
|
||||
|
@ -46,7 +46,7 @@ addrfam() {
|
|||
# Use ipv6 if cannot autodetect of if no semicolons are present
|
||||
local addr="$1"
|
||||
local fam='6'
|
||||
if which grep >/dev/null 2>&1 && echo "$addr" | grep -v ':'; then
|
||||
if which grep >/dev/null 2>&1 && echo "$addr" | grep -v ':' >/dev/null 2>&1; then
|
||||
local fam='4'
|
||||
fi
|
||||
echo "$fam"
|
||||
|
@ -278,14 +278,13 @@ wgconf() {
|
|||
header_path
|
||||
header_if "$if"
|
||||
cat <<EOF
|
||||
s6-envdir -i /etc/s6/env/interface.\${INTERFACE}.wg-config
|
||||
importas -i CONFIG CONFIG
|
||||
s6-envdir -I /etc/s6/env/interface.\${INTERFACE}.wg-config
|
||||
importas -D /etc/wireguard/\${INTERFACE} CONFIG CONFIG
|
||||
EOF
|
||||
echo 'wg setconf $INTERFACE $CONFIG'
|
||||
) rc/"$sname"/up
|
||||
install -Dm644 <(echo oneshot) rc/"$sname"/type
|
||||
install -Dm644 /dev/null rc/"$sname"/dependencies.d/interface."$if".create
|
||||
install -Dm644 <(echo "/etc/wireguard/$if") env/"$sname"/CONFIG
|
||||
}
|
||||
|
||||
new_if_vrf() {
|
||||
|
|
Loading…
Reference in New Issue