add ipv6 config
parent
785f083dbd
commit
300584bcaf
|
@ -36,6 +36,10 @@ install_wireguard() {
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_keys() {
|
generate_keys() {
|
||||||
|
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||||
|
#echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
|
||||||
|
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
|
||||||
|
#echo "net.ipv6.conf.all.forwarding=1" >> /etc/sysctl.conf
|
||||||
cd /etc/wireguard
|
cd /etc/wireguard
|
||||||
# 生成WireGuard私钥和公钥
|
# 生成WireGuard私钥和公钥
|
||||||
echo "正在生成WireGuard私钥和公钥..."
|
echo "正在生成WireGuard私钥和公钥..."
|
||||||
|
@ -55,8 +59,8 @@ create_server_config() {
|
||||||
echo "[Interface]" > /etc/wireguard/wg0.conf
|
echo "[Interface]" > /etc/wireguard/wg0.conf
|
||||||
echo "PrivateKey = $(cat /etc/wireguard/privatekey)" >> /etc/wireguard/wg0.conf
|
echo "PrivateKey = $(cat /etc/wireguard/privatekey)" >> /etc/wireguard/wg0.conf
|
||||||
echo "Address = $server_internal_ip/24" >> /etc/wireguard/wg0.conf
|
echo "Address = $server_internal_ip/24" >> /etc/wireguard/wg0.conf
|
||||||
echo "PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o $eth -j MASQUERADE" >> /etc/wireguard/wg0.conf
|
echo "PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o $eth -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o $eth -j MASQUERADE" >> /etc/wireguard/wg0.conf
|
||||||
echo "PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o $eth -j MASQUERADE" >> /etc/wireguard/wg0.conf
|
echo "PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o $eth -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o $eth -j MASQUERADE" >> /etc/wireguard/wg0.conf
|
||||||
echo "ListenPort = $server_port" >> /etc/wireguard/wg0.conf
|
echo "ListenPort = $server_port" >> /etc/wireguard/wg0.conf
|
||||||
|
|
||||||
echo "" >> /etc/wireguard/wg0.conf
|
echo "" >> /etc/wireguard/wg0.conf
|
||||||
|
|
4
xbbox.sh
4
xbbox.sh
|
@ -55,7 +55,7 @@ check_system() {
|
||||||
|
|
||||||
get_self_cert() {
|
get_self_cert() {
|
||||||
mkdir self
|
mkdir self
|
||||||
$INS install -y openssl
|
$INS install openssl -y
|
||||||
# openssl genrsa -out self/1.key 2048
|
# openssl genrsa -out self/1.key 2048
|
||||||
openssl ecparam -genkey -name prime256v1 -noout -out self/1.key
|
openssl ecparam -genkey -name prime256v1 -noout -out self/1.key
|
||||||
# 生成CA证书
|
# 生成CA证书
|
||||||
|
@ -76,7 +76,7 @@ uninstall_self() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_docker() {
|
install_docker() {
|
||||||
$INS install -y curl
|
$INS install curl -y
|
||||||
curl -fsSL https://get.docker.com | sh
|
curl -fsSL https://get.docker.com | sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue