N1 盒子
上一章,我们已经刷好了 Armbian 系统,现在我们来安装 mihomo
一、安装 LXC 环境
二、安装 mihomo
1、创建基于 Debian 的 mihomo 容器
1
| lxc-create --name mihomo --template download -- --dist debian --release bookworm --arch arm64 --server mirrors.bfsu.edu.cn/lxc-images
|
2、修改 mihomo 配置
1
| nano /var/lib/lxc/mihomo/config
|
2.1、直接替换原来的配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| lxc.start.auto = 1
lxc.include = /usr/share/lxc/config/common.conf lxc.arch = linux64
lxc.apparmor.profile = generated lxc.apparmor.allow_nesting = 1 lxc.rootfs.path = dir:/var/lib/lxc/mihomo/rootfs lxc.uts.name = mihomo
lxc.net.0.type = veth lxc.net.0.link = vmbr0 lxc.net.0.flags = up
lxc.cgroup2.devices.allow = c 10:200 rwm lxc.mount.entry = /dev/net/tun dev/net/tun none bind,create=file
|
3、进入、启动容器
1 2 3 4 5
| lxc-start mihomo
lxc-attach mihomo
|
4、安装基础环境
1
| apt install -y openssh-server nano curl wget git apt-transport-https ca-certificates
|
5、配置 mihomo 网络
1
| nano /etc/systemd/network/eth0.network
|
5.1、根据你实际 IP 地址修改
1 2 3 4 5 6 7 8 9
| [Match] Name=eth0 [Network] Address=192.168.0.3/24 DNS=192.168.0.1 IPForward=yes IPv6AcceptRA=true [Route] Gateway=192.168.0.1
|
三、启动服务
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| systemctl status systemd-networkd
systemctl start systemd-networkd
systemctl stop systemd-networkd
systemctl restart systemd-networkd
systemctl enable systemd-networkd
systemctl disable systemd-networkd
|
mihomo 详细配置参考
Linux 系统安装 mihomo TUN 模式教程
Linux 系统安装 mihomo TProxy 模式教程
退出 LXC 容器
设置容器开机自启
1
| nano /etc/systemd/system/lxc-start.service
|
添加下面代码
1 2 3 4 5 6 7 8
| [Unit] Description="LXC autostart for lxc user"
[Service] ExecStart=/usr/bin/lxc-autostart --all
[Install] WantedBy=default.target
|
特别鸣谢