1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hotspot_ynh.git synced 2024-09-03 19:25:53 +02:00

add ipv6 default route after enabling ipv6 forwarding

This commit is contained in:
HgO 2024-04-28 14:02:22 +02:00
parent dbb06da824
commit df56105c81

View file

@ -136,8 +136,17 @@ set_ipfirewall() {
}
set_forwarding() {
local ip6_gateway=$(ip -6 route | awk '/default via/ { print $3; }')
local wired_interface=$(ip -6 route | awk '/default via/ { print $5; }')
sysctl -w net.ipv6.conf.all.forwarding=1 >/dev/null
sysctl -w net.ipv4.conf.all.forwarding=1 >/dev/null
if [[ -n "${ip6_gateway}" ]]; then
# Enabling IPv6 forwarding removes the default route, so we need to add it back.
# See https://askubuntu.com/questions/463625/ipv6-forwarding-kills-ipv6-connection/463654#463654
ip route add default via "${ip6_gateway}" dev ${wired_interface}
fi
}
start_dhcpd() {