要翻墙成功,这一步是最重要的
分三步,下载本项目openwrt-fanqiang;复制配置文件;修改配置文件
下面以linux系统 ~/Downloads 下操作为例
-
git下载openwrt-fanqiang项目
cd ~/Downloads git clone https://github.com/softwaredownload/openwrt-fanqiang
-
或者下载zip文件
https://github.com/softwaredownload/openwrt-fanqiang/archive/master.zip
本地项目文件夹是: ~/Downloads/openwrt-fanqiang
建立一个配置文件夹,以路由器型号结束,如 ~/Downloads/openwrt-wndr4300
cd ~/Downloads
mkdir openwrt-wndr4300
cd openwrt-fanqiang
cp -R openwrt/default/* ~/Downloads/openwrt-wndr4300/
cp -R openwrt/wndr4300/* ~/Downloads/openwrt-wndr4300/
上面的操作,先复制共用的配置文件 openwrt/default/* 到 openwrt-wndr4300目录下
然后复制wndr4300专用的配置文件到 openwrt/wndr4300/* 到 openwrt-wndr4300目录下,如果有同名文件就覆盖
如果你要贡献本项目,也是先在openwrt-fanqiang/openwrt目录下先建立路由器型号为名称的文件夹,再把专用的配置文件放到此文夹下。注意文件夹和文件名都是小写的
主要修改以下文件:
openwrt-wndr4300/etc/shadowsocks-libev/config.json
openwrt-wndr4300/usr/bin/ss-firewall-asia
openwrt-wndr4300/etc/uci-defaults/defaults
为了方便以后升级,可以写个bash文件自动修改配置文件
一切操作尽量自动化,你甚至可以自动化一切操作:下载ImageBuilder,下载OpenWrt源码,下载shadowsocks-libev源码,同步openwrt-fanqiang源码,编译ipk,修改翻墙设置,编译翻墙固件,早上一觉醒来,新鲜出炉、美味可口的翻墙固件就已经摆放在桌上了
下面是一个自动修改配置文件的例子,从中可以知道需要修改哪些地方。从2015年12月起,可能用于自动化修改的默认值都应该标准化,方便自动化操作
config-wndr4300.sh:
#!/bin/bash
# Author: https://github.com/softwaredownload/openwrt-fanqiang
# Date: 2015-12-20
REPOSITORY=~/Downloads/openwrt-fanqiang
CONFIG=~/Downloads/openwrt-wndr4300
createdir() {
rm -rf $CONFIG
mkdir $CONFIG
}
copy() {
cp -R $REPOSITORY/openwrt/default/* $CONFIG/
cp -R $REPOSITORY/openwrt/wndr4300/* $CONFIG/
}
setmod() {
chmod +x $CONFIG/usr/bin/ss-firewall-asia
chmod +x $CONFIG/etc/uci-defaults
chmod +x $CONFIG/etc/uci-defaults/*
}
modify() {
# server ip address
sed -i 's/1.0.9.8/server_ip/' $CONFIG/etc/shadowsocks-libev/config.json
# server_port
sed -i 's/1098/server_port/' $CONFIG/etc/shadowsocks-libev/config.json
# local_port
sed -i 's/7654/7654/' $CONFIG/etc/shadowsocks-libev/config.json
# password
sed -i 's/killgfw/killgfw/' $CONFIG/etc/shadowsocks-libev/config.json
# method
sed -i 's/chacha20-ietf-poly1305/chacha20-ietf-poly1305/' $CONFIG/etc/shadowsocks-libev/config.json
# server ip addresss
sed -i 's/1.0.9.8/server_ip/' $CONFIG/usr/bin/ss-firewall-asia
# local_port
sed -i 's/7654/7654/' $CONFIG/usr/bin/ss-firewall-asia
# ppoe username
sed -i 's/wan-username/wan-username/' $CONFIG/etc/uci-defaults/defaults
# ppoe password
sed -i 's/wan-password/wan-password/' $CONFIG/etc/uci-defaults/defaults
# wifi password
sed -i 's/icanfly9876/icanfly9876/g' $CONFIG/etc/uci-defaults/defaults
# router login password for root
sed -i 's/\\nfanqiang/\\nfanqiang/' $CONFIG/etc/uci-defaults/defaults
}
if [ "$1" = "createdir" ]; then
createdir
elif [ "$1" = "copy" ]; then
copy
elif [ "$1" = "setmod" ]; then
setmod
elif [ "$1" = "modify" ]; then
modify
else
echo "usage: createdir copy setmod modify"
fi
config-wndr4300.sh使用方法:
必改值是:
server_ip
wan-username
wan-password
如果你比较懒,就改这三项就行了,可以说本教程是最简单的翻墙方案了
选改值:
router login password for root
wifi password
其他值一般保持默认值就可以了
假设config-wndr4300.sh在~/Downloads目录下,运行命令自动修改翻墙配置:
cd ~/Downloads
sudo chmod +x config-wndr4300.sh
./config-wndr4300.sh createdir
./config-wndr4300.sh copy
./config-wndr4300.sh setmod
./config-wndr4300.sh modify
相关资源: