echo '#!/bin/bash
ip6tables -F
ip6tables -X
iptables -F
iptables -X
sysctl -w net.ipv6.conf.all.disable_ipv6=0
sysctl -w net.ipv6.conf.default.disable_ipv6=0
sysctl -w net.ipv6.conf.all.forwarding=1
sysctl -w net.ipv6.conf.default.forwarding=1
sysctl -w net.ipv6.conf.all.drop_unicast_invalid_hbh=0
sysctl -w net.ipv6.conf.default.drop_unicast_invalid_hbh=0
sysctl -w net.ipv6.conf.all.drop_multicast_invalid_hbh=0
sysctl -w net.ipv6.conf.default.drop_multicast_invalid_hbh=0
sysctl -w net.ipv6.icmp6.ratelimit=0
sysctl -w net.ipv6.frag_time=60
sysctl -w net.ipv6.conf.all.accept_ra=2
sysctl -w net.ipv6.conf.default.accept_ra=2
sysctl -w net.ipv6.path_mtu_discovery=1
ip6tables -A INPUT -p icmpv6 -j ACCEPT
ip6tables -A FORWARD -p icmpv6 -j ACCEPT
ip6tables -A INPUT -m hbh -j ACCEPT
ip6tables -A FORWARD -m hbh -j ACCEPT
ip6tables -A INPUT -f -j ACCEPT
ip6tables -A FORWARD -f -j ACCEPT
echo "net.ipv6.conf.all.disable_ipv6=0
net.ipv6.conf.default.disable_ipv6=0
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.drop_unicast_invalid_hbh=0
net.ipv6.conf.default.drop_unicast_invalid_hbh=0
net.ipv6.conf.all.drop_multicast_invalid_hbh=0
net.ipv6.conf.default.drop_multicast_invalid_hbh=0
net.ipv6.icmp6.ratelimit=0
net.ipv6.frag_time=60
net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.default.accept_ra=2
net.ipv6.path_mtu_discovery=1" > /etc/sysctl.d/99-ipv6-test.conf
sysctl -p /etc/sysctl.d/99-ipv6-test.conf
echo "=== 修复完成 ==="
' > fix_ipv6.sh