Last active
December 23, 2018 11:26
-
-
Save yy0c/5539324 to your computer and use it in GitHub Desktop.
OpenWrt Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask,send_from_directory | |
import os | |
UPLOAD_FOLDER = os.getcwd() | |
application = app = Flask(__name__) | |
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER | |
@app.route('/snapshots/trunk/ar71xx/packages/') | |
def packages(): | |
with open('packages.htm', 'r') as f: | |
return f.read() | |
@app.route('/snapshots/trunk/ar71xx/packages/<filename>') | |
def uploaded_file(filename): | |
return send_from_directory(app.config['UPLOAD_FOLDER'], | |
filename) | |
if __name__ == '__main__': | |
app.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/sh | |
# TimeZone | |
uci set system.@system[0].timezone=CST-8 | |
uci set system.@system[0].zonename=Asia/Shanghai | |
uci commit system | |
# PPPOE | |
uci set network.wan.proto=pppoe | |
uci set network.wan.username=username | |
uci set network.wan.password=password | |
uci set network.wan.peerdns=0 | |
uci set network.wan.dns="223.5.5.5 8.8.8.8" | |
uci commit network | |
/etc/init.d/network restart | |
# Wi-Fi | |
uci set wireless.@wifi-iface[0].ssid="SSIDName" | |
uci set wireless.@wifi-iface[0].encryption="psk2+tkip+aes" | |
uci set wireless.@wifi-iface[0].key="key" | |
uci set wireless.@wifi-device[0].disabled=0 | |
uci set wireless.@wifi-device[0].htmode=HT40 | |
uci set wireless.@wifi-device[0].noscan=1 | |
uci set wireless.@wifi-device[0].channel=3 | |
uci commit wireless | |
wifi | |
opkg update | |
# DNS | |
opkg install iptables-mod-filter kmod-ipt-filter iptables-mod-u32 kmod-ipt-u32 | |
wget http://yy0c-blog.qiniudn.com/firewall.user -O /etc/firewall.user | |
/etc/init.d/firewall restart | |
uci set dhcp.@dnsmasq[0].bogusnxdomain=183.207.232.253 | |
uci commit dhcp | |
echo 'all-servers' >> /etc/dnsmasq.conf | |
/etc/init.d/dnsmasq restart | |
# USB Storage | |
opkg install kmod-usb-ohci kmod-usb2 kmod-usb-storage kmod-nls-utf8 kmod-fs-ext4 | |
mkdir -p /mnt/sda1 | |
echo "waiting 5 seconds..." | |
sleep 5 | |
mount /dev/sda1 /mnt/sda1 | |
echo "mount /dev/sda1 /mnt/sda1" > /etc/rc.local | |
echo "exit 0" >> /etc/rc.local | |
# Other Software | |
opkg install wget screen vsftpd openvpn-polarssl python polipo # qos-scripts | |
# vsftpd | |
echo "local_root=/mnt/sda1" >> /etc/vsftpd.conf | |
/etc/init.d/vsftpd enable | |
/etc/init.d/vsftpd start | |
# Luci | |
opkg install luci luci-i18n-chinese | |
uci set luci.main.lang=zh_cn | |
uci commit luci | |
/etc/init.d/uhttpd enable | |
/etc/init.d/uhttpd start | |
# Samba | |
opkg install luci-app-samba | |
/etc/init.d/samba enable | |
/etc/init.d/samba start | |
# Shortcuts | |
echo alias l=\"ls -hF --color=auto\" >> /etc/profile | |
echo alias ll=\"ls -all\" >> /etc/profile | |
echo alias la=\"ls -a\" >> /etc/profile | |
echo alias screen=\"screen -U\" >> /etc/profile | |
# Shadowsocks | |
wget -P /tmp --no-check-certificate https://dl.dropboxusercontent.com/u/61164983/shadowsocks-libev-polarssl_latest_ar71xx.ipk | |
opkg install http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/libpolarssl_1.3.8-2_ar71xx.ipk | |
opkg install /tmp/shadowsocks-libev-polarssl_latest_ar71xx.ipk | |
#ln -s /usr/lib/libpolarssl.so /usr/lib/libpolarssl.so.7 | |
echo "net.ipv4.tcp_fastopen=3" >> /etc/sysctl.conf && sysctl -p | |
/etc/init.d/shadowsocks enable | |
/etc/init.d/shadowsocks start | |
# Fix Busybox Chinese Support | |
wget -P /tmp --no-check-certificate https://dl.dropboxusercontent.com/u/61164983/busybox_latest_ar71xx.ipk | |
opkg install /tmp/busybox_latest_ar71xx.ipk | |
# Setting Polipo | |
uci set polipo.general.proxyPort=8080 | |
uci set polipo.general.socksParentProxy=localhost:7070 | |
uci set polipo.general.socksProxyType=socks5 | |
uci commit polipo | |
/etc/init.d/polipo enable | |
/etc/init.d/polipo start | |
# QoS | |
uci set qos.wan.upload=16000 # Upload speed in kBits/s | |
uci set qos.wan.download=16000 # Download speed in kBits/s | |
uci set qos.wan.enabled=1 | |
uci set qos.@classify[0].ports=22,53,1119,3724 | |
uci commit qos | |
/etc/init.d/qos start | |
/etc/init.d/qos enable | |
echo "waiting 5 seconds..." | |
sleep 5 | |
# Xunlei | |
ln -s /mnt/sda1/xunlei-lixian/lixian_cli.py /usr/bin/lx | |
lx config username "username" | |
lx config password "passwd" | |
lx config output-dir "/mnt/sda1" | |
lx config no-hash | |
lx config -- aria2-opts "-s10 -x10 -c" | |
# SSH | |
cd /etc/dropbear | |
cat /tmp/id_*.pub >> authorized_keys | |
chmod 0600 authorized_keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good