11 月 26 日 回复了 JCZ2MkKb5S8ZX9pq 创建的主题 › 华为 › 请问鸿蒙系统怎么科学上网? |
鸿蒙系统使用时需要导入根证书,我的证书是 lets encrypt 签发的,根是 YE1,你自己用的啥证书你自己找 ai 问搞定就行,整体步骤:
先导入证书,点这个链接下载证书:
https://letsencrypt.org/certs/gen-y/root-ye.pem
然后导入,手机设置:
华为鸿蒙 5 及以上手机:隐私和安全>高级>证书与凭据>从存储设备安装>CA 证书>安装,选刚才下载的 root-ye.pem
然后手机网络设置,添加 VPN
华为鸿蒙 5 及以上手机:移动网络>VPN>添加 VPN 网络
1.名称随便写
2.类型选 IKEv2/IPSec MSCHAPv2
3.服务器地址填
你的域名
4.IPSec 标识符跟服务器地址一样,也是
你的域名
5.IPSec CA 证书选刚才导入的 Root YE
6.填用户名、密码,连接就行了
11 月 26 日 回复了 JCZ2MkKb5S8ZX9pq 创建的主题 › 华为 › 请问鸿蒙系统怎么科学上网? |
鸿蒙系统原生支持 设置 移动网络 VPN 添加 VPN 网络 类型 IKEv2/IPSec MSCHAPv2 等类型,我是自建了 IKEv2/IPSec MSCHAPv2 连到家里,连到家里之后流量怎么走就随你了。我的部分 docker 配置可以参考,没贴出来的部分你自己让 ai 自建你自己的就行
cat docker-compose.yml
++ cat docker-compose.yml
services:
省略
ddns-go:
image: jeessy/ddns-go:latest
container_name: ddns-go
restart: always
ports:
- "0.0.0.0:9876:9876"
volumes:
- ./ddns-go-data:/root
省略
# 9. IKEv2 / IPSec VPN 服务
ikev2-vpn:
build: ./ikev2-vpn
container_name: ikev2-vpn
restart: always
ports:
- "0.0.0.0:500:500/udp" # IKEv2 协商端口
- "0.0.0.0:4500:4500/udp" # NAT-T 端口
sysctls:
- net.ipv4.ip_forward=1 # 由 Docker 在容器 netns 初始化时设置
cap_add:
- NET_ADMIN
- NET_RAW # bridge 模式下需要,用于 raw socket 操作
volumes:
- ./ikev2-vpn/swanctl/swanctl.conf:/etc/swanctl/swanctl.conf
# 1. 把 acme.sh 自动生成的中间CA映射进容器CA目录
- ./ssl/你的域名_ecc/ca.cer:/etc/swanctl/x509ca/letsencrypt-ca.cer:ro
# 2. 直接映射 acme.sh 自动生成的完整证书链(叶子+中间CA)作为服务端证书
- ./ssl/你的域名_ecc/fullchain.cer:/etc/swanctl/x509/cert.pem:ro
# 3. 直接将私钥映射到容器内的 ecdsa 密钥目录
- ./ssl/你的域名_ecc/你的域名.key:/etc/swanctl/ecdsa/privkey.pem:ro
# 防止 acme 容器被清理
acme-holder:
image: neilpang/acme.sh:latest
container_name: acme-holder
restart: unless-stopped
entrypoint: ["sleep", "infinity"]
cat ikev2-vpn/Dockerfile
++ cat ikev2-vpn/Dockerfile
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
strongswan \
strongswan-swanctl \
strongswan-pki \
charon-systemd \
libcharon-extra-plugins \
libcharon-extauth-plugins \
libstrongswan-extra-plugins \
libstrongswan-standard-plugins \
iptables \
iproute2 \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
CMD ["/entrypoint.sh"]cat ikev2-vpn/entrypoint.sh
++ cat ikev2-vpn/entrypoint.sh
#!/bin/bash
set -evx
# 后台启动 charon
/usr/lib/ipsec/charon &
CHARON_PID=$!
# 等待 vici 接口就绪
for i in $(seq 1 30); do
if swanctl --stats >/dev/null 2>&1; then
echo "charon vici ready, loading swanctl config..."
break
fi
sleep 1
done
# 加载所有 swanctl 配置(连接、证书、密钥、pool、secrets)
swanctl --load-all
iptables 命令省略
# 保持容器前台运行
wait $CHARON_PID
cat ikev2-vpn/swanctl/swanctl.conf | sed '/eap-.*{/,/}/ { s/eap-[^{ ]*/eap-打码/; s/id = .*/id = 打码/; s/secret = .*/secret = "打码"/ }'
++ cat ikev2-vpn/swanctl/swanctl.conf
++ sed '/eap-.*{/,/}/ { s/eap-[^{ ]*/eap-打码/; s/id = .*/id = 打码/; s/secret = .*/secret = "打码"/ }'
connections {
ikev2-mschapv2 {
version = 2
proposals = default
rekey_time = 0s
fragmentation = yes
encap = yes
send_cert = always
local {
auth = pubkey
certs = cert.pem
id = 你的域名
}
remote {
auth = eap-mschapv2
eap_id = %any
}
children {
ikev2-child {
local_ts = 0.0.0.0/0
rekey_time = 0s
}
}
pools = vpn_pool
}
}
pools {
vpn_pool {
addrs = 10.10.10.2-10.10.10.254
dns = 10.10.10.1
}
}
secrets {
eap-打码 {
id = 打码
secret = "打码"
}
eap-打码 {
id = 打码
secret = "打码"
}
}
crontab -l | sed "s/Ali_Key=[^ ]*/Ali_Key=\"打码\"/; s/Ali_Secret=[^ ]*/Ali_Secret=\"打码\"/"
++ crontab -l
++ sed 's/Ali_Key=[^ ]*/Ali_Key="打码"/; s/Ali_Secret=[^ ]*/Ali_Secret="打码"/'
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
0 3 * * * /usr/bin/docker run --rm -v /opt/remote-gateway/ssl:/acme.sh -e Ali_Key="打码" -e Ali_Secret="打码" neilpang/acme.sh --cron --home /acme.sh >> /opt/remote-gateway/acme_cron.log 2>&1 && /usr/bin/docker exec nginx nginx -s reload >> /opt/remote-gateway/acme_cron.log 2>&1 && /usr/bin/docker exec ikev2-vpn swanctl --load-all >> /opt/remote-gateway/acme_cron.log 2>&1
9 月 12 日 回复了 hyphenhhh 创建的主题 › 问与答 › 木椅子坐久了,经常屁股有汗,会黏住裤衩,好不透气,怎么办 |
6 月 15 日 回复了 P013onEr 创建的主题 › 分享发现 › 🔔 英国沃达丰 eSIM 0 元购 Bug 快捷直达通道! |
6 月 15 日 回复了 P013onEr 创建的主题 › 分享发现 › 🔔 英国沃达丰 eSIM 0 元购 Bug 快捷直达通道! |
6 月 2 日 回复了 RustyAnchor 创建的主题 › 职场话题 › 公司搬家直线距离 21km,这种情况争取礼包胜算大吗? |
5 月 5 日 回复了 lionest1229 创建的主题 › 宽带症候群 › 机场专用客户端如何抓取节点 |
4 月 11 日 回复了 airtee 创建的主题 › macOS › 自己撸了一个小工具、终于吧 Mac"系统数据"占用干下来了 |
4 月 11 日 回复了 airtee 创建的主题 › macOS › 自己撸了一个小工具、终于吧 Mac"系统数据"占用干下来了 |
4 月 7 日 回复了 zpxshl 创建的主题 › Android › 求推荐测试机:可简单刷入 aosp+Magisk,性能尽可能好 |
2 月 23 日 回复了 bclerdx 创建的主题 › Android › 我比较疑惑,为何在 Github 上部分项目所提供的 APK 文件不直接提供签名后的 Universal APK 打包,而是提供若干分支? |
2025 年 12 月 30 日 回复了 smdbh 创建的主题 › 问与答 › win 有什么 git 客户端,可以管理 Linux 上的 git 项目 |
2025 年 12 月 8 日 回复了 simple2025 创建的主题 › 生活 › 残念,我的蚊帐还要买吗? |
2025 年 12 月 8 日 回复了 simple2025 创建的主题 › 生活 › 残念,我的蚊帐还要买吗? |
2025 年 12 月 6 日 回复了 simple2025 创建的主题 › 生活 › 残念,我的蚊帐还要买吗? |
2025 年 12 月 6 日 回复了 simple2025 创建的主题 › 生活 › 残念,我的蚊帐还要买吗? |
2025 年 11 月 29 日 回复了 qviqvi 创建的主题 › App Store › 有没有所有墙内镜像汇总的网站 |
2025 年 11 月 19 日 回复了 blackbookbj277 创建的主题 › 宽带症候群 › ipv6 直连速度确实挺快的 |