Openwrt-LXC添加科学上网功能
· 2 min read
在上一篇blog中,我们讲到用LXC搭建最轻量的Openwrt系统,今天我们看下,如何给Openwrt添加科学上网功能.
科学上网插件比较和测试
Passwall/Openclash这些是比较常见的科学上网插件, 经过我的测试, 在最小的openwrt环境下, passwall并不能正常工作,所以下面我们将介绍openclash的使用.
安装openclash
下载
下载地址:https://github.com/vernesong/OpenClash
#创建tmp文件夹
mkdir tmp
cd tmp
wget -0 openclash.ipk https://github.com/vernesong/OpenClash/releases/download/v0.46.075/luci-app-openclash_0.46.075_all.ipk
安装
#回到root文件夹
cd ../
#安装依赖
opkg update
opkg install bash iptables dnsmasq-full curl ca-bundle ipset ip-full iptables-mod-tproxy iptables-mod-extra ruby ruby-yaml kmod-tun kmod-inet-diag unzip luci-compat luci luci-base
#安装openclash
opkg install /root/openclash.ipk
安装clash内核
内核下载地址:https://github.com/MetaCubeX/mihomo/releases
cd /etc/openclash/core/
wget -O clash_meta $内核下载地址
配置openclash
配置局域网代理
默认的代理端口如下
代理协议 | 端口 |
---|---|
HTTP(S) 代理端口 | 7890 |
SOCKS5 代理端口 | 7891 |
混合代理端口 | 7893 |
一般来说,我们可以取消局域网代理认证: 菜单位置: 覆写设置--》设置 SOCKS5/HTTP(S) 认证信息--》将enable取消
配置局域网内终端
网关模式
在网关模式下,需要修改Wlan或lan口的Gateway IP为Openwrt的IP(192.168.50.101);DNS设置为Openwrt的IP(192.168.50.101);
Proxy模式
或者你在网络设置或者SwitchyOmega这类插件中将openclash的Proxy信息填入.
dnsmasq-full
could not access the internet, remove the plugin, DNS故障排查